Skip to content

Commit

Permalink
(NOT FINISHED) Cyclic temperature rate, Hard temperature rate
Browse files Browse the repository at this point in the history
  • Loading branch information
kotmatross28729 committed Oct 22, 2024
1 parent 40305a9 commit cd7cca7
Show file tree
Hide file tree
Showing 5 changed files with 219 additions and 105 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ plugins {
id 'com.gtnewhorizons.gtnhconvention'
}

version = "1.3.143"
version = "1.3.144"
2 changes: 1 addition & 1 deletion src/main/java/enviromine/core/EM_Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class EM_Settings
public static File worldDir = null;

//Mod Data
public static final String VERSION = "1.3.143" + " kotmatross edition";
public static final String VERSION = "1.3.144" + " kotmatross edition";
public static final String MOD_ID = "enviromine";
public static final String MOD_NAME = "EnviroMine";
public static final String MOD_NAME_COLORIZED = EnumChatFormatting.AQUA + MOD_NAME + EnumChatFormatting.RESET;
Expand Down
127 changes: 62 additions & 65 deletions src/main/java/enviromine/handlers/EM_StatusManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public class EM_StatusManager
public static final int ANIMAL_HOSTILITY_INDEX = 6;
public static final int SANITY_DELTA_INDEX = 7;

public static boolean temperatureRateHARD = false;

public static HashMap<String,EnviroDataTracker> trackerList = new HashMap<String,EnviroDataTracker>();

Expand Down Expand Up @@ -1013,6 +1014,26 @@ public static float[] getSurroundingData(EntityLivingBase entityLiving, int cube
dropSpeed += biomeProp.tempRate;
}

float temperatureRate = 0;
temperatureRateHARD = biomeProp.tempRate_HARD;

if(biomeProp.tempRate_DAWN != 0 || biomeProp.tempRate_DAY != 0 || biomeProp.tempRate_DUSK != 0 || biomeProp.tempRate_NIGHT != 0) {
float currentTime = entityLiving.worldObj.getWorldTime();
if(EnviroMine.isHbmSpaceLoaded()) {
CelestialBody body = CelestialBody.getBody(entityLiving.worldObj);
float phasePeriod = Math.round((float) (body.getRotationalPeriod() / (1 - (1 / body.getPlanet().getOrbitalPeriod()))) / 4F);
temperatureRate = calculateTemperatureChangeSpace(currentTime, phasePeriod, biomeProp.tempRate_DAWN, biomeProp.tempRate_DAY, biomeProp.tempRate_DUSK, biomeProp.tempRate_NIGHT);
}
else {
temperatureRate = calculateTemperatureChange(currentTime % 24000L, biomeProp.tempRate_DAWN, biomeProp.tempRate_DAY, biomeProp.tempRate_DUSK, biomeProp.tempRate_NIGHT);
}
}
if (temperatureRate > 0) {
riseSpeed += temperatureRate;
} else {
dropSpeed += temperatureRate;
}

sanityRate += biomeProp.sanityRate;
}

Expand Down Expand Up @@ -1056,85 +1077,62 @@ public static float[] getSurroundingData(EntityLivingBase entityLiving, int cube
ArmorFSB chestplate = (ArmorFSB) plate.getItem();
if (!entityLiving.isPotionActive(Potion.fireResistance) && !(chestplate.fireproof)) {
if (entityLiving.worldObj.getBlock(i, j, k).getMaterial() == Material.lava && !(chestplate == ModItems.hev_plate || chestplate == ModItems.envsuit_plate) && !ImmunityFull) {
ambientTemperature = EM_Settings.LavaBlockAmbientTemperature;
riseSpeed = EM_Settings.RiseSpeedLava;
ambientTemperature += EM_Settings.LavaBlockAmbientTemperature;
riseSpeed += EM_Settings.RiseSpeedLava;
} else if (entityLiving.worldObj.getBlock(i, j, k).getMaterial() == Material.lava && (chestplate == ModItems.hev_plate || chestplate == ModItems.envsuit_plate) && !ImmunityFull) {
ambientTemperature = EM_Settings.BurningambientTemperature;
riseSpeed = EM_Settings.RiseSpeedLavaDecr;
ambientTemperature += EM_Settings.BurningambientTemperature;
riseSpeed += EM_Settings.RiseSpeedLavaDecr;
}
else if (entityLiving.isBurning() && !(chestplate == ModItems.hev_plate || chestplate == ModItems.envsuit_plate) && !ImmunityBurning) {
if (ambientTemperature <= EM_Settings.BurningambientTemperature) {
ambientTemperature = EM_Settings.BurningambientTemperature;
ambientTemperature += EM_Settings.BurningambientTemperature;
}
if (riseSpeed < EM_Settings.RiseSpeedMin) {
riseSpeed = EM_Settings.RiseSpeedMin;
}
}
}
}
//TODO SKIP, JUST HIGHLIGHT
// HBM COMPAT No FSBarmor
else if (!entityLiving.isPotionActive(Potion.fireResistance)) {
if (entityLiving.worldObj.getBlock(i, j, k).getMaterial() == Material.lava && !ImmunityFull) {
if(ImmunityBurning) {
ambientTemperature = EM_Settings.BurningambientTemperature;
riseSpeed = EM_Settings.RiseSpeedLavaDecr;
} else {
ambientTemperature = EM_Settings.LavaBlockAmbientTemperature;
riseSpeed = EM_Settings.RiseSpeedLava;
}
} else if (entityLiving.isBurning() && !ImmunityBurning) {
if (ambientTemperature <= EM_Settings.BurningambientTemperature) {
ambientTemperature = EM_Settings.BurningambientTemperature;
}

if (riseSpeed < EM_Settings.RiseSpeedMin) {
riseSpeed = EM_Settings.RiseSpeedMin;
}
}
}
}
//TODO SKIP, JUST HIGHLIGHT
// NOT HBM
else if (!entityLiving.isPotionActive(Potion.fireResistance)) {
ItemStack helmet = entityLiving.getEquipmentInSlot(4);
ItemStack plate = entityLiving.getEquipmentInSlot(3);
ItemStack legs = entityLiving.getEquipmentInSlot(2);
ItemStack boots = entityLiving.getEquipmentInSlot(1);
ArmorProperties helmetprops = null;
ArmorProperties plateprops = null;
ArmorProperties legsprops = null;
ArmorProperties bootsprops = null;
boolean ImmunityBurning = false;
boolean ImmunityFull = false;
if(helmet != null) {if (ArmorProperties.base.hasProperty(helmet)) {helmetprops = ArmorProperties.base.getProperty(helmet);}}
if(plate != null) {if (ArmorProperties.base.hasProperty(plate)) {plateprops = ArmorProperties.base.getProperty(plate);}}
if(legs != null) {if (ArmorProperties.base.hasProperty(legs)) {legsprops = ArmorProperties.base.getProperty(legs);}}
if(boots != null) {if (ArmorProperties.base.hasProperty(boots)) {bootsprops = ArmorProperties.base.getProperty(boots);}}
if(helmetprops != null && plateprops != null && legsprops != null && bootsprops != null) {
if(helmetprops.isTemperatureResistance && plateprops.isTemperatureResistance && legsprops.isTemperatureResistance && bootsprops.isTemperatureResistance) {
ImmunityBurning = true;
ImmunityFull = helmetprops.isTemperatureSealed && plateprops.isTemperatureSealed && legsprops.isTemperatureSealed && bootsprops.isTemperatureSealed;
} else {
ImmunityBurning = false;
}
}
if (entityLiving.worldObj.getBlock(i, j, k).getMaterial() == Material.lava && !ImmunityFull) {
if(ImmunityBurning) {
ambientTemperature = EM_Settings.BurningambientTemperature;
riseSpeed = EM_Settings.RiseSpeedLavaDecr;
if (!entityLiving.isPotionActive(Potion.fireResistance)) {
ItemStack helmet = entityLiving.getEquipmentInSlot(4);
ItemStack plate = entityLiving.getEquipmentInSlot(3);
ItemStack legs = entityLiving.getEquipmentInSlot(2);
ItemStack boots = entityLiving.getEquipmentInSlot(1);
ArmorProperties helmetprops = null;
ArmorProperties plateprops = null;
ArmorProperties legsprops = null;
ArmorProperties bootsprops = null;
boolean ImmunityBurning = false;
boolean ImmunityFull = false;
if(helmet != null) {if (ArmorProperties.base.hasProperty(helmet)) {helmetprops = ArmorProperties.base.getProperty(helmet);}}
if(plate != null) {if (ArmorProperties.base.hasProperty(plate)) {plateprops = ArmorProperties.base.getProperty(plate);}}
if(legs != null) {if (ArmorProperties.base.hasProperty(legs)) {legsprops = ArmorProperties.base.getProperty(legs);}}
if(boots != null) {if (ArmorProperties.base.hasProperty(boots)) {bootsprops = ArmorProperties.base.getProperty(boots);}}
if(helmetprops != null && plateprops != null && legsprops != null && bootsprops != null) {
if(helmetprops.isTemperatureResistance && plateprops.isTemperatureResistance && legsprops.isTemperatureResistance && bootsprops.isTemperatureResistance) {
ImmunityBurning = true;
ImmunityFull = helmetprops.isTemperatureSealed && plateprops.isTemperatureSealed && legsprops.isTemperatureSealed && bootsprops.isTemperatureSealed;
} else {
ambientTemperature = EM_Settings.LavaBlockAmbientTemperature;
riseSpeed = EM_Settings.RiseSpeedLava;
}
} else if (entityLiving.isBurning() && !ImmunityBurning) {
if (ambientTemperature <= EM_Settings.BurningambientTemperature) {
ambientTemperature = EM_Settings.BurningambientTemperature;
}
if (riseSpeed < EM_Settings.RiseSpeedMin) {
riseSpeed = EM_Settings.RiseSpeedMin;
ImmunityBurning = false;
}
}
if (entityLiving.worldObj.getBlock(i, j, k).getMaterial() == Material.lava && !ImmunityFull) {
if(ImmunityBurning) {
ambientTemperature += EM_Settings.BurningambientTemperature;
riseSpeed = EM_Settings.RiseSpeedLavaDecr;
} else {
ambientTemperature += EM_Settings.LavaBlockAmbientTemperature;
riseSpeed = EM_Settings.RiseSpeedLava;
}
} else if (entityLiving.isBurning() && !ImmunityBurning) {
if (ambientTemperature <= EM_Settings.BurningambientTemperature) {
ambientTemperature += EM_Settings.BurningambientTemperature;
}
if (riseSpeed < EM_Settings.RiseSpeedMin) {
riseSpeed = EM_Settings.RiseSpeedMin;
}
}
}

quality += (leaves * 0.1F);
Expand Down Expand Up @@ -1239,7 +1237,6 @@ else if (currentTime >= phasePeriod*3 && currentTime < phasePeriod*4) {
return temperatureChange;
}


public static void removeTracker(EnviroDataTracker tracker)
{
if(trackerList.containsValue(tracker))
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/enviromine/trackers/EnviroDataTracker.java
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,9 @@ else if (ArmorRegistry.hasProtection(trackedEntity, 3, ArmorRegistry.HazardClass
isSealed = false;
}
}
if (isSealed && bodyTemp > 36.6F && bodyTemp < EM_Settings.LightArmorMaxTemp) {
if (isSealed && bodyTemp > 36.6F && bodyTemp < EM_Settings.LightArmorMaxTemp && !EM_StatusManager.temperatureRateHARD) {
bodyTemp = 36.6F;
} else if (isSealed && bodyTemp < 36.6F && bodyTemp > EM_Settings.LightArmorMinTemp) {
} else if (isSealed && bodyTemp < 36.6F && bodyTemp > EM_Settings.LightArmorMinTemp && !EM_StatusManager.temperatureRateHARD) {
bodyTemp = 36.6F;
}
if (HbmLivingProps.getTemperature(trackedEntity) < -700 && HbmLivingProps.getTemperature(trackedEntity) > -1000 && isSealed) {
Expand All @@ -342,11 +342,11 @@ else if (ArmorRegistry.hasProtection(trackedEntity, 3, ArmorRegistry.HazardClass
} else {
if ((chestplate.fireproof) && bodyTemp > 36.6F && bodyTemp < EM_Settings.StrongArmorMaxTemp) {
bodyTemp = 36.6F;
} else if ((chestplate == ModItems.hev_plate || chestplate == ModItems.envsuit_plate) && bodyTemp > 36.6F && bodyTemp < EM_Settings.LightArmorMaxTemp) {
} else if ((chestplate == ModItems.hev_plate || chestplate == ModItems.envsuit_plate) && bodyTemp > 36.6F && bodyTemp < EM_Settings.LightArmorMaxTemp && !EM_StatusManager.temperatureRateHARD) {
bodyTemp = 36.6F;
} else if ((chestplate.fireproof) && bodyTemp < 36.6F && bodyTemp > EM_Settings.StrongArmorMinTemp) {
bodyTemp = 36.6F;
} else if ((chestplate == ModItems.hev_plate || chestplate == ModItems.envsuit_plate) && bodyTemp < 36.6F && bodyTemp > EM_Settings.LightArmorMinTemp) {
} else if ((chestplate == ModItems.hev_plate || chestplate == ModItems.envsuit_plate) && bodyTemp < 36.6F && bodyTemp > EM_Settings.LightArmorMinTemp && !EM_StatusManager.temperatureRateHARD) {
bodyTemp = 36.6F;
}
}
Expand Down Expand Up @@ -429,13 +429,13 @@ else if (HbmLivingProps.isBurning(trackedEntity) && !(trackedEntity.isPotionActi
ImmunityBurning = false; // All armor NOT isTemperatureResistance ? ImmunityBurning = false
}
}
if(ImmunityFull && bodyTemp > 36.6F && bodyTemp < EM_Settings.StrongArmorMaxTemp){
if(ImmunityFull && bodyTemp > 36.6F && bodyTemp < EM_Settings.StrongArmorMaxTemp) {
bodyTemp = 36.6F;
} else if (ImmunityBurning && bodyTemp > 36.6F && bodyTemp < EM_Settings.LightArmorMaxTemp){
} else if (ImmunityBurning && bodyTemp > 36.6F && bodyTemp < EM_Settings.LightArmorMaxTemp && !EM_StatusManager.temperatureRateHARD){
bodyTemp = 36.6F;
} else if (ImmunityFull && bodyTemp < 36.6F && bodyTemp > EM_Settings.StrongArmorMinTemp) {
bodyTemp = 36.6F;
} else if (ImmunityBurning && bodyTemp < 36.6F && bodyTemp > EM_Settings.LightArmorMinTemp) {
} else if (ImmunityBurning && bodyTemp < 36.6F && bodyTemp > EM_Settings.LightArmorMinTemp && !EM_StatusManager.temperatureRateHARD) {
bodyTemp = 36.6F;
}

Expand Down
Loading

0 comments on commit cd7cca7

Please sign in to comment.