Skip to content

Commit

Permalink
1.3.144 - UNHARDCODE PROJECT - FINISHED
Browse files Browse the repository at this point in the history
  • Loading branch information
kotmatross28729 committed Nov 19, 2024
1 parent 86ba429 commit 0cb9853
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 41 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
+ "Coal dust" / "Asbestos" items decrease air quality
+ "Digamma Radiation" items decrease sanity
+ Added plastic bottles, have 2 times more capacity than regular glass ones
+ bottles work with the hbm's liquid system, so you can draw it from the barrels

- Fixed several minor (and not so) bugs

Expand All @@ -33,6 +34,9 @@
+ Added texture for the extinguished torch
+ also fixed a bug due to which vanilla torches were consumed even in creative

+ Added the ability to change a huge number of hardcoded values
+ config now has 150+ options

---
# 1.3.143
* Added support for Serene Seasons
Expand Down
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@

- **13)** **Added compat with Serene Seasons**

- **14)** **Added the ability to change a huge number of hardcoded values**


## Current TODO:
- **1)** **Ability to change parameters for mobs from other mods.**
Expand All @@ -48,11 +50,6 @@
- **2)** **Сode refactoring.**
+ The name speaks for itself

- **3)** **UNHARDCODE ALL HARDCODED VALUES.**
+ There are a lot of values in enviromine that could be changed in some situations. This is the last thing I plan to do



# Credits:

[Funwayguy,](https://github.com/Funwayguy)
Expand Down
47 changes: 27 additions & 20 deletions src/main/java/enviromine/handlers/EM_StatusManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -728,11 +728,13 @@ else if(tileentity instanceof TileEntityMachineTurbineGas turbineGas) {
if(dimensionProp == null || !dimensionProp.override || dimensionProp.weatherAffectsTemp) {
float biomeTemperatureRain = 6F;
float biomeTemperatureThunder = 8F;
//float biomeTemperatureShade = 2.5F; //the FUCK is that

boolean biomeTemperatureRainBool = false;
boolean biomeTemperatureThunderBool = false;

float dropSpeedRain = 0.01F;
float dropSpeedThunder = 0.01F;

if (biome != null) {
BiomeProperties biomeOverride = null;
if (BiomeProperties.base.hasProperty(biome)) {
Expand All @@ -743,7 +745,9 @@ else if(tileentity instanceof TileEntityMachineTurbineGas turbineGas) {
biomeTemperatureThunder = biomeOverride.TemperatureThunderDecrease;
biomeTemperatureRainBool = biomeOverride.TemperatureRainBool;
biomeTemperatureThunderBool = biomeOverride.TemperatureThunderBool;
//biomeTemperatureShade = biomeOverride.TemperatureShadeDecrease; //Uh what

dropSpeedRain = biomeOverride.dropSpeedRain;
dropSpeedThunder = biomeOverride.dropSpeedThunder;
}
}

Expand All @@ -752,31 +756,32 @@ else if(tileentity instanceof TileEntityMachineTurbineGas turbineGas) {
animalHostility = -1;

if (entityLiving.worldObj.canBlockSeeTheSky(i, j, k)) {
dropSpeed = 0.01F; //TODO HARDCODED, biome props
dropSpeed = dropSpeedRain;

}
} else if (entityLiving.worldObj.isThundering() && biome.rainfall != 0.0F && biomeTemperatureThunderBool) {
biomeTemperature -= biomeTemperatureThunder;
animalHostility = -1;

if (entityLiving.worldObj.canBlockSeeTheSky(i, j, k)) {
dropSpeed = 0.01F; //TODO HARDCODED, biome props
dropSpeed = dropSpeedThunder;
}
}

} // Dimension Overrides End

float biomeTemperatureShade = 2.5F; //who the fuck writing that code? (-grammar)
float biomeTemperatureShade = 2.5F;
if (biome != null) {
BiomeProperties biomeOverride = null;
if (BiomeProperties.base.hasProperty(biome)) {
biomeOverride = BiomeProperties.base.getProperty(biome);
} if (biomeOverride != null && biomeOverride.biomeOveride) {
biomeTemperatureShade = biomeOverride.TemperatureShadeDecrease; //A, it was me
biomeTemperatureShade = biomeOverride.TemperatureShadeDecrease;
}
}
// Shade
if (!entityLiving.worldObj.canBlockSeeTheSky(i, j, k) && isDay && !entityLiving.worldObj.isRaining()) {
biomeTemperature -= biomeTemperatureShade; //WHA-
biomeTemperature -= biomeTemperatureShade;
}

if ((!entityLiving.worldObj.provider.hasNoSky && dimensionProp == null) || (dimensionProp != null && dimensionProp.override && dimensionProp.dayNightTemp)) {
Expand Down Expand Up @@ -1233,16 +1238,21 @@ else if(tileentity instanceof TileEntityMachineTurbineGas turbineGas) {
fireProt = 1F - fireProt / 18F;
}

//TODO HARDCODED, biome props
if (entityLiving.isInWater()) {
if (biomeTemperature > 25F) {
if (biomeTemperature > 50F) {
biomeTemperature -= 50F;
} else {
biomeTemperature = 25F;
float TemperatureWaterDecrease = 10.0F;
float dropSpeedWater = 0.01F;

BiomeProperties biomeProps;
if (BiomeProperties.base.hasProperty(biome)) {
biomeProps = BiomeProperties.base.getProperty(biome);
if (biomeProps != null && biomeProps.biomeOveride) {
TemperatureWaterDecrease = biomeProps.TemperatureWaterDecrease;
dropSpeedWater = biomeProps.dropSpeedWater;
}
}
dropSpeed = 0.01F;
}

if (entityLiving.isInWater()) {
biomeTemperature -= TemperatureWaterDecrease;
dropSpeed = dropSpeedWater;
}

float ambientTemperature = 0F;
Expand Down Expand Up @@ -1270,7 +1280,7 @@ else if(tileentity instanceof TileEntityMachineTurbineGas turbineGas) {
}
}

BiomeProperties biomeProp = null;
BiomeProperties biomeProp;
if (BiomeProperties.base.hasProperty(biome)) {
biomeProp = BiomeProperties.base.getProperty(biome);

Expand Down Expand Up @@ -1303,9 +1313,6 @@ else if(tileentity instanceof TileEntityMachineTurbineGas turbineGas) {
dropSpeed -= temperatureRate; //INVERTED LOGIC, AND MULTIPLIED BY 10, FU-
}
}



sanityRate += biomeProp.sanityRate;
}

Expand Down
5 changes: 5 additions & 0 deletions src/main/java/enviromine/handlers/ObjectHandlerCompat.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package enviromine.handlers;

import com.hbm.inventory.FluidContainer;
import com.hbm.inventory.FluidContainerRegistry;
import com.hbm.inventory.OreDictManager;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.main.CraftingManager;
import cpw.mods.fml.common.registry.GameRegistry;
import enviromine.core.EnviroMine;
Expand Down Expand Up @@ -118,6 +121,8 @@ public static void registerRecipes() {


CraftingManager.addRecipeAuto(new ItemStack(waterBottle_polymer), "p p", " p ", 'p', OreDictManager.ANY_PLASTIC.ingot());

FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(cleanWaterBottle_polymer), new ItemStack(waterBottle_polymer), Fluids.WATER, 500));
}

}
88 changes: 72 additions & 16 deletions src/main/java/enviromine/trackers/properties/BiomeProperties.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package enviromine.trackers.properties;

import java.io.File;
import java.util.ArrayList;
import java.util.Collections;

import com.hbm.dim.Ike.BiomeGenIke;
import com.hbm.dim.dres.biome.BiomeGenBaseDres;
import com.hbm.dim.duna.biome.BiomeGenBaseDuna;
Expand All @@ -15,8 +11,6 @@
import com.hbm.dim.moho.biome.BiomeGenBaseMoho;
import com.hbm.dim.moon.BiomeGenMoon;
import com.hbm.dim.orbit.BiomeGenOrbit;
import org.apache.logging.log4j.Level;

import enviromine.core.EM_ConfigHandler;
import enviromine.core.EM_ConfigHandler.EnumLogVerbosity;
import enviromine.core.EM_Settings;
Expand All @@ -30,8 +24,11 @@
import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.common.BiomeDictionary.Type;
import net.minecraftforge.common.config.Configuration;
import org.apache.logging.log4j.Level;

import static net.minecraftforge.common.BiomeDictionary.Type.DRY;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;

public class BiomeProperties implements SerialisableProperty, PropertyBase
{
Expand Down Expand Up @@ -83,9 +80,14 @@ public class BiomeProperties implements SerialisableProperty, PropertyBase
public float tempRate_DAY;
public float tempRate_DUSK;
public float tempRate_NIGHT;

public boolean tempRate_HARD;

public float TemperatureWaterDecrease;
public float dropSpeedWater;

public float dropSpeedRain;
public float dropSpeedThunder;

public BiomeProperties(NBTTagCompound tags)
{
this.ReadFromNBT(tags);
Expand Down Expand Up @@ -146,7 +148,11 @@ public BiomeProperties (
float tempRate_DAY,
float tempRate_DUSK,
float tempRate_NIGHT,
boolean tempRate_HARD
boolean tempRate_HARD,
float TemperatureWaterDecrease,
float dropSpeedWater,
float dropSpeedRain,
float dropSpeedThunder
) {
this.id = id;
this.biomeOveride = biomeOveride;
Expand Down Expand Up @@ -196,6 +202,12 @@ public BiomeProperties (
this.tempRate_NIGHT = tempRate_NIGHT;

this.tempRate_HARD = tempRate_HARD;

this.TemperatureWaterDecrease = TemperatureWaterDecrease;
this.dropSpeedWater = dropSpeedWater;

this.dropSpeedRain = dropSpeedRain;
this.dropSpeedThunder = dropSpeedThunder;
}
/**
* <b>hasProperty(BiomeGenBase biome)</b><bR><br>
Expand Down Expand Up @@ -295,6 +307,12 @@ public NBTTagCompound WriteToNBT()

tags.setBoolean("tempRate_HARD", this.tempRate_HARD);

tags.setFloat("TemperatureWaterDecrease", this.TemperatureWaterDecrease);
tags.setFloat("dropSpeedWater", this.dropSpeedWater);

tags.setFloat("dropSpeedRain", this.dropSpeedRain);
tags.setFloat("dropSpeedThunder", this.dropSpeedThunder);

return tags;
}

Expand Down Expand Up @@ -348,6 +366,12 @@ public void ReadFromNBT(NBTTagCompound tags)
this.tempRate_NIGHT = tags.getFloat("tempRate_NIGHT");

this.tempRate_HARD = tags.getBoolean("tempRate_HARD");

this.TemperatureWaterDecrease = tags.getFloat("TemperatureWaterDecrease");
this.dropSpeedWater = tags.getFloat("dropSpeedWater");

this.dropSpeedRain = tags.getFloat("dropSpeedRain");
this.dropSpeedThunder = tags.getFloat("dropSpeedThunder");
}

@Override
Expand Down Expand Up @@ -416,6 +440,12 @@ public void LoadProperty(Configuration config, String category)

boolean tempRate_HARD = config.get(category, BOName[40], false).getBoolean(false);

float TemperatureWaterDecrease = (float)config.get(category, BOName[41], 10.0).getDouble(10.0);
float dropSpeedWater = (float)config.get(category, BOName[42], 0.01).getDouble(0.01);

float dropSpeedRain = (float)config.get(category, BOName[43], 0.01).getDouble(0.01);
float dropSpeedThunder = (float)config.get(category, BOName[44], 0.01).getDouble(0.01);

BiomeProperties entry = new BiomeProperties (
id,
biomeOveride,
Expand Down Expand Up @@ -458,7 +488,11 @@ public void LoadProperty(Configuration config, String category)
tempRate_DAY,
tempRate_DUSK,
tempRate_NIGHT,
tempRate_HARD
tempRate_HARD,
TemperatureWaterDecrease,
dropSpeedWater,
dropSpeedRain,
dropSpeedThunder
);

if(EM_Settings.biomeProperties.containsKey(id) && !EM_ConfigHandler.loadedConfigs.contains(filename))
Expand Down Expand Up @@ -512,12 +546,18 @@ public void SaveProperty(Configuration config, String category)
config.get(category, BOName[34], this.LATE_WINTER_TEMPERATURE_DECREASE, "Biome temperature will decrease by this amount at late winter").getDouble(this.LATE_WINTER_TEMPERATURE_DECREASE);
config.get(category, BOName[35], this.LATE_AUTUMN_TEMPERATURE_DECREASE, "Biome temperature will decrease by this amount at late autumn").getDouble(this.LATE_AUTUMN_TEMPERATURE_DECREASE);

config.get(category, BOName[36], this.tempRate_DAWN).getDouble(this.tempRate_DAWN);
config.get(category, BOName[37], this.tempRate_DAY).getDouble(this.tempRate_DAY);
config.get(category, BOName[38], this.tempRate_DUSK).getDouble(this.tempRate_DUSK);
config.get(category, BOName[39], this.tempRate_NIGHT).getDouble(this.tempRate_NIGHT);
config.get(category, BOName[36], this.tempRate_DAWN, "Biome temperature rate will be this number at dawn").getDouble(this.tempRate_DAWN);
config.get(category, BOName[37], this.tempRate_DAY, "Biome temperature rate will be this number at day").getDouble(this.tempRate_DAY);
config.get(category, BOName[38], this.tempRate_DUSK, "Biome temperature rate will be this number at dusk").getDouble(this.tempRate_DUSK);
config.get(category, BOName[39], this.tempRate_NIGHT, "Biome temperature rate will be this number at midnight").getDouble(this.tempRate_NIGHT);

config.get(category, BOName[40], this.tempRate_HARD).getBoolean(this.tempRate_HARD);
config.get(category, BOName[40], this.tempRate_HARD, "The temperature of the biome is so strong that weak suits like MITTY/HEV cannot protect against it").getBoolean(this.tempRate_HARD);

config.get(category, BOName[41], this.TemperatureWaterDecrease,"Biome temperature decreases by this amount if the player is in water").getDouble(this.TemperatureWaterDecrease);
config.get(category, BOName[42], this.dropSpeedWater,"Biome drop speed will be this number if the player is in water").getDouble(this.dropSpeedWater);

config.get(category, BOName[43], this.dropSpeedRain,"Biome drop speed will be this number if it rains").getDouble(this.dropSpeedRain);
config.get(category, BOName[44], this.dropSpeedThunder,"Biome drop speed will be this number if there is a thunderstorm").getDouble(this.dropSpeedThunder);
}

@Override
Expand Down Expand Up @@ -611,6 +651,12 @@ public void generateEmpty(Configuration config, Object obj)

boolean tempRate_HARD = false;

float TemperatureWaterDecrease = 10.0F;
float dropSpeedWater = 0.01F;

float dropSpeedRain = 0.01F;
float dropSpeedThunder = 0.01F;

double EARLY_SPRING_TEMPERATURE_DECREASE =
(typeList.contains(Type.HOT) && typeList.contains(Type.SANDY)) ? -3.0 : //DESERT (-8 (DEFAULT+8))
typeList.contains(Type.JUNGLE) ? 0.0 : //JUNGLE (-5 (DEFAULT+5))
Expand Down Expand Up @@ -985,6 +1031,12 @@ else if(biome instanceof BiomeGenBaseDuna) {
config.get(catName, BOName[39], tempRate_NIGHT).getDouble(tempRate_NIGHT);

config.get(catName, BOName[40], tempRate_HARD).getBoolean(tempRate_HARD);

config.get(catName, BOName[41], TemperatureWaterDecrease).getDouble(TemperatureWaterDecrease);
config.get(catName, BOName[42], dropSpeedWater).getDouble(dropSpeedWater);

config.get(catName, BOName[43], dropSpeedRain).getDouble(dropSpeedRain);
config.get(catName, BOName[44], dropSpeedThunder).getDouble(dropSpeedThunder);
}

@Override
Expand All @@ -1000,7 +1052,7 @@ public void customLoad()

static
{
BOName = new String[41];
BOName = new String[45];
BOName[0] = "01.Biome ID";
BOName[1] = "02.Allow Config Override";
BOName[2] = "03.Water Quality";
Expand Down Expand Up @@ -1042,5 +1094,9 @@ public void customLoad()
BOName[38] = "39.Dusk Biome Temperature Rate";
BOName[39] = "40.Night Biome Temperature Rate";
BOName[40] = "41.[HBM] Hard Biome Temperature Rate";
BOName[41] = "42.Ambient Temperature Decrease Water";
BOName[42] = "43.Drop Speed Water";
BOName[43] = "44.Drop Speed Rain";
BOName[44] = "45.Drop Speed Thunder";
}
}

0 comments on commit 0cb9853

Please sign in to comment.