diff --git a/PATCHNOTES.md b/PATCHNOTES.md index 71917121..c18cf4f8 100644 --- a/PATCHNOTES.md +++ b/PATCHNOTES.md @@ -56,7 +56,7 @@ To quickly summarize the following materials were updated in different regards: - Increase the durability of Mythril Armor slightly (30 -> 31, on average 14 more durability) - Decrease the durability of Orichalcum Armor (41 -> 39, on average 28 less durability) -- Increased the damage of Quadrillum tools slightly (6.5 -> 6.7) +- Increased the damage dealt by Quadrillum tools slightly (6.5 -> 6.7) - Increased the mining speed of Quadrillum tools (5.0 -> 5.5) - Reduced the attack speed of Quadrillum tools - Reduced the attack speed of the Osmium Axe @@ -64,6 +64,7 @@ To quickly summarize the following materials were updated in different regards: - Made Quadrillum Ore and Blocks much easier to break - Prometheum now becomes overgrown much earlier (2000 -> 1200 durability repaired) - Increased attack speed of Engrained Prometheum (5% -> 8%) +- Prometheum auto repair tick now happens anywhere in your inventory, instead of only while equipped. This should make the effect more noticable - Increased Mythril Drill auto repair when it is activated - Increased Aquarium Pearl drop rate (2% -> 2.5%) - Increased Aquarium Ore spawn range (from 31 to 63 -> from 21 to 69) diff --git a/src/main/java/nourl/mythicmetals/MythicMetals.java b/src/main/java/nourl/mythicmetals/MythicMetals.java index be927e9b..8d015209 100644 --- a/src/main/java/nourl/mythicmetals/MythicMetals.java +++ b/src/main/java/nourl/mythicmetals/MythicMetals.java @@ -9,15 +9,20 @@ import io.wispforest.owo.registration.reflect.FieldRegistrationHandler; import me.shedaniel.mm.api.ClassTinkerers; import net.fabricmc.api.ModInitializer; +import net.fabricmc.fabric.api.item.v1.ModifyItemAttributeModifiersCallback; import net.fabricmc.fabric.api.object.builder.v1.trade.TradeOfferHelper; import net.fabricmc.fabric.api.registry.FuelRegistry; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.block.DispenserBlock; import net.minecraft.block.dispenser.ProjectileDispenserBehavior; +import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.attribute.EntityAttributeModifier; +import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.entity.projectile.PersistentProjectileEntity; import net.minecraft.entity.projectile.ProjectileEntity; import net.minecraft.entity.vehicle.AbstractMinecartEntity; +import net.minecraft.item.ArmorItem; import net.minecraft.item.ItemStack; import net.minecraft.registry.RegistryKeys; import net.minecraft.registry.tag.TagKey; @@ -34,15 +39,19 @@ import nourl.mythicmetals.command.MythicCommands; import nourl.mythicmetals.config.MythicMetalsConfig; import nourl.mythicmetals.data.MythicOreKeys; +import nourl.mythicmetals.data.MythicTags; import nourl.mythicmetals.effects.MythicStatusEffects; import nourl.mythicmetals.entity.*; import nourl.mythicmetals.item.MythicItems; import nourl.mythicmetals.item.tools.MythicTools; +import nourl.mythicmetals.item.tools.PrometheumToolSet; import nourl.mythicmetals.misc.*; import nourl.mythicmetals.registry.*; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import java.util.UUID; + public class MythicMetals implements ModInitializer, EntityComponentInitializer { public static Logger LOGGER = LogManager.getLogger(); public static final String MOD_ID = "mythicmetals"; @@ -106,6 +115,7 @@ public void onInitialize() { factories.add(new TradeOffers.SellItemFactory(MythicItems.Templates.AEGIS_SMITHING_TEMPLATE, 48, 1, 2, 30)); }); registerDispenserBehaviour(); + registerPrometheumAttributeEvent(); if (CONFIG.configVersion() < CONFIG_VERSION) { @@ -177,4 +187,27 @@ public void registerEntityComponentFactories(EntityComponentFactoryRegistry regi registry.registerFor(LivingEntity.class, COMBUSTION_COOLDOWN, CombustionCooldown::new); registry.registerForPlayers(CARMOT_SHIELD, CarmotShield::new, RespawnCopyStrategy.INVENTORY); } + + private void registerPrometheumAttributeEvent() { + ModifyItemAttributeModifiersCallback.EVENT.register((stack, slot, attributeModifiers) -> { + if (stack.isIn(MythicTags.PROMETHEUM_ARMOR) && ((ArmorItem) stack.getItem()).getSlotType().equals(slot)) { + if (EnchantmentHelper.hasBindingCurse(stack)) { + attributeModifiers.put(EntityAttributes.GENERIC_ATTACK_SPEED, new EntityAttributeModifier( + UUID.fromString("d42e82c8-166d-46f1-bc76-df84e91b5531"), + "Bound Prometheum bonus", + 0.08, + EntityAttributeModifier.Operation.MULTIPLY_BASE + )); + } + if (PrometheumToolSet.isOvergrown(stack)) { + attributeModifiers.put(EntityAttributes.GENERIC_ARMOR_TOUGHNESS, new EntityAttributeModifier( + UUID.fromString("37bb6460-e896-44e2-8e71-29335d5ce709"), + "Prometheum bonus toughness", + EnchantmentHelper.hasBindingCurse(stack) ? 2 : 1, + EntityAttributeModifier.Operation.ADDITION + )); + } + } + }); + } } diff --git a/src/main/java/nourl/mythicmetals/MythicMetalsClient.java b/src/main/java/nourl/mythicmetals/MythicMetalsClient.java index 1a772885..a89c8f84 100644 --- a/src/main/java/nourl/mythicmetals/MythicMetalsClient.java +++ b/src/main/java/nourl/mythicmetals/MythicMetalsClient.java @@ -8,13 +8,15 @@ import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback; import net.fabricmc.fabric.api.client.model.loading.v1.ModelLoadingPlugin; import net.fabricmc.fabric.api.client.rendering.v1.*; -import net.fabricmc.fabric.api.item.v1.ModifyItemAttributeModifiersCallback; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.block.ShapeContext; import net.minecraft.client.MinecraftClient; import net.minecraft.client.item.ModelPredicateProviderRegistry; import net.minecraft.client.network.AbstractClientPlayerEntity; -import net.minecraft.client.render.*; +import net.minecraft.client.render.OverlayTexture; +import net.minecraft.client.render.RenderLayer; +import net.minecraft.client.render.TexturedRenderLayers; +import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.block.entity.BlockEntityRendererFactories; import net.minecraft.client.render.entity.feature.FeatureRendererContext; import net.minecraft.client.render.entity.model.PlayerEntityModel; @@ -24,10 +26,7 @@ import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.EntityType; import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.attribute.EntityAttributeModifier; -import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ArmorItem; import net.minecraft.item.Item; import net.minecraft.item.trim.ArmorTrim; import net.minecraft.registry.Registries; @@ -39,7 +38,10 @@ import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.World; import nourl.mythicmetals.abilities.Ability; -import nourl.mythicmetals.armor.*; +import nourl.mythicmetals.armor.CelestiumElytra; +import nourl.mythicmetals.armor.HallowedArmor; +import nourl.mythicmetals.armor.MythicArmor; +import nourl.mythicmetals.armor.TidesingerArmor; import nourl.mythicmetals.blocks.IndevBlocks; import nourl.mythicmetals.blocks.MythicBlocks; import nourl.mythicmetals.client.CarmotShieldHudHandler; @@ -49,10 +51,15 @@ import nourl.mythicmetals.data.MythicTags; import nourl.mythicmetals.entity.MythicEntities; import nourl.mythicmetals.item.tools.*; -import nourl.mythicmetals.misc.*; +import nourl.mythicmetals.misc.BlockBreaker; +import nourl.mythicmetals.misc.RegistryHelper; +import nourl.mythicmetals.misc.ShieldUsePredicate; +import nourl.mythicmetals.misc.UsefulSingletonForColorUtil; import nourl.mythicmetals.mixin.WorldRendererInvoker; import nourl.mythicmetals.registry.RegisterBlockEntityTypes; -import java.util.*; + +import java.util.ArrayList; +import java.util.Calendar; public class MythicMetalsClient implements ClientModInitializer { private long lastTick; @@ -70,7 +77,6 @@ public void onInitializeClient() { registerTidesingerTooltips(); registerPrometheumTooltips(); - registerPrometheumAttributeEvent(); LivingEntityFeatureRenderEvents.ALLOW_CAPE_RENDER.register(player -> !CelestiumElytra.isWearing(player)); @@ -97,28 +103,7 @@ public void onInitializeClient() { } } - private void registerPrometheumAttributeEvent() { - ModifyItemAttributeModifiersCallback.EVENT.register((stack, slot, attributeModifiers) -> { - if (stack.isIn(MythicTags.PROMETHEUM_ARMOR) && ((ArmorItem) stack.getItem()).getSlotType().equals(slot)) { - if (EnchantmentHelper.hasBindingCurse(stack)) { - attributeModifiers.put(EntityAttributes.GENERIC_ATTACK_SPEED, new EntityAttributeModifier( - UUID.fromString("d42e82c8-166d-46f1-bc76-df84e91b5531"), - "Bound Prometheum bonus", - 0.08, - EntityAttributeModifier.Operation.MULTIPLY_BASE - )); - } - if (PrometheumToolSet.isOvergrown(stack)) { - attributeModifiers.put(EntityAttributes.GENERIC_ARMOR_TOUGHNESS, new EntityAttributeModifier( - UUID.fromString("37bb6460-e896-44e2-8e71-29335d5ce709"), - "Prometheum bonus toughness", - EnchantmentHelper.hasBindingCurse(stack) ? 2 : 1, - EntityAttributeModifier.Operation.ADDITION - )); - } - } - }); - } + private void registerPrometheumTooltips() { ItemTooltipCallback.EVENT.register((stack, context, lines) -> { diff --git a/src/main/java/nourl/mythicmetals/armor/MythicArmor.java b/src/main/java/nourl/mythicmetals/armor/MythicArmor.java index 6cac9129..5cd74524 100644 --- a/src/main/java/nourl/mythicmetals/armor/MythicArmor.java +++ b/src/main/java/nourl/mythicmetals/armor/MythicArmor.java @@ -32,7 +32,7 @@ public class MythicArmor implements SimpleFieldProcessingSubject { public static final ArmorSet OSMIUM = new ArmorSet(MythicArmorMaterials.OSMIUM); public static final ArmorSet OSMIUM_CHAINMAIL = new ArmorSet(MythicArmorMaterials.OSMIUM_CHAINMAIL); public static final ArmorSet PALLADIUM = new ArmorSet(MythicArmorMaterials.PALLADIUM, OwoItemSettings::fireproof); - public static final ArmorSet PROMETHEUM = new ArmorSet(MythicArmorMaterials.PROMETHEUM); + public static final ArmorSet PROMETHEUM = new PrometheumArmorSet(MythicArmorMaterials.PROMETHEUM); public static final ArmorSet RUNITE = new RuniteArmorSet(MythicArmorMaterials.RUNITE); public static final ArmorSet SILVER = new ArmorSet(MythicArmorMaterials.SILVER); public static final ArmorSet STAR_PLATINUM = new ArmorSet(MythicArmorMaterials.STAR_PLATINUM); diff --git a/src/main/java/nourl/mythicmetals/armor/PrometheumArmorItem.java b/src/main/java/nourl/mythicmetals/armor/PrometheumArmorItem.java new file mode 100644 index 00000000..2662154b --- /dev/null +++ b/src/main/java/nourl/mythicmetals/armor/PrometheumArmorItem.java @@ -0,0 +1,20 @@ +package nourl.mythicmetals.armor; + +import net.minecraft.entity.Entity; +import net.minecraft.item.ArmorItem; +import net.minecraft.item.ArmorMaterial; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import nourl.mythicmetals.item.tools.PrometheumToolSet; + +public class PrometheumArmorItem extends ArmorItem { + public PrometheumArmorItem(ArmorMaterial material, Type type, Settings settings) { + super(material, type, settings); + } + + @Override + public void inventoryTick(ItemStack stack, World world, Entity entity, int slot, boolean selected) { + if (!world.isClient()) PrometheumToolSet.tickAutoRepair(stack, world.getRandom()); + super.inventoryTick(stack, world, entity, slot, selected); + } +} diff --git a/src/main/java/nourl/mythicmetals/armor/PrometheumArmorSet.java b/src/main/java/nourl/mythicmetals/armor/PrometheumArmorSet.java new file mode 100644 index 00000000..de13edce --- /dev/null +++ b/src/main/java/nourl/mythicmetals/armor/PrometheumArmorSet.java @@ -0,0 +1,16 @@ +package nourl.mythicmetals.armor; + +import io.wispforest.owo.itemgroup.OwoItemSettings; +import net.minecraft.item.ArmorItem; +import net.minecraft.item.ArmorMaterial; + +public class PrometheumArmorSet extends ArmorSet { + public PrometheumArmorSet(ArmorMaterial material) { + super(material); + } + + @Override + protected ArmorItem makeItem(ArmorMaterial material, ArmorItem.Type slot, OwoItemSettings settings) { + return new PrometheumArmorItem(material, slot, settings); + } +} diff --git a/src/main/java/nourl/mythicmetals/item/tools/PrometheumToolSet.java b/src/main/java/nourl/mythicmetals/item/tools/PrometheumToolSet.java index 45bc430b..4611e997 100644 --- a/src/main/java/nourl/mythicmetals/item/tools/PrometheumToolSet.java +++ b/src/main/java/nourl/mythicmetals/item/tools/PrometheumToolSet.java @@ -3,9 +3,16 @@ import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; import io.wispforest.owo.nbt.NbtKey; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.Entity; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.attribute.*; import net.minecraft.item.*; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.random.Random; +import net.minecraft.world.World; +import nourl.mythicmetals.data.MythicTags; + import java.util.UUID; public class PrometheumToolSet extends ToolSet { @@ -54,16 +61,22 @@ public Multimap getAttributeModifiers( if (stack.has(DURABILITY_REPAIRED) && stack.get(DURABILITY_REPAIRED) > OVERGROWN_THRESHOLD) { modifiers.put(EntityAttributes.GENERIC_ATTACK_DAMAGE, - new EntityAttributeModifier( - UUID.fromString("69def8b1-1baa-401e-a7cb-b27ab9a55558"), - "Overgrown Prometheum bonus", - 1.0, - EntityAttributeModifier.Operation.ADDITION) + new EntityAttributeModifier( + UUID.fromString("69def8b1-1baa-401e-a7cb-b27ab9a55558"), + "Overgrown Prometheum bonus", + 1.0, + EntityAttributeModifier.Operation.ADDITION) ); } return modifiers; } + + @Override + public void inventoryTick(ItemStack stack, World world, Entity entity, int slot, boolean selected) { + if (!world.isClient()) tickAutoRepair(stack, world.getRandom()); + super.inventoryTick(stack, world, entity, slot, selected); + } } public static class PrometheumHoe extends HoeItem implements AutoRepairable { @@ -79,22 +92,29 @@ public Multimap getAttributeModifiers( if (stack.has(DURABILITY_REPAIRED) && stack.get(DURABILITY_REPAIRED) > OVERGROWN_THRESHOLD) { modifiers.put(EntityAttributes.GENERIC_ATTACK_DAMAGE, - new EntityAttributeModifier( - UUID.fromString("69def8b1-1baa-401e-a7cb-b27ab9a55558"), - "Overgrown Prometheum bonus", - 1.0, - EntityAttributeModifier.Operation.ADDITION) + new EntityAttributeModifier( + UUID.fromString("69def8b1-1baa-401e-a7cb-b27ab9a55558"), + "Overgrown Prometheum bonus", + 1.0, + EntityAttributeModifier.Operation.ADDITION) ); } return modifiers; } + + @Override + public void inventoryTick(ItemStack stack, World world, Entity entity, int slot, boolean selected) { + if (!world.isClient()) tickAutoRepair(stack, world.getRandom()); + super.inventoryTick(stack, world, entity, slot, selected); + } } public static class PrometheumPick extends PickaxeItem implements AutoRepairable { public PrometheumPick(ToolMaterial material, int attackDamage, float attackSpeed, Settings settings) { super(material, attackDamage, attackSpeed, settings); } + @Override public Multimap getAttributeModifiers(ItemStack stack, EquipmentSlot slot) { if (slot != EquipmentSlot.MAINHAND) return super.getAttributeModifiers(slot); @@ -103,22 +123,29 @@ public Multimap getAttributeModifiers( if (stack.has(DURABILITY_REPAIRED) && stack.get(DURABILITY_REPAIRED) > OVERGROWN_THRESHOLD) { modifiers.put(EntityAttributes.GENERIC_ATTACK_DAMAGE, - new EntityAttributeModifier( - UUID.fromString("69def8b1-1baa-401e-a7cb-b27ab9a55558"), - "Overgrown Prometheum bonus", - 1.0, - EntityAttributeModifier.Operation.ADDITION) + new EntityAttributeModifier( + UUID.fromString("69def8b1-1baa-401e-a7cb-b27ab9a55558"), + "Overgrown Prometheum bonus", + 1.0, + EntityAttributeModifier.Operation.ADDITION) ); } return modifiers; } + + @Override + public void inventoryTick(ItemStack stack, World world, Entity entity, int slot, boolean selected) { + if (!world.isClient()) tickAutoRepair(stack, world.getRandom()); + super.inventoryTick(stack, world, entity, slot, selected); + } } public static class PrometheumShovel extends ShovelItem implements AutoRepairable { public PrometheumShovel(ToolMaterial material, int attackDamage, float attackSpeed, Settings settings) { super(material, attackDamage, attackSpeed, settings); } + @Override public Multimap getAttributeModifiers(ItemStack stack, EquipmentSlot slot) { if (slot != EquipmentSlot.MAINHAND) return super.getAttributeModifiers(slot); @@ -127,16 +154,22 @@ public Multimap getAttributeModifiers( if (stack.has(DURABILITY_REPAIRED) && stack.get(DURABILITY_REPAIRED) > OVERGROWN_THRESHOLD) { modifiers.put(EntityAttributes.GENERIC_ATTACK_DAMAGE, - new EntityAttributeModifier( - UUID.fromString("69def8b1-1baa-401e-a7cb-b27ab9a55558"), - "Overgrown Prometheum bonus", - 1.0, - EntityAttributeModifier.Operation.ADDITION) + new EntityAttributeModifier( + UUID.fromString("69def8b1-1baa-401e-a7cb-b27ab9a55558"), + "Overgrown Prometheum bonus", + 1.0, + EntityAttributeModifier.Operation.ADDITION) ); } return modifiers; } + + @Override + public void inventoryTick(ItemStack stack, World world, Entity entity, int slot, boolean selected) { + if (!world.isClient()) tickAutoRepair(stack, world.getRandom()); + super.inventoryTick(stack, world, entity, slot, selected); + } } public static class PrometheumSword extends SwordItem implements AutoRepairable { @@ -152,21 +185,27 @@ public Multimap getAttributeModifiers( if (stack.has(DURABILITY_REPAIRED) && stack.get(DURABILITY_REPAIRED) > OVERGROWN_THRESHOLD) { modifiers.put(EntityAttributes.GENERIC_ATTACK_DAMAGE, - new EntityAttributeModifier( - UUID.fromString("69def8b1-1baa-401e-a7cb-b27ab9a55558"), - "Overgrown Prometheum bonus", - 1.0, - EntityAttributeModifier.Operation.ADDITION) + new EntityAttributeModifier( + UUID.fromString("69def8b1-1baa-401e-a7cb-b27ab9a55558"), + "Overgrown Prometheum bonus", + 1.0, + EntityAttributeModifier.Operation.ADDITION) ); } return modifiers; } + + @Override + public void inventoryTick(ItemStack stack, World world, Entity entity, int slot, boolean selected) { + if (!world.isClient()) tickAutoRepair(stack, world.getRandom()); + super.inventoryTick(stack, world, entity, slot, selected); + } } public static void incrementRepairCounter(ItemStack stack, int value) { int counter = stack.get(DURABILITY_REPAIRED); - if (counter < Integer.MAX_VALUE - 100) { + if (counter < (Integer.MAX_VALUE / 2)) { stack.put(DURABILITY_REPAIRED, counter + value); } } @@ -174,4 +213,37 @@ public static void incrementRepairCounter(ItemStack stack, int value) { public static boolean isOvergrown(ItemStack stack) { return stack.has(DURABILITY_REPAIRED) && stack.get(DURABILITY_REPAIRED) > OVERGROWN_THRESHOLD; } + + /** + * Applies auto repair onto the item in question + * Only call this on the server, not on the client! + * + * @param stack ItemStack to repair + * @param r Any Minecraft Math {@link Random} + */ + public static void tickAutoRepair(ItemStack stack, Random r) { + if (!stack.isDamaged()) return; // Don't handle auto repair if item is fully repaired + + if (!stack.has(PrometheumToolSet.DURABILITY_REPAIRED)) { + stack.put(PrometheumToolSet.DURABILITY_REPAIRED, 0); + } + + var dmg = stack.getDamage(); + var rng = r.nextInt(200); + + if (rng != 177) return; // Roll for repair, ignore if roll fails. Number is arbitrary + + // Overgrown Items repair faster + int damageToRepair = PrometheumToolSet.isOvergrown(stack) ? 2 : 1; + + // Extra repair speed if bound + if (stack.isIn(MythicTags.PROMETHEUM_ARMOR) && EnchantmentHelper.hasBindingCurse(stack)) { + damageToRepair += 1; + } + + int newDamage = MathHelper.clamp(dmg - damageToRepair, 0, Integer.MAX_VALUE); + stack.setDamage(newDamage); + + PrometheumToolSet.incrementRepairCounter(stack, damageToRepair); + } } diff --git a/src/main/java/nourl/mythicmetals/mixin/LivingEntityMixin.java b/src/main/java/nourl/mythicmetals/mixin/LivingEntityMixin.java index 9f43da28..b60c09c3 100644 --- a/src/main/java/nourl/mythicmetals/mixin/LivingEntityMixin.java +++ b/src/main/java/nourl/mythicmetals/mixin/LivingEntityMixin.java @@ -10,7 +10,9 @@ import net.minecraft.entity.attribute.DefaultAttributeContainer; import net.minecraft.entity.attribute.EntityAttribute; import net.minecraft.entity.damage.DamageSource; -import net.minecraft.entity.effect.*; +import net.minecraft.entity.effect.StatusEffect; +import net.minecraft.entity.effect.StatusEffectInstance; +import net.minecraft.entity.effect.StatusEffects; import net.minecraft.item.ItemStack; import net.minecraft.registry.tag.DamageTypeTags; import net.minecraft.server.network.ServerPlayerEntity; @@ -21,21 +23,24 @@ import net.minecraft.world.World; import nourl.mythicmetals.MythicMetals; import nourl.mythicmetals.armor.MythicArmor; -import nourl.mythicmetals.data.MythicTags; import nourl.mythicmetals.effects.MythicStatusEffects; import nourl.mythicmetals.entity.CombustionCooldown; import nourl.mythicmetals.item.MythicItems; import nourl.mythicmetals.item.tools.MythrilDrill; -import nourl.mythicmetals.item.tools.PrometheumToolSet; import nourl.mythicmetals.misc.MythicParticleSystem; import nourl.mythicmetals.misc.WasSpawnedFromCreeper; import nourl.mythicmetals.registry.RegisterCriteria; import nourl.mythicmetals.registry.RegisterEntityAttributes; import org.jetbrains.annotations.Nullable; -import org.spongepowered.asm.mixin.*; -import org.spongepowered.asm.mixin.injection.*; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.ModifyVariable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + import java.util.Random; @Mixin(LivingEntity.class) @@ -123,8 +128,8 @@ public LivingEntityMixin(EntityType type, World world) { @Inject(method = "tick", at = @At("HEAD")) private void mythicmetals$tick(CallbackInfo ci) { if (!getWorld().isClient()) { - mythicmetals$prometheumRepairPassive(getMainHandStack()); - mythicmetals$prometheumRepairPassive(getOffHandStack()); + mythicmetals$drillRepairPassive(getMainHandStack()); + mythicmetals$drillRepairPassive(getOffHandStack()); mythicmetals$tickCombustion(); } mythicmetals$palladiumParticles(); @@ -163,23 +168,7 @@ public LivingEntityMixin(EntityType type, World world) { } @Unique - private void mythicmetals$prometheumRepairPassive(ItemStack stack) { - // Handle Prometheum Tools - if (stack.isIn(MythicTags.PROMETHEUM_TOOLS)) { - - if (!stack.has(PrometheumToolSet.DURABILITY_REPAIRED)) { - stack.put(PrometheumToolSet.DURABILITY_REPAIRED, 0); - } - - var dmg = stack.getDamage(); - var rng = r.nextInt(200); - if (rng == 117 && dmg > 0) { - int value = PrometheumToolSet.isOvergrown(stack) ? 2 : 1; - stack.setDamage(MathHelper.clamp(dmg - value, 0, Integer.MAX_VALUE)); - PrometheumToolSet.incrementRepairCounter(stack, 1); - } - } - + private void mythicmetals$drillRepairPassive(ItemStack stack) { // Handle Mythril Drill with Prometheum Upgrade if (stack.getItem() instanceof MythrilDrill drill && MythrilDrill.hasUpgradeItem(stack, MythicItems.Mats.PROMETHEUM_BOUQUET)) { var dmg = stack.getDamage(); @@ -208,24 +197,6 @@ public LivingEntityMixin(EntityType type, World world) { mythicmetals$carmotParticle(); } - // Repair Prometheum Armor server-side - if (!getWorld().isClient && armorStack.isIn(MythicTags.PROMETHEUM_ARMOR) && armorStack.isDamaged()) { - var dmg = armorStack.getDamage(); - var rng = r.nextInt(200); - - if (!armorStack.has(PrometheumToolSet.DURABILITY_REPAIRED)) { - armorStack.put(PrometheumToolSet.DURABILITY_REPAIRED, 0); - } - - if (EnchantmentHelper.hasBindingCurse(armorStack) && rng < 2) { - armorStack.setDamage(MathHelper.clamp(dmg - 2, 0, Integer.MAX_VALUE)); - PrometheumToolSet.incrementRepairCounter(armorStack, 2); - } else if (rng == 117) { - armorStack.setDamage(MathHelper.clamp(dmg - 1, 0, Integer.MAX_VALUE)); - PrometheumToolSet.incrementRepairCounter(armorStack, 1); - } - } - if (MythicArmor.COPPER.isInArmorSet(armorStack) && getWorld().isThundering()) { Vec3d playerPos = this.getPos(); boolean isConductive = playerPos.y == getWorld().getTopY(Heightmap.Type.WORLD_SURFACE, (int) playerPos.x, (int) playerPos.z);