Netherite Diving PR Tweaks

This commit is contained in:
simibubi 2023-10-22 12:17:14 +02:00
parent 0d6d4b7ee5
commit 99dff66345
2 changed files with 13 additions and 4 deletions

View file

@ -1,5 +1,7 @@
package com.simibubi.create.content.equipment.armor;
import com.simibubi.create.AllTags.AllItemTags;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity;
@ -26,13 +28,13 @@ public final class NetheriteDivingHandler {
ItemStack to = event.getTo();
if (slot == EquipmentSlot.HEAD) {
if (to.getItem() instanceof DivingHelmetItem && isNetheriteArmor(to)) {
if (isNetheriteDivingHelmet(to)) {
setBit(entity, slot);
} else {
clearBit(entity, slot);
}
} else if (slot == EquipmentSlot.CHEST) {
if (to.getItem() instanceof BacktankItem && isNetheriteArmor(to) && BacktankUtil.hasAirRemaining(to)) {
if (isNetheriteBacktank(to) && BacktankUtil.hasAirRemaining(to)) {
setBit(entity, slot);
} else {
clearBit(entity, slot);
@ -46,6 +48,14 @@ public final class NetheriteDivingHandler {
}
}
public static boolean isNetheriteDivingHelmet(ItemStack stack) {
return stack.getItem() instanceof DivingHelmetItem && isNetheriteArmor(stack);
}
public static boolean isNetheriteBacktank(ItemStack stack) {
return stack.is(AllItemTags.PRESSURIZED_AIR_SOURCES.tag) && isNetheriteArmor(stack);
}
public static boolean isNetheriteArmor(ItemStack stack) {
return stack.getItem() instanceof ArmorItem armorItem && armorItem.getMaterial() == ArmorMaterials.NETHERITE;
}

View file

@ -3,7 +3,6 @@ package com.simibubi.create.foundation.events;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllFluids;
import com.simibubi.create.AllItems;
import com.simibubi.create.AllPackets;
import com.simibubi.create.Create;
import com.simibubi.create.CreateClient;
@ -317,7 +316,7 @@ public class ClientEvents {
event.scaleFarPlaneDistance(6.25f);
event.setCanceled(true);
return;
} else if (FluidHelper.isLava(fluid) && NetheriteDivingHandler.isNetheriteArmor(divingHelmet)) {
} else if (FluidHelper.isLava(fluid) && NetheriteDivingHandler.isNetheriteDivingHelmet(divingHelmet)) {
event.setNearPlaneDistance(-4.0f);
event.setFarPlaneDistance(20.0f);
event.setCanceled(true);