From 95ef93502c82f2db8da771987ad3b084b7d06b26 Mon Sep 17 00:00:00 2001 From: "Luis C.M." <42545778+c0508383@users.noreply.github.com> Date: Tue, 25 Jun 2024 20:53:53 -0500 Subject: [PATCH] Renamed IBattlePlayer --- .../mysteriumlib/asm/fixes/MysteriumPatchesFixesO.java | 10 +++++----- src/main/java/xonin/backhand/HookContainerClass.java | 4 ++-- .../core/{IBattlePlayer.java => IBackhandPlayer.java} | 2 +- .../backhand/client/BackhandClientTickHandler.java | 4 ++-- .../backhand/client/utils/BackhandRenderHelper.java | 6 +++--- .../coremod/transformers/EntityPlayerTransformer.java | 4 ++-- .../xonin/backhand/packet/OffhandAnimationPacket.java | 4 ++-- .../xonin/backhand/packet/OffhandAttackPacket.java | 4 ++-- src/main/java/xonin/backhand/utils/EnumAnimations.java | 6 +++--- 9 files changed, 22 insertions(+), 22 deletions(-) rename src/main/java/xonin/backhand/api/core/{IBattlePlayer.java => IBackhandPlayer.java} (94%) diff --git a/src/main/java/net/tclproject/mysteriumlib/asm/fixes/MysteriumPatchesFixesO.java b/src/main/java/net/tclproject/mysteriumlib/asm/fixes/MysteriumPatchesFixesO.java index 5c74772..5f4b479 100644 --- a/src/main/java/net/tclproject/mysteriumlib/asm/fixes/MysteriumPatchesFixesO.java +++ b/src/main/java/net/tclproject/mysteriumlib/asm/fixes/MysteriumPatchesFixesO.java @@ -9,7 +9,7 @@ import invtweaks.api.container.ContainerSection; import xonin.backhand.HookContainerClass; import xonin.backhand.api.core.BackhandUtils; -import xonin.backhand.api.core.IBattlePlayer; +import xonin.backhand.api.core.IBackhandPlayer; import xonin.backhand.api.core.InventoryPlayerBackhand; import xonin.backhand.client.BackhandClientTickHandler; import net.minecraft.block.material.Material; @@ -207,7 +207,7 @@ public static void renderItemInFirstPerson(ItemRenderer itemRenderer, float fram if (!Backhand.EmptyOffhand && !Backhand.RenderEmptyOffhandAtRest && offhandItem == null) { return; } - if (offhandItem == null && !Backhand.RenderEmptyOffhandAtRest && ((IBattlePlayer)player).getOffSwingProgress(frame) == 0) { + if (offhandItem == null && !Backhand.RenderEmptyOffhandAtRest && ((IBackhandPlayer)player).getOffSwingProgress(frame) == 0) { return; } if (mainhandItem != null && mainhandItem.getItem() instanceof ItemMap) { @@ -231,7 +231,7 @@ public static void renderItemInFirstPerson(ItemRenderer itemRenderer, float fram public static float getSwingProgress(EntityLivingBase entityLivingBase, float partialTicks, @ReturnedValue float returnedValue) { if (offhandFPRender) { - return ((IBattlePlayer)entityLivingBase).getOffSwingProgress(partialTicks); + return ((IBackhandPlayer)entityLivingBase).getOffSwingProgress(partialTicks); } return returnedValue; } @@ -241,7 +241,7 @@ public static float getSwingProgress(EntityLivingBase entityLivingBase, float pa public static void doRender(RendererLivingEntity l, EntityLivingBase p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { if (p_76986_1_ instanceof EntityPlayer) { - onGround2 = ((IBattlePlayer)p_76986_1_).getOffSwingProgress(p_76986_9_); + onGround2 = ((IBackhandPlayer)p_76986_1_).getOffSwingProgress(p_76986_9_); } } @@ -309,7 +309,7 @@ public static void setRotationAngles(ModelBiped b, float p_78087_1_, float p_780 b.bipedRightArm.rotateAngleZ = MathHelper.sin(b.onGround * (float)Math.PI) * -0.4F; } - if (p_78087_7_ instanceof EntityPlayer && (p_78087_7_ != Minecraft.getMinecraft().thePlayer || ((IBattlePlayer)p_78087_7_).getOffSwingProgress(MysteriumPatchesFixesO.firstPersonFrame) != 0)) { + if (p_78087_7_ instanceof EntityPlayer && (p_78087_7_ != Minecraft.getMinecraft().thePlayer || ((IBackhandPlayer)p_78087_7_).getOffSwingProgress(MysteriumPatchesFixesO.firstPersonFrame) != 0)) { if (onGround2 > -9990.0F) { f6 = onGround2; b.bipedBody.rotateAngleY = MathHelper.sin(MathHelper.sqrt_float(f6) * (float)Math.PI * 2.0F) * 0.2F; diff --git a/src/main/java/xonin/backhand/HookContainerClass.java b/src/main/java/xonin/backhand/HookContainerClass.java index 78d1b77..24c39f6 100644 --- a/src/main/java/xonin/backhand/HookContainerClass.java +++ b/src/main/java/xonin/backhand/HookContainerClass.java @@ -249,14 +249,14 @@ public static boolean tryUseItem(EntityPlayer player, ItemStack itemStack, Side @SideOnly(Side.CLIENT) public static void sendOffSwingEvent(PlayerEvent event, ItemStack mainHandItem, ItemStack offhandItem){ if(!MinecraftForge.EVENT_BUS.post(new PlayerEventChild.OffhandSwingEvent(event, mainHandItem, offhandItem))){ - ((IBattlePlayer) event.entityPlayer).swingOffItem(); + ((IBackhandPlayer) event.entityPlayer).swingOffItem(); Backhand.proxy.sendAnimationPacket(EnumAnimations.OffHandSwing, event.entityPlayer); } } @SideOnly(Side.CLIENT) public static void sendOffSwingEventNoCheck(EntityPlayer player, ItemStack mainHandItem, ItemStack offhandItem){ - ((IBattlePlayer) player).swingOffItem(); + ((IBackhandPlayer) player).swingOffItem(); Backhand.proxy.sendAnimationPacket(EnumAnimations.OffHandSwing, player); } diff --git a/src/main/java/xonin/backhand/api/core/IBattlePlayer.java b/src/main/java/xonin/backhand/api/core/IBackhandPlayer.java similarity index 94% rename from src/main/java/xonin/backhand/api/core/IBattlePlayer.java rename to src/main/java/xonin/backhand/api/core/IBackhandPlayer.java index 7536207..16222cb 100644 --- a/src/main/java/xonin/backhand/api/core/IBattlePlayer.java +++ b/src/main/java/xonin/backhand/api/core/IBackhandPlayer.java @@ -6,7 +6,7 @@ * Interface added to EntityPlayer to support offhand management * @author GotoLink */ -public interface IBattlePlayer{ +public interface IBackhandPlayer { /** * A copied animation for the offhand, similar to EntityPlayer#swingItem() diff --git a/src/main/java/xonin/backhand/client/BackhandClientTickHandler.java b/src/main/java/xonin/backhand/client/BackhandClientTickHandler.java index 7ba9d23..2803a4f 100644 --- a/src/main/java/xonin/backhand/client/BackhandClientTickHandler.java +++ b/src/main/java/xonin/backhand/client/BackhandClientTickHandler.java @@ -19,7 +19,7 @@ import xonin.backhand.HookContainerClass; import xonin.backhand.api.PlayerEventChild; import xonin.backhand.api.core.BackhandUtils; -import xonin.backhand.api.core.IBattlePlayer; +import xonin.backhand.api.core.IBackhandPlayer; import xonin.backhand.api.core.InventoryPlayerBackhand; import xonin.backhand.packet.OffhandPlaceBlockPacket; import net.minecraft.block.Block; @@ -158,7 +158,7 @@ public boolean tryCheckUseItem(ItemStack offhandItem, EntityPlayer player){ PlayerEventChild.UseOffhandItemEvent useItemEvent = new PlayerEventChild.UseOffhandItemEvent(new PlayerInteractEvent(player, PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, j, k, l, i1, player.worldObj), offhandItem); if (player.capabilities.allowEdit || !HookContainerClass.isItemBlock(offhandItem.getItem())) { if (!MinecraftForge.EVENT_BUS.post(useItemEvent) && onPlayerPlaceBlock(mc.playerController, player, offhandItem, j, k, l, i1, mouseOver.hitVec)) { - ((IBattlePlayer) player).swingOffItem(); + ((IBackhandPlayer) player).swingOffItem(); interacted = true; } } diff --git a/src/main/java/xonin/backhand/client/utils/BackhandRenderHelper.java b/src/main/java/xonin/backhand/client/utils/BackhandRenderHelper.java index 65355c2..3b2ae7f 100644 --- a/src/main/java/xonin/backhand/client/utils/BackhandRenderHelper.java +++ b/src/main/java/xonin/backhand/client/utils/BackhandRenderHelper.java @@ -5,7 +5,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import xonin.backhand.api.core.IBattlePlayer; +import xonin.backhand.api.core.IBackhandPlayer; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.GLAllocation; @@ -49,8 +49,8 @@ public final class BackhandRenderHelper { private static final Vec3 field_82885_c = Vec3.createVectorHelper(-0.20000000298023224D, 1.0D, 0.699999988079071D).normalize(); public static void moveOffHandArm(Entity entity, ModelBiped biped, float frame) { - if (entity instanceof IBattlePlayer) { - IBattlePlayer player = (IBattlePlayer) entity; + if (entity instanceof IBackhandPlayer) { + IBackhandPlayer player = (IBackhandPlayer) entity; float offhandSwing = 0.0F; offhandSwing = player.getOffSwingProgress(frame); diff --git a/src/main/java/xonin/backhand/coremod/transformers/EntityPlayerTransformer.java b/src/main/java/xonin/backhand/coremod/transformers/EntityPlayerTransformer.java index d3eb45c..ebe13a7 100644 --- a/src/main/java/xonin/backhand/coremod/transformers/EntityPlayerTransformer.java +++ b/src/main/java/xonin/backhand/coremod/transformers/EntityPlayerTransformer.java @@ -1,7 +1,7 @@ package xonin.backhand.coremod.transformers; import xonin.backhand.api.core.BattlegearTranslator; -import xonin.backhand.api.core.IBattlePlayer; +import xonin.backhand.api.core.IBackhandPlayer; import net.tclproject.mysteriumlib.asm.common.CustomLoadingPlugin; import org.apache.logging.log4j.Level; @@ -40,7 +40,7 @@ public EntityPlayerTransformer() { @Override void addInterface(List interfaces) { - interfaces.add(Type.getInternalName(IBattlePlayer.class)); + interfaces.add(Type.getInternalName(IBackhandPlayer.class)); } @Override diff --git a/src/main/java/xonin/backhand/packet/OffhandAnimationPacket.java b/src/main/java/xonin/backhand/packet/OffhandAnimationPacket.java index 89c2f9e..b95b7a0 100644 --- a/src/main/java/xonin/backhand/packet/OffhandAnimationPacket.java +++ b/src/main/java/xonin/backhand/packet/OffhandAnimationPacket.java @@ -2,7 +2,7 @@ import cpw.mods.fml.common.network.ByteBufUtils; import io.netty.buffer.ByteBuf; -import xonin.backhand.api.core.IBattlePlayer; +import xonin.backhand.api.core.IBackhandPlayer; import xonin.backhand.utils.EnumAnimations; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.WorldServer; @@ -41,7 +41,7 @@ public void process(ByteBuf in,EntityPlayer player) { if (entity.worldObj instanceof WorldServer) { ((WorldServer) entity.worldObj).getEntityTracker().func_151247_a(entity, this.generatePacket()); } - animation.processAnimation((IBattlePlayer)entity); + animation.processAnimation((IBackhandPlayer)entity); } } } diff --git a/src/main/java/xonin/backhand/packet/OffhandAttackPacket.java b/src/main/java/xonin/backhand/packet/OffhandAttackPacket.java index 048b411..8b277d0 100644 --- a/src/main/java/xonin/backhand/packet/OffhandAttackPacket.java +++ b/src/main/java/xonin/backhand/packet/OffhandAttackPacket.java @@ -2,7 +2,7 @@ import cpw.mods.fml.common.network.ByteBufUtils; import io.netty.buffer.ByteBuf; -import xonin.backhand.api.core.IBattlePlayer; +import xonin.backhand.api.core.IBackhandPlayer; import xonin.backhand.utils.EnumAnimations; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; @@ -50,7 +50,7 @@ public void process(ByteBuf inputStream, EntityPlayer sender) { if (target instanceof EntityItem || target instanceof EntityXPOrb || target instanceof EntityArrow || target == player) { return; } - ((IBattlePlayer) player).attackTargetEntityWithCurrentOffItem(target); + ((IBackhandPlayer) player).attackTargetEntityWithCurrentOffItem(target); Backhand.packetHandler.sendPacketAround(player, 120, new OffhandAnimationPacket(EnumAnimations.OffHandSwing, player).generatePacket()); } } diff --git a/src/main/java/xonin/backhand/utils/EnumAnimations.java b/src/main/java/xonin/backhand/utils/EnumAnimations.java index 5558911..c77de83 100644 --- a/src/main/java/xonin/backhand/utils/EnumAnimations.java +++ b/src/main/java/xonin/backhand/utils/EnumAnimations.java @@ -1,16 +1,16 @@ package xonin.backhand.utils; -import xonin.backhand.api.core.IBattlePlayer; +import xonin.backhand.api.core.IBackhandPlayer; public enum EnumAnimations { OffHandSwing { @Override - public void processAnimation(IBattlePlayer entity) { + public void processAnimation(IBackhandPlayer entity) { entity.swingOffItem(); } }; - public abstract void processAnimation(IBattlePlayer entity); + public abstract void processAnimation(IBackhandPlayer entity); }