More fixxxes
This commit is contained in:
parent
3683405780
commit
8f01df0971
|
@ -1,11 +1,14 @@
|
|||
package ru.bitheaven.createairfabric.mixin;
|
||||
|
||||
import com.simibubi.create.content.equipment.armor.BacktankItem;
|
||||
import com.simibubi.create.content.equipment.armor.BacktankUtil;
|
||||
import com.simibubi.create.content.equipment.armor.DivingHelmetItem;
|
||||
|
||||
import earth.terrarium.adastra.common.items.armor.SpaceSuitItem;
|
||||
import earth.terrarium.adastra.common.systems.OxygenApiImpl;
|
||||
import earth.terrarium.adastra.common.tags.ModItemTags;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
@ -18,11 +21,23 @@ public abstract class EntityOxygenSystemMixin {
|
|||
*/
|
||||
@Redirect(at = @At(value = "INVOKE", target = "Learth/terrarium/adastra/common/items/armor/SpaceSuitItem;hasOxygen(Lnet/minecraft/world/entity/Entity;)Z"),
|
||||
method = "entityTick(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/entity/LivingEntity;)V")
|
||||
private boolean redirectOxygenTick(Entity entity) {
|
||||
private boolean redirectHasOxygen(Entity entity) {
|
||||
if (!(entity instanceof LivingEntity livingEntity)) return SpaceSuitItem.hasOxygen(entity);
|
||||
boolean createOxygen = true;
|
||||
createOxygen &= !DivingHelmetItem.getWornItem(livingEntity).isEmpty();
|
||||
createOxygen &= !BacktankUtil.getAllWithAir(livingEntity).isEmpty();
|
||||
return SpaceSuitItem.hasOxygen(livingEntity) || createOxygen;
|
||||
}
|
||||
@Redirect(at = @At(value = "INVOKE", target = "Learth/terrarium/adastra/common/items/armor/SpaceSuitItem;hasFullSet(Lnet/minecraft/world/entity/LivingEntity;)Z"),
|
||||
method = "entityTick(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/entity/LivingEntity;)V")
|
||||
private boolean redirectHasFullSet(LivingEntity entity) {
|
||||
boolean createArmor = true;
|
||||
createArmor &= entity.getItemBySlot(EquipmentSlot.HEAD).getItem() instanceof DivingHelmetItem;
|
||||
createArmor &= entity.getItemBySlot(EquipmentSlot.CHEST).getItem() instanceof BacktankItem;
|
||||
createArmor &= entity.getItemBySlot(EquipmentSlot.LEGS).is(ModItemTags.SPACE_SUITS);
|
||||
createArmor &= entity.getItemBySlot(EquipmentSlot.FEET).is(ModItemTags.SPACE_SUITS);
|
||||
|
||||
return SpaceSuitItem.hasFullSet(entity) || createArmor;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue