-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
1 parent
d1c4ee1
commit 0d0bb17
Showing
44 changed files
with
1,303 additions
and
425 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
src/main/java/com/charles445/simpledifficulty/api/config/JsonConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/com/charles445/simpledifficulty/api/config/json/JsonConsumableTemperature.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/com/charles445/simpledifficulty/api/config/json/JsonConsumableThirst.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/main/java/com/charles445/simpledifficulty/api/config/json/JsonPropertyValue.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...fficulty/config/json/JsonTemperature.java → ...ulty/api/config/json/JsonTemperature.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/main/java/com/charles445/simpledifficulty/api/temperature/TemporaryModifier.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...main/java/com/charles445/simpledifficulty/api/temperature/TemporaryModifierGroupEnum.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.