Fix? temperature for Ad Astra

This commit is contained in:
BitHeaven 2024-03-12 10:43:02 +05:00
parent fb97097b67
commit 9d811a82af
1 changed files with 12 additions and 13 deletions

View File

@ -1,32 +1,31 @@
package ru.bitheaven.createairfabric.mixin; package ru.bitheaven.createairfabric.mixin;
import earth.terrarium.ad_astra.common.config.AdAstraConfig; import earth.terrarium.adastra.common.items.armor.NetheriteSpaceSuitItem;
import earth.terrarium.ad_astra.common.entity.system.EntityTemperatureSystem; import earth.terrarium.adastra.common.tags.ModItemTags;
import earth.terrarium.ad_astra.common.item.armor.NetheriteSpaceSuit; import earth.terrarium.adastra.common.systems.TemperatureApiImpl;
import earth.terrarium.ad_astra.common.registry.ModTags;
import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(EntityTemperatureSystem.class) @Mixin(TemperatureApiImpl.class)
public abstract class EntityTemperatureSystemMixin { public abstract class EntityTemperatureSystemMixin {
@Redirect(at = @At(value = "INVOKE", target = "Learth/terrarium/ad_astra/common/entity/system/EntityTemperatureSystem;burnEntity(Lnet/minecraft/world/entity/LivingEntity;)V"), @Redirect(at = @At(value = "INVOKE", target = "Learth/terrarium/adastra/common/systems/TemperatureApiImpl;burnEntity(Lnet/minecraft/world/entity/LivingEntity;)V"),
method = "temperatureTick(Lnet/minecraft/world/entity/LivingEntity;Lnet/minecraft/server/level/ServerLevel;)V") method = "entityTick(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/entity/LivingEntity;)V")
private static void redirectTemperatureTick(LivingEntity entity) { private void redirectTemperatureTick(TemperatureApiImpl instance, LivingEntity entity) {
boolean createNetherite = true; boolean createNetherite = true;
createNetherite &= entity.getItemBySlot(EquipmentSlot.HEAD).getItem().isFireResistant(); createNetherite &= entity.getItemBySlot(EquipmentSlot.HEAD).getItem().isFireResistant();
createNetherite &= entity.getItemBySlot(EquipmentSlot.CHEST).getItem().isFireResistant(); createNetherite &= entity.getItemBySlot(EquipmentSlot.CHEST).getItem().isFireResistant();
createNetherite &= entity.getItemBySlot(EquipmentSlot.LEGS).is(ModTags.HEAT_RESISTANT) createNetherite &= entity.getItemBySlot(EquipmentSlot.LEGS).is(ModItemTags.HEAT_RESISTANT_ARMOR)
|| entity.getItemBySlot(EquipmentSlot.LEGS).getItem() instanceof NetheriteSpaceSuit || entity.getItemBySlot(EquipmentSlot.LEGS).getItem() instanceof NetheriteSpaceSuitItem
|| entity.getItemBySlot(EquipmentSlot.LEGS).getItem().isFireResistant(); || entity.getItemBySlot(EquipmentSlot.LEGS).getItem().isFireResistant();
createNetherite &= entity.getItemBySlot(EquipmentSlot.FEET).is(ModTags.HEAT_RESISTANT) createNetherite &= entity.getItemBySlot(EquipmentSlot.FEET).is(ModItemTags.HEAT_RESISTANT_ARMOR)
|| entity.getItemBySlot(EquipmentSlot.FEET).getItem() instanceof NetheriteSpaceSuit || entity.getItemBySlot(EquipmentSlot.FEET).getItem() instanceof NetheriteSpaceSuitItem
|| entity.getItemBySlot(EquipmentSlot.FEET).getItem().isFireResistant(); || entity.getItemBySlot(EquipmentSlot.FEET).getItem().isFireResistant();
if(!createNetherite) { if(!createNetherite) {
entity.hurt(entity.damageSources().onFire(), (float) AdAstraConfig.heatDamage); entity.hurt(entity.damageSources().onFire(), 6);
entity.setSecondsOnFire(10); entity.setSecondsOnFire(10);
} }
} }