Skip to content

Commit

Permalink
0.2.3 Ore Excavation, Tinker's Construct, Ice Armor, misc config and …
Browse files Browse the repository at this point in the history
…bugs

Moved around a lot of config again, it'd be a good idea to delete simpledifficulty.cfg in your config folder.

New Ice Armor skin (thanks to tehmadtitaan)
OreExcavation Built-In Compatibility
Tinker's Construct Built-In Default Config
Thermometer HUD position configurable
Block temperature json handling bug fixes (blockstate stuff)

The in-game config is becoming a cumbersome mess, I'll have to rethink it all later.
(There is no distinction between default json config and compatibility, even though they behave very differently)
  • Loading branch information
Charles445 committed Feb 7, 2020
1 parent ff1ab2c commit 38a77da
Show file tree
Hide file tree
Showing 28 changed files with 598 additions and 226 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.2.2"
version = "1.12.2-0.2.3"
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 @@ -32,7 +32,7 @@ public class SimpleDifficulty
{
public static final String MODID = "simpledifficulty";
public static final String NAME = "SimpleDifficulty";
public static final String VERSION = "0.2.2";
public static final String VERSION = "0.2.3";

@Mod.Instance(SimpleDifficulty.MODID)
public static SimpleDifficulty instance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ public enum ClientOptions implements IConfigOption
/*Boolean*/ DRAW_THIRST_SATURATION ("drawThirstSaturation"),
/*Boolean*/ ENABLE_THERMOMETER ("enableThermometer"),
/*Boolean*/ ALTERNATE_TEMP ("alternateTemp"),
/*BOOLEAN*/ HUD_THERMOMETER ("hudThermometer");
/*Boolean*/ HUD_THERMOMETER ("hudThermometer"),
/*Integer*/ HUD_THERMOMETERX ("hudThermometerX"),
/*Integer*/ HUD_THERMOMETERY ("hudThermometerY");

String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ public boolean getBoolean(IConfigOption option)
return Boolean.valueOf(values.get(option.getName()));
}

public int getInteger(IConfigOption option)
{
return Integer.valueOf(values.get(option.getName()));
}

public void put(IConfigOption option, Object obj)
{
values.put(option.getName(), ""+obj);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,17 @@ public boolean matchesDescribedProperties(JsonPropertyValue... props)
for(JsonPropertyValue prop : props)
{
if(!properties.containsKey(prop.property))
{
return false;
}
else
{
//Has key
if(!prop.value.equals(properties.get(prop.property)))
{
return false;
}
}
}

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

public class JsonTemperatureMetadata
{
public float temperature;
public int metadata;
public float temperature;

public JsonTemperatureMetadata(int metadata, float temperature)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,10 @@ else if(tempEnum == TemperatureEnum.BURNING)

//TODO configure where this thing draws

RenderUtil.drawTexturedModalRect(x, y - 18, therm_x, therm_y, textureWidthTherm, textureHeightTherm);
int therm_xOffset = ClientConfig.instance.getInteger(ClientOptions.HUD_THERMOMETERX);
int therm_yOffset = ClientConfig.instance.getInteger(ClientOptions.HUD_THERMOMETERY);

RenderUtil.drawTexturedModalRect(x + therm_xOffset, y - 18 + therm_yOffset, therm_x, therm_y, textureWidthTherm, textureHeightTherm);
}
// - - -

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ else if(SDCompatibility.disabledDefaultJson.contains(modid))
}
else
{
message(sender, "There are no defaults for the mod "+modid);
message(sender, "There are no defaults for the mod "+modid+", or it's disabled in the compatibility config.");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import com.charles445.simpledifficulty.api.temperature.ITemperatureDynamicModifier;
import com.charles445.simpledifficulty.api.temperature.ITemperatureModifier;
import com.charles445.simpledifficulty.api.temperature.TemperatureRegistry;
import com.charles445.simpledifficulty.config.ModConfig;
import com.charles445.simpledifficulty.util.CompatUtil;

import net.minecraftforge.fml.common.Loader;

Expand All @@ -24,15 +26,20 @@ public class CompatController
//Dependency Type Quick Reference
//(None, Reflection, Import)

//AUW - None
//SereneSeasons - Reflection
//AUW - None (Imitation)
//HarvestFestival - Reflection (API)
//OreExcavation - Reflection (SubscribeEvent)
//SereneSeasons - Reflection (API)

public static void setup()

//postInit
public static void setupCommon()
{
//Create compatibility objects
Object auwDynamicModifier = newCompatObject(ModNames.AUW, compatMod + "AUWDynamicModifier");
Object auwModifier = newCompatObject(ModNames.AUW, compatMod + "AUWModifier");
Object harvestFestivalModifier = newCompatObject(ModNames.HARVESTFESTIVAL, compatMod + "HarvestFestivalModifier");
Object oreExcavationHandler = newCompatObject(ModNames.OREEXCAVATION, compatMod + "OreExcavationHandler");
Object sereneSeasonsModifier = newCompatObject(ModNames.SERENESEASONS, compatMod + "SereneSeasonsModifier");


Expand All @@ -49,17 +56,40 @@ public static void setup()
TemperatureRegistry.registerModifier((ITemperatureModifier)harvestFestivalModifier);
}

if(oreExcavationHandler != null)
{
SimpleDifficulty.logger.info("OreExcavation Handler Enabled");
}

if(sereneSeasonsModifier instanceof ITemperatureModifier)
{
SimpleDifficulty.logger.info("Serene Seasons Modifier Enabled");
TemperatureRegistry.registerModifier((ITemperatureModifier)sereneSeasonsModifier);
}
}

public static void setupClient()
{
//This worked, but I decided it wasn't a good idea
//In safer built-in compatibilities, SimpleDifficulty would invoke functions from the mod.
//In this one, ClassicBar would be invoking things from SimpleDifficulty
//That means if something went wrong, a crash couldn't be avoided.


/*
Object classicBarProxy = newCompatObject(ModNames.CLASSICBAR, compatMod + "ClassicBarProxy");
if(classicBarProxy != null)
{
SimpleDifficulty.logger.info("ClassicBarProxy Enabled");
}
*/
}

@Nullable
public static Object newCompatObject(String modid, String clazzpath)
{
if(Loader.isModLoaded(modid) && !SDCompatibility.disabledCompletely.contains(modid))
if(CompatUtil.canUseMod(modid))
{
try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import com.charles445.simpledifficulty.api.config.JsonConfig;
import com.charles445.simpledifficulty.api.config.json.JsonPropertyTemperature;
import com.charles445.simpledifficulty.api.config.json.JsonPropertyValue;
import com.charles445.simpledifficulty.config.ModConfig;
import com.charles445.simpledifficulty.util.CompatUtil;

import net.minecraftforge.fml.common.Loader;

Expand All @@ -20,6 +22,7 @@ public void populate()
populateHarvestCraft();
populateLycanitesMobs();
populateSimpleCampfire();
populateTinkersConstruct();
}

public boolean populate(String modid)
Expand All @@ -30,6 +33,7 @@ public boolean populate(String modid)
case HARVESTCRAFT: return populateHarvestCraft();
case LYCANITESMOBS: return populateLycanitesMobs();
case SIMPLECAMPFIRE: return populateSimpleCampfire();
case TINKERSCONSTRUCT: return populateTinkersConstruct();


default: return false;
Expand All @@ -39,7 +43,7 @@ public boolean populate(String modid)
//Biomes O' Plenty
private boolean populateBiomesOPlenty()
{
if(!canUseMod(BIOMESOPLENTY))
if(!canUseMod(BIOMESOPLENTY, ModConfig.server.compatibility.toggles.biomesOPlenty))
return false;

addFluidTemperature("hot_spring_water", 3.0f);
Expand All @@ -49,7 +53,7 @@ private boolean populateBiomesOPlenty()
//HarvestCraft (Pam's)
private boolean populateHarvestCraft()
{
if(!canUseMod(HARVESTCRAFT))
if(!canUseMod(HARVESTCRAFT, ModConfig.server.compatibility.toggles.harvestCraft))
return false;

//Juice, soda, and smoothies are handled in ThirstHandler as they are more broad
Expand Down Expand Up @@ -108,7 +112,7 @@ private boolean populateHarvestCraft()
//Lycanites Mobs
private boolean populateLycanitesMobs()
{
if(!canUseMod(LYCANITESMOBS))
if(!canUseMod(LYCANITESMOBS, ModConfig.server.compatibility.toggles.lycanitesMobs))
return false;

addBlockTemperature("lycanitesmobs:purelava", 12.5f);
Expand All @@ -121,13 +125,71 @@ private boolean populateLycanitesMobs()
//Simple Camp Fire
private boolean populateSimpleCampfire()
{
if(!canUseMod(SIMPLECAMPFIRE))
if(!canUseMod(SIMPLECAMPFIRE, ModConfig.server.compatibility.toggles.simpleCampfire))
return false;

addBlockTemperature("campfire:campfire", 7.0f);
return true;
}

//Tinker's Construct
private boolean populateTinkersConstruct()
{
if(!canUseMod(TINKERSCONSTRUCT, ModConfig.server.compatibility.toggles.tinkersconstruct))
return false;

float moltenTemp = 12.5f;

addBlockTemperature("tconstruct:molten_alubrass", moltenTemp);
addBlockTemperature("tconstruct:molten_aluminum", moltenTemp);
addBlockTemperature("tconstruct:molten_ardite", moltenTemp);
addBlockTemperature("tconstruct:molten_brass", moltenTemp);
addBlockTemperature("tconstruct:molten_bronze", moltenTemp);
addBlockTemperature("tconstruct:molten_clay", moltenTemp);
addBlockTemperature("tconstruct:molten_cobalt", moltenTemp);
addBlockTemperature("tconstruct:molten_copper", moltenTemp);
addBlockTemperature("tconstruct:molten_dirt", moltenTemp);
addBlockTemperature("tconstruct:molten_electrum", moltenTemp);
addBlockTemperature("tconstruct:molten_emerald", moltenTemp);
addBlockTemperature("tconstruct:molten_glass", moltenTemp);
addBlockTemperature("tconstruct:molten_gold", moltenTemp);
addBlockTemperature("tconstruct:molten_iron", moltenTemp);
addBlockTemperature("tconstruct:molten_knightslime", moltenTemp);
addBlockTemperature("tconstruct:molten_lead", moltenTemp);
addBlockTemperature("tconstruct:molten_manyullyn", moltenTemp);
addBlockTemperature("tconstruct:molten_nickel", moltenTemp);
addBlockTemperature("tconstruct:molten_obsidian", moltenTemp);
addBlockTemperature("tconstruct:molten_pigiron", moltenTemp);
addBlockTemperature("tconstruct:molten_silver", moltenTemp);
addBlockTemperature("tconstruct:molten_steel", moltenTemp);
addBlockTemperature("tconstruct:molten_stone", moltenTemp);
addBlockTemperature("tconstruct:molten_tin", moltenTemp);
addBlockTemperature("tconstruct:molten_zinc", moltenTemp);

float lavawood = 5.0f;
float firewood = 7.0f;

addBlockTemperature("tconstruct:firewood",lavawood, new JsonPropertyValue("type", "LAVAWOOD"));
addBlockTemperature("tconstruct:firewood",firewood, new JsonPropertyValue("type", "FIREWOOD"));

addBlockTemperature("tconstruct:firewood_stairs",firewood);
addBlockTemperature("tconstruct:lavawood_stairs",lavawood);

addBlockTemperature("tconstruct:firewood_slab",lavawood, new JsonPropertyValue("type", "LAVAWOOD"));
addBlockTemperature("tconstruct:firewood_slab",firewood, new JsonPropertyValue("type", "FIREWOOD"));

float heldWood = 2.0f;

addHeldItemTemperature("tconstruct:firewood", 0, heldWood);
addHeldItemTemperature("tconstruct:firewood", 1, heldWood);
addHeldItemTemperature("tconstruct:firewood_stairs", 0, heldWood);
addHeldItemTemperature("tconstruct:lavawood_stairs", 0, heldWood);
addHeldItemTemperature("tconstruct:firewood_slab", 0, heldWood);
addHeldItemTemperature("tconstruct:firewood_slab", 1, heldWood);
addHeldItemTemperature("tconstruct:stone_torch", 0, 1.0f);

return true;
}

//
// API
Expand All @@ -154,13 +216,17 @@ private void addFluidTemperature(String fluidName, float temperature)
JsonConfig.registerFluidTemperature(fluidName, temperature);
}

private void addHeldItemTemperature(String registryName, int metadata, float temperature)
{
JsonConfig.registerHeldItem(registryName, metadata, temperature);
}
//
// Utility
//

public boolean canUseMod(String modid)
private boolean canUseMod(String modid, boolean modBool)
{
return (Loader.isModLoaded(modid) && !SDCompatibility.disabledDefaultJson.contains(modid));
return modBool && CompatUtil.canUseMod(modid);
}

private JsonPropertyTemperature propTemp(float temp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ public class ModNames
public static final String HARVESTCRAFT = "harvestcraft";
public static final String HARVESTFESTIVAL = "harvestfestival";
public static final String LYCANITESMOBS = "lycanitesmobs";
public static final String OREEXCAVATION = "oreexcavation";
public static final String SERENESEASONS = "sereneseasons";
public static final String SIMPLECAMPFIRE = "campfire";
public static final String TINKERSCONSTRUCT = "tconstruct";
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public AUWDynamicModifier()
@Override
public float applyDynamicPlayerInfluence(EntityPlayer player, float currentTemperature)
{
if(!ModConfig.server.compatibility.auw.enableAUW)
if(!ModConfig.server.compatibility.toggles.armorUnderwear)
return currentTemperature;

//TODO clean this up
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public AUWModifier()
@Override
public float getPlayerInfluence(EntityPlayer player)
{
if(!ModConfig.server.compatibility.auw.enableAUW)
if(!ModConfig.server.compatibility.toggles.armorUnderwear)
return 0.0f;

return doLinedArmor(player) + doGooPak(player);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public HarvestFestivalModifier()
@Override
public float getWorldInfluence(World world, BlockPos pos)
{
if(enabled && world.provider.isSurfaceWorld() && ModConfig.server.compatibility.harvestfestival.enableHarvestFestival)
if(enabled && world.provider.isSurfaceWorld() && ModConfig.server.compatibility.toggles.harvestFestival)
{
//Attempt Position Specific

Expand Down
Loading

0 comments on commit 38a77da

Please sign in to comment.