Skip to content

Commit

Permalink
0.2.0
Browse files Browse the repository at this point in the history
Copy pasting the changelog going up because I can't be bothered

IT IS RECOMMENDED TO DELETE config/simpledifficulty/blockTemperatures.json BEFORE UPDATING!
(a lot of defaults got changed, so it needs to be refreshed!)

Block based heat sources now stack with each other a little bit, for example: two campfires are hotter than one.
Some blocks have been rebalanced to fit this new behavior.
(you can also turn the temperature stacking off in the config if you don't like it)

Command to reload the json config while ingame!! No need to restart the game anymore.
/simpledifficulty updateJson

NEW CONFIGS
Configurable consumables (drinks, food, whatever gets removed after you use it)
Consumables' temperature effect lingers for however long it's set (for example, Cactus Juice sets your temperature +1 for a minute)
Temperature effects with the same group don't stack with each other (you can make your own groups too)

Multiple block states on the same block are configurable now
There are now options to change the strength and range of the heater / chiller
  • Loading branch information
Charles445 committed Feb 4, 2020
1 parent d1c4ee1 commit 0d0bb17
Show file tree
Hide file tree
Showing 44 changed files with 1,303 additions and 425 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ buildscript {
apply plugin: 'net.minecraftforge.gradle.forge'


version = "1.12.2-0.1.1"
version = "1.12.2-0.2.0"
group = "com.charles445.simpledifficulty" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "SimpleDifficulty"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.charles445.simpledifficulty.command.CommandSimpleDifficulty;
import com.charles445.simpledifficulty.debug.DebugVerifier;
import com.charles445.simpledifficulty.network.PacketHandler;
import com.charles445.simpledifficulty.proxy.IProxy;

import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;

@Mod
(
Expand All @@ -29,7 +32,7 @@ public class SimpleDifficulty
{
public static final String MODID = "simpledifficulty";
public static final String NAME = "SimpleDifficulty";
public static final String VERSION = "0.1.1";
public static final String VERSION = "0.2.0";

@Mod.Instance(SimpleDifficulty.MODID)
public static SimpleDifficulty instance;
Expand All @@ -52,6 +55,12 @@ public static void preInit(FMLPreInitializationEvent event)

}

@Mod.EventHandler
public static void init(FMLInitializationEvent event)
{
proxy.init();
}

@Mod.EventHandler
public static void postInit(FMLPostInitializationEvent event)
{
Expand All @@ -65,6 +74,12 @@ public static void loadComplete(FMLLoadCompleteEvent event)
verifier.verify();
}

@Mod.EventHandler
public static void serverStarting(FMLServerStartingEvent event)
{
event.registerServerCommand(new CommandSimpleDifficulty());
}

static
{
FluidRegistry.enableUniversalBucket();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package com.charles445.simpledifficulty.api.config;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.charles445.simpledifficulty.api.config.json.JsonConsumableTemperature;
import com.charles445.simpledifficulty.api.config.json.JsonConsumableThirst;
import com.charles445.simpledifficulty.api.config.json.JsonPropertyTemperature;
import com.charles445.simpledifficulty.api.config.json.JsonPropertyValue;
import com.charles445.simpledifficulty.api.config.json.JsonTemperature;

import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;

public class JsonConfig
{
public static Map<String, JsonTemperature> armorTemperatures = new HashMap<String, JsonTemperature>();
public static Map<String, List<JsonPropertyTemperature>> blockTemperatures = new HashMap<String, List<JsonPropertyTemperature>>();
public static Map<String, JsonTemperature> fluidTemperatures = new HashMap<String, JsonTemperature>();
public static Map<String, List<JsonConsumableTemperature>> consumableTemperature = new HashMap<String, List<JsonConsumableTemperature>>();
public static Map<String, List<JsonConsumableThirst>> consumableThirst = new HashMap<String, List<JsonConsumableThirst>>();

//TODO jdoc

//Armor

public static void registerArmorTemperature(ItemStack stack, float temperature)
{
registerArmorTemperature(stack.getItem().getRegistryName().toString(), temperature);
}

public static void registerArmorTemperature(String registryName, float temperature)
{
armorTemperatures.put(registryName, new JsonTemperature(temperature));
}

//Blocks

public static void registerBlockTemperature(Block block, float temperature, JsonPropertyValue... properties)
{
registerBlockTemperature(block.getRegistryName().toString(), temperature, properties);
}

public static void registerBlockTemperature(String registryName, float temperature, JsonPropertyValue... properties)
{
if(!blockTemperatures.containsKey(registryName))
blockTemperatures.put(registryName, new ArrayList<JsonPropertyTemperature>());
blockTemperatures.get(registryName).add(new JsonPropertyTemperature(temperature,properties));
}

//Fluid

public static void registerFluidTemperature(String fluidName, float temperature)
{
fluidTemperatures.put(fluidName, new JsonTemperature(temperature));
}

//Consumable Temperature

public static void registerConsumableTemperature(String group, ItemStack stack, float temperature, int duration)
{
String registryName = stack.getItem().getRegistryName().toString();
if(!consumableTemperature.containsKey(registryName))
consumableTemperature.put(registryName, new ArrayList<JsonConsumableTemperature>());

if(stack.getHasSubtypes())
consumableTemperature.get(registryName).add(new JsonConsumableTemperature(group, temperature, stack.getMetadata(), duration));
else
consumableTemperature.get(registryName).add(new JsonConsumableTemperature(group, temperature, -1, duration));
}

//ConsumableThirst

public static void registerConsumableThirst(ItemStack stack, int amount, float saturation, float thirstChance)
{
int metadata = -1;

if(stack.getHasSubtypes())
metadata = stack.getMetadata();

registerConsumableThirst(stack.getItem().getRegistryName().toString(), metadata, amount, saturation, thirstChance);
}

public static void registerConsumableThirst(String registryName, int metadata, int amount, float saturation, float thirstChance)
{
if(!consumableThirst.containsKey(registryName))
consumableThirst.put(registryName, new ArrayList<JsonConsumableThirst>());

consumableThirst.get(registryName).add(new JsonConsumableThirst(metadata,amount,saturation,thirstChance));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.charles445.simpledifficulty.api.config.json;

import net.minecraft.item.ItemStack;

public class JsonConsumableTemperature
{
public String group;
public int metadata;
public float temperature;
public int duration;

public JsonConsumableTemperature(String group, float temperature, int metadata, int duration)
{
this.temperature = temperature;
this.metadata = metadata;
this.duration = duration;
this.group = group.toLowerCase();
}

public boolean matches(ItemStack stack)
{
return metadata == -1 || metadata == 32767 || metadata == stack.getMetadata();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.charles445.simpledifficulty.api.config.json;

import net.minecraft.item.ItemStack;

public class JsonConsumableThirst
{
public int metadata;
public int amount;
public float saturation;
public float thirstyChance;

public JsonConsumableThirst(int metadata, int amount, float saturation, float thirstyChance)
{
this.metadata = metadata;
this.amount = amount;
this.saturation = saturation;
this.thirstyChance = thirstyChance;
}

public boolean matches(ItemStack stack)
{
return metadata == -1 || metadata == 32767 || metadata == stack.getMetadata();
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.charles445.simpledifficulty.config.json;
package com.charles445.simpledifficulty.api.config.json;

import java.util.HashMap;
import java.util.Map;
Expand All @@ -16,11 +16,11 @@ public class JsonPropertyTemperature
@SerializedName("temperature")
public float temperature;

public JsonPropertyTemperature(float temperature, PropertyValue ... props)
public JsonPropertyTemperature(float temperature, JsonPropertyValue ... props)
{
this.temperature = temperature;
this.properties = new HashMap<String,String>();
for(PropertyValue prop : props)
for(JsonPropertyValue prop : props)
{
properties.put(prop.property, prop.value);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.charles445.simpledifficulty.api.config.json;

public class JsonPropertyValue
{
public String property;
public String value;

public JsonPropertyValue(String property, String value)
{
this.property = property;
this.value = value;
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.charles445.simpledifficulty.config.json;
package com.charles445.simpledifficulty.api.config.json;

import com.google.gson.annotations.SerializedName;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.charles445.simpledifficulty.api.temperature;

import com.google.common.collect.ImmutableMap;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.gameevent.TickEvent;
Expand All @@ -8,13 +10,17 @@ public interface ITemperatureCapability
{
public int getTemperatureLevel();
public int getTemperatureTickTimer();
public ImmutableMap<String, TemporaryModifier> getTemporaryModifiers();

public void setTemperatureLevel(int temperature);
public void setTemperatureTickTimer(int ticktimer);
public void setTemporaryModifier(String name, float temperature, int duration);

public void addTemperatureLevel(int temperature);
public void addTemperatureTickTimer(int ticktimer);

public void clearTemporaryModifiers();

/**
* Returns the capability's matching TemperatureEnum enum
* @return TemperatureEnum for the temperature
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.charles445.simpledifficulty.api.temperature;

public class TemporaryModifier
{
//Container for a temperature and a duration

public float temperature;
public int duration;

public TemporaryModifier(float temperature, int duration)
{
this.temperature = temperature;
this.duration = duration;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.charles445.simpledifficulty.api.temperature;

public enum TemporaryModifierGroupEnum
{
FOOD("food"),
DRINK("drink");

private String group;

private TemporaryModifierGroupEnum(String group)
{
this.group=group;
}

public String group()
{
return group;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

public enum ThirstEnum
{
NORMAL ( 3, 0.1f, 0.75f), //0.3
RAIN ( 1, 0.05f, 0.0f), //0.05
POTION ( 2, 0.1f, 0.0f), //0.2
PURIFIED( 6, 0.5f, 0.0f); //3
NORMAL ( 3, 0.3f, 0.75f),
RAIN ( 1, 0.05f, 0.0f),
POTION ( 2, 0.2f, 0.0f),
PURIFIED( 6, 3.0f, 0.0f);

private int thirst;
private float saturation;
Expand All @@ -28,7 +28,7 @@ public float getSaturation()
return saturation;
}

public float getDirtyChance()
public float getThirstyChance()
{
return dirty;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public BlockTemperature(float temperature)
this.temperature = temperature;
}

public float getActiveTemperature()
public float getActiveTemperatureMult()
{
return temperature;
}
Expand Down
Loading

0 comments on commit 0d0bb17

Please sign in to comment.