diff --git a/build.gradle b/build.gradle index 78f0888c0..a4cb28b43 100644 --- a/build.gradle +++ b/build.gradle @@ -133,7 +133,7 @@ jar { "Specification-Title": "alexscaves", "Specification-Vendor": "alexthe668", "Specification-Version": "1.0", // We are version 1 of ourselves - "Implementation-Title": project.name, + "Implementation-Title": "AlexsCaves", "Implementation-Version": "${version}", "Implementation-Vendor" :"alexthe668", "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") diff --git a/src/main/java/com/github/alexmodguy/alexscaves/server/block/AcidBlock.java b/src/main/java/com/github/alexmodguy/alexscaves/server/block/AcidBlock.java index 6366afb1c..ac767f1ec 100644 --- a/src/main/java/com/github/alexmodguy/alexscaves/server/block/AcidBlock.java +++ b/src/main/java/com/github/alexmodguy/alexscaves/server/block/AcidBlock.java @@ -59,7 +59,7 @@ public void entityInside(BlockState blockState, Level level, BlockPos pos, Entit for (EquipmentSlot slot : EquipmentSlot.values()) { if (slot.isArmor()) { ItemStack item = living.getItemBySlot(slot); - if (item != null && item.isDamageableItem() && !(item.getItem() instanceof HazmatArmorItem)) { + if (item != null && item.isDamageableItem() && !(item.is(ACTagRegistry.ACID_PROTECTIVE_ARMOR))) { armor = true; if (living.getRandom().nextFloat() < 0.05F && !(entity instanceof Player player && player.isCreative())) { item.hurtAndBreak(1, living, e -> e.broadcastBreakEvent(slot)); @@ -67,7 +67,7 @@ public void entityInside(BlockState blockState, Level level, BlockPos pos, Entit } } } - dmgMultiplier = 1.0F - (HazmatArmorItem.getWornAmount(living) / 4F); + dmgMultiplier = 1.0F - (HazmatArmorItem.getAcidProtection(living) / 4F); } if (armor) { ACAdvancementTriggerRegistry.ENTER_ACID_WITH_ARMOR.triggerForEntity(entity); diff --git a/src/main/java/com/github/alexmodguy/alexscaves/server/item/HazmatArmorItem.java b/src/main/java/com/github/alexmodguy/alexscaves/server/item/HazmatArmorItem.java index 225b83654..50466aede 100644 --- a/src/main/java/com/github/alexmodguy/alexscaves/server/item/HazmatArmorItem.java +++ b/src/main/java/com/github/alexmodguy/alexscaves/server/item/HazmatArmorItem.java @@ -1,6 +1,7 @@ package com.github.alexmodguy.alexscaves.server.item; import com.github.alexmodguy.alexscaves.AlexsCaves; +import com.github.alexmodguy.alexscaves.server.misc.ACTagRegistry; import com.github.alexmodguy.alexscaves.client.particle.ACParticleRegistry; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; @@ -50,18 +51,35 @@ public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot } } - public static int getWornAmount(LivingEntity entity) { + public static int getRadProtection(LivingEntity entity) { int i = 0; - if (entity.getItemBySlot(EquipmentSlot.HEAD).is(ACItemRegistry.HAZMAT_MASK.get())) { + if (entity.getItemBySlot(EquipmentSlot.HEAD).is(ACTagRegistry.RAD_PROTECTIVE_ARMOR)) { i++; } - if (entity.getItemBySlot(EquipmentSlot.CHEST).is(ACItemRegistry.HAZMAT_CHESTPLATE.get())) { + if (entity.getItemBySlot(EquipmentSlot.CHEST).is(ACTagRegistry.RAD_PROTECTIVE_ARMOR)) { i++; } - if (entity.getItemBySlot(EquipmentSlot.LEGS).is(ACItemRegistry.HAZMAT_LEGGINGS.get())) { + if (entity.getItemBySlot(EquipmentSlot.LEGS).is(ACTagRegistry.RAD_PROTECTIVE_ARMOR)) { i++; } - if (entity.getItemBySlot(EquipmentSlot.FEET).is(ACItemRegistry.HAZMAT_BOOTS.get())) { + if (entity.getItemBySlot(EquipmentSlot.FEET).is(ACTagRegistry.RAD_PROTECTIVE_ARMOR)) { + i++; + } + return i; + } + + public static int getAcidProtection(LivingEntity entity) { + int i = 0; + if (entity.getItemBySlot(EquipmentSlot.HEAD).is(ACTagRegistry.ACID_PROTECTIVE_ARMOR)) { + i++; + } + if (entity.getItemBySlot(EquipmentSlot.CHEST).is(ACTagRegistry.ACID_PROTECTIVE_ARMOR)) { + i++; + } + if (entity.getItemBySlot(EquipmentSlot.LEGS).is(ACTagRegistry.ACID_PROTECTIVE_ARMOR)) { + i++; + } + if (entity.getItemBySlot(EquipmentSlot.FEET).is(ACTagRegistry.ACID_PROTECTIVE_ARMOR)) { i++; } return i; diff --git a/src/main/java/com/github/alexmodguy/alexscaves/server/item/RadioactiveBlockItem.java b/src/main/java/com/github/alexmodguy/alexscaves/server/item/RadioactiveBlockItem.java index c1bb41972..9892bdcc2 100644 --- a/src/main/java/com/github/alexmodguy/alexscaves/server/item/RadioactiveBlockItem.java +++ b/src/main/java/com/github/alexmodguy/alexscaves/server/item/RadioactiveBlockItem.java @@ -26,7 +26,7 @@ public void inventoryTick(ItemStack stack, Level level, Entity entity, int i, bo super.inventoryTick(stack, level, entity, i, held); if (!level.isClientSide && entity instanceof LivingEntity living && !(living instanceof Player player && player.isCreative())) { float stackChance = stack.getCount() * randomChanceOfRadiation; - float hazmatMultiplier = 1F - HazmatArmorItem.getWornAmount(living) / 4F; + float hazmatMultiplier = 1F - HazmatArmorItem.getRadProtection(living) / 4F; if (!living.hasEffect(ACEffectRegistry.IRRADIATED.get()) && level.random.nextFloat() < stackChance * hazmatMultiplier) { MobEffectInstance instance = new MobEffectInstance(ACEffectRegistry.IRRADIATED.get(), 1800); living.addEffect(instance); diff --git a/src/main/java/com/github/alexmodguy/alexscaves/server/item/RadioactiveItem.java b/src/main/java/com/github/alexmodguy/alexscaves/server/item/RadioactiveItem.java index 26fdfc56e..ac326c75f 100644 --- a/src/main/java/com/github/alexmodguy/alexscaves/server/item/RadioactiveItem.java +++ b/src/main/java/com/github/alexmodguy/alexscaves/server/item/RadioactiveItem.java @@ -24,7 +24,7 @@ public void inventoryTick(ItemStack stack, Level level, Entity entity, int i, bo super.inventoryTick(stack, level, entity, i, held); if (!level.isClientSide && entity instanceof LivingEntity living && !(living instanceof Player player && player.isCreative())) { float stackChance = stack.getCount() * randomChanceOfRadiation; - float hazmatMultiplier = 1F - HazmatArmorItem.getWornAmount(living) / 4F; + float hazmatMultiplier = 1F - HazmatArmorItem.getRadProtection(living) / 4F; if (!living.hasEffect(ACEffectRegistry.IRRADIATED.get()) && level.random.nextFloat() < stackChance * hazmatMultiplier) { MobEffectInstance instance = new MobEffectInstance(ACEffectRegistry.IRRADIATED.get(), 1800); living.addEffect(instance); diff --git a/src/main/java/com/github/alexmodguy/alexscaves/server/misc/ACTagRegistry.java b/src/main/java/com/github/alexmodguy/alexscaves/server/misc/ACTagRegistry.java index c6d051a9a..b4b898f55 100644 --- a/src/main/java/com/github/alexmodguy/alexscaves/server/misc/ACTagRegistry.java +++ b/src/main/java/com/github/alexmodguy/alexscaves/server/misc/ACTagRegistry.java @@ -93,6 +93,8 @@ public class ACTagRegistry { public static final TagKey GINGERBREAD_MEN_WANDER_THROUGH = registerStructureTag("gingerbread_men_wander_through"); public static final TagKey DEEP_ONE_IGNORES = registerDamageTypeTag("deep_one_ignores"); public static final TagKey DOES_NOT_FLOW_INTO_WATERLOGGABLE_BLOCKS = registerFluidTag("does_not_flow_into_waterloggable_blocks"); + public static final TagKey RAD_PROTECTIVE_ARMOR = registerItemTag("rad_protective_armor"); + public static final TagKey ACID_PROTECTIVE_ARMOR = registerItemTag("acid_protective_armor"); private static TagKey> registerEntityTag(String name) { return TagKey.create(Registries.ENTITY_TYPE, new ResourceLocation(AlexsCaves.MODID, name)); diff --git a/src/main/java/com/github/alexmodguy/alexscaves/server/potion/IrradiatedEffect.java b/src/main/java/com/github/alexmodguy/alexscaves/server/potion/IrradiatedEffect.java index 668185e81..de281952e 100644 --- a/src/main/java/com/github/alexmodguy/alexscaves/server/potion/IrradiatedEffect.java +++ b/src/main/java/com/github/alexmodguy/alexscaves/server/potion/IrradiatedEffect.java @@ -20,7 +20,7 @@ protected IrradiatedEffect() { } public void applyEffectTick(LivingEntity entity, int tick) { - int hazmat = HazmatArmorItem.getWornAmount(entity); + int hazmat = HazmatArmorItem.getRadProtection(entity); float damageScale = 1F - hazmat * 0.25F; if (entity instanceof Player player && hazmat == 0) { player.causeFoodExhaustion(0.4F); diff --git a/src/main/resources/data/alexscaves/tags/items/acid_protective_armor.json b/src/main/resources/data/alexscaves/tags/items/acid_protective_armor.json new file mode 100644 index 000000000..3f342758b --- /dev/null +++ b/src/main/resources/data/alexscaves/tags/items/acid_protective_armor.json @@ -0,0 +1,8 @@ +{ + "values": [ + "alexscaves:hazmat_mask", + "alexscaves:hazmat_chestplate", + "alexscaves:hazmat_leggings", + "alexscaves:hazmat_boots" + ] + } \ No newline at end of file diff --git a/src/main/resources/data/alexscaves/tags/items/rad_protective_armor.json b/src/main/resources/data/alexscaves/tags/items/rad_protective_armor.json new file mode 100644 index 000000000..3f342758b --- /dev/null +++ b/src/main/resources/data/alexscaves/tags/items/rad_protective_armor.json @@ -0,0 +1,8 @@ +{ + "values": [ + "alexscaves:hazmat_mask", + "alexscaves:hazmat_chestplate", + "alexscaves:hazmat_leggings", + "alexscaves:hazmat_boots" + ] + } \ No newline at end of file