Skip to content

Commit

Permalink
Renamed IBattlePlayer
Browse files Browse the repository at this point in the history
  • Loading branch information
c0508383 committed Jun 26, 2024
1 parent 942c6c7 commit 95ef935
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
}
Expand All @@ -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_);
}
}

Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/xonin/backhand/HookContainerClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -40,7 +40,7 @@ public EntityPlayerTransformer() {

@Override
void addInterface(List<String> interfaces) {
interfaces.add(Type.getInternalName(IBattlePlayer.class));
interfaces.add(Type.getInternalName(IBackhandPlayer.class));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/xonin/backhand/packet/OffhandAttackPacket.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/xonin/backhand/utils/EnumAnimations.java
Original file line number Diff line number Diff line change
@@ -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);

}

0 comments on commit 95ef935

Please sign in to comment.