Skip to content

Commit

Permalink
We work to earn the right to work
Browse files Browse the repository at this point in the history
  • Loading branch information
kotmatross28729 committed Dec 27, 2024
1 parent 0b58bd9 commit a5c48d1
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 14 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
### Fixed
* Crash with new version of Hbm's NTM
* Bug with playing gas mask breathing sound for some players (Requires Hbm's NTM loaded)

* Even more bugs with temperature-armor calculations

### Added
* When mining enviromine coal, Hbm's NTM coal dust will be released.
* More parameters related to temperature-armor calculations
* Added tooltips to armor according to its temperature protection
* `Is Temperature Resistance` = `"This armor is resistant to average temperatures"` = protects against fire / normal NTM Space planets | doesn't protect against lava / extremely hot/cold NTM Space planets
* `Is Temperature Sealed` = `"This armor is resistant to extreme temperatures"` = protects against any temperatures



Expand Down
31 changes: 20 additions & 11 deletions src/main/java/enviromine/handlers/EM_EventManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import enviromine.trackers.properties.EntityProperties;
import enviromine.trackers.properties.ItemProperties;
import enviromine.trackers.properties.RotProperties;
import enviromine.utils.ArmorTempUtils;
import enviromine.utils.EnviroUtils;
import enviromine.world.Earthquake;
import enviromine.world.features.mineshaft.MineshaftBuilder;
Expand All @@ -42,6 +43,7 @@
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.audio.SoundCategory;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving;
Expand Down Expand Up @@ -1947,9 +1949,17 @@ public void RenderTickEvent(TickEvent.RenderTickEvent event)
@SideOnly(Side.CLIENT)
public void onItemTooltip(ItemTooltipEvent event)
{
if(event.itemStack != null && event.itemStack.hasTagCompound())
{
if (event.itemStack.getTagCompound().hasKey(EM_Settings.CAMEL_PACK_FILL_TAG_KEY)) {
if (event.itemStack != null) {

if(ArmorTempUtils.checkArmorPropertyItemStack(event.itemStack, false)){
event.toolTip.add(EnumChatFormatting.GOLD + "[" + I18n.format("enviromine.tooltip.armor.sealed") + "]");
} else if(ArmorTempUtils.checkArmorPropertyItemStack(event.itemStack, true)) {
event.toolTip.add(EnumChatFormatting.YELLOW + "[" + I18n.format("enviromine.tooltip.armor.resistance") + "]");
}

if(event.itemStack.hasTagCompound())
{
if (event.itemStack.getTagCompound().hasKey(EM_Settings.CAMEL_PACK_FILL_TAG_KEY)) {
int fill = event.itemStack.getTagCompound().getInteger(EM_Settings.CAMEL_PACK_FILL_TAG_KEY);
int max = event.itemStack.getTagCompound().getInteger(EM_Settings.CAMEL_PACK_MAX_TAG_KEY);
if (fill > max) {
Expand Down Expand Up @@ -1978,14 +1988,13 @@ public void onItemTooltip(ItemTooltipEvent event)
event.toolTip.add(new ChatComponentTranslation("misc.enviromine.tooltip.rot", MathHelper.floor_double((curTime - rotDate)/rotTime * 100D) + "%", MathHelper.floor_double((curTime - rotDate)/24000L), MathHelper.floor_double(rotTime/24000L)).getUnformattedText());
//event.toolTip.add("Use-By: Day " + MathHelper.floor_double((rotDate + rotTime)/24000L));
}
}

if(event.itemStack.getTagCompound().hasKey(EM_Settings.GAS_MASK_FILL_TAG_KEY))
{
int i = event.itemStack.getTagCompound().getInteger(EM_Settings.GAS_MASK_FILL_TAG_KEY);
int max = event.itemStack.getTagCompound().getInteger(EM_Settings.GAS_MASK_MAX_TAG_KEY);
int disp = (i <= 0 ? 0 : i > max ? 100 : (int)(i/(max/100F)));
event.toolTip.add(new ChatComponentTranslation("misc.enviromine.tooltip.filter", disp + "%", i, max).getUnformattedText());
}
if(event.itemStack.getTagCompound().hasKey(EM_Settings.GAS_MASK_FILL_TAG_KEY)) {
int i = event.itemStack.getTagCompound().getInteger(EM_Settings.GAS_MASK_FILL_TAG_KEY);
int max = event.itemStack.getTagCompound().getInteger(EM_Settings.GAS_MASK_MAX_TAG_KEY);
int disp = (i <= 0 ? 0 : i > max ? 100 : (int)(i/(max/100F)));
event.toolTip.add(new ChatComponentTranslation("misc.enviromine.tooltip.filter", disp + "%", i, max).getUnformattedText());
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ else if(armor == ModItems.bj_plate || armor == ModItems.bj_plate_jetpack || armo
config.get(catName, APName[8], 0.0D).getDouble(0.0D);

config.get(catName, APName[10], true).getBoolean(true);
config.get(catName, APName[11], true).getBoolean(true);
}
else if(armor == ModItems.envsuit_helmet || armor == ModItems.envsuit_plate || armor == ModItems.envsuit_legs || armor == ModItems.envsuit_boots) {
config.get(catName, APName[0], Item.itemRegistry.getNameForObject(armor)).getString();
Expand Down
21 changes: 19 additions & 2 deletions src/main/java/enviromine/utils/ArmorTempUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,30 @@ private static boolean checkArmorProperty(EntityLivingBase entityLiving, boolean
}
return false;
}


public static boolean checkArmorPropertyItemStack(ItemStack stack, boolean Resistance) {
ArmorProperties props = getArmorProperties(stack);
if (props != null) {
if(Resistance) {
return props.isTemperatureResistance;
} else {
return props.isTemperatureSealed;
}
}
return false;
}

private static ArmorProperties getArmorProperties(EntityLivingBase entityLiving, int slot) {
ItemStack armor = entityLiving.getEquipmentInSlot(slot);
if (armor != null && ArmorProperties.base.hasProperty(armor)) {
return ArmorProperties.base.getProperty(armor);
}
return null;
}

private static ArmorProperties getArmorProperties(ItemStack stack) {
if (stack != null && ArmorProperties.base.hasProperty(stack)) {
return ArmorProperties.base.getProperty(stack);
}
return null;
}
}
3 changes: 3 additions & 0 deletions src/main/resources/assets/enviromine/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ misc.enviromine.tooltip.filter=Filters: %s (%s/%s)
misc.enviromine.tooltip.water=Water: %s (%s/%s)
misc.enviromine.tooltip.rot=Rotten: %s (Day %s/%s)

enviromine.tooltip.armor.resistance=This armor is resistant to average temperatures
enviromine.tooltip.armor.sealed=This armor is resistant to extreme temperatures

commands.enviromine.envirostat.add=add
commands.enviromine.envirostat.set=set
commands.enviromine.envirostat.temp=temp
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/assets/enviromine/lang/ru_RU.lang
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ misc.enviromine.tooltip.filter=Фильтры: %s (%s/%s)
misc.enviromine.tooltip.water=Вода: %s (%s/%s)
misc.enviromine.tooltip.rot=Испорчено: %s (Day %s/%s)

enviromine.tooltip.armor.resistance=Эта броня устойчива к средним температурам
enviromine.tooltip.armor.sealed=Эта броня устойчива к экстремальным температурам

commands.enviromine.envirostat.add=добавить
commands.enviromine.envirostat.set=установить
commands.enviromine.envirostat.temp=температура
Expand Down

0 comments on commit a5c48d1

Please sign in to comment.