diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/Orchestras.java b/src/main/java/com/hbm/items/weapon/sedna/factory/Orchestras.java index 963cc5b08..ea79e62cd 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/Orchestras.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/Orchestras.java @@ -690,24 +690,24 @@ public class Orchestras { }; public static BiConsumer ORCHESTRA_CHEMTHROWER = (stack, ctx) -> { - EntityPlayer player = ctx.player; + EntityLivingBase entity = ctx.entity; AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); - if(type == AnimType.CYCLE && player.worldObj.isRemote) { - AudioWrapper runningAudio = ItemGunBaseNT.loopedSounds.get(player); + if(type == AnimType.CYCLE && entity.worldObj.isRemote) { + AudioWrapper runningAudio = ItemGunBaseNT.loopedSounds.get(entity); if(timer < 5) { //start sound if(runningAudio == null || !runningAudio.isPlaying()) { - AudioWrapper audio = MainRegistry.proxy.getLoopedSound("hbm:weapon.fire.flameLoop", (float) player.posX, (float) player.posY, (float) player.posZ, 1F, 15F, 1F, 10); - ItemGunBaseNT.loopedSounds.put(player, audio); + AudioWrapper audio = MainRegistry.proxy.getLoopedSound("hbm:weapon.fire.flameLoop", (float) entity.posX, (float) entity.posY, (float) entity.posZ, 1F, 15F, 1F, 10); + ItemGunBaseNT.loopedSounds.put(entity, audio); audio.startSound(); } //keepalive if(runningAudio != null && runningAudio.isPlaying()) { runningAudio.keepAlive(); - runningAudio.updatePosition((float) player.posX, (float) player.posY, (float) player.posZ); + runningAudio.updatePosition((float) entity.posX, (float) entity.posY, (float) entity.posZ); } } else { //stop sound due to timeout @@ -715,15 +715,15 @@ public class Orchestras { } } //stop sound due to state change - if(type != AnimType.CYCLE && player.worldObj.isRemote) { - AudioWrapper runningAudio = ItemGunBaseNT.loopedSounds.get(player); + if(type != AnimType.CYCLE && entity.worldObj.isRemote) { + AudioWrapper runningAudio = ItemGunBaseNT.loopedSounds.get(entity); if(runningAudio != null && runningAudio.isPlaying()) runningAudio.stopSound(); } }; public static BiConsumer ORCHESTRA_M2 = (stack, ctx) -> { - EntityPlayer player = ctx.player; - if(player.worldObj.isRemote) return; + EntityLivingBase entity = ctx.entity; + if(entity.worldObj.isRemote) return; AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); boolean aiming = ItemGunBaseNT.getIsAiming(stack); @@ -731,14 +731,14 @@ public class Orchestras { if(type == AnimType.CYCLE) { if(timer == 0) { SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack); - if(casing != null) CasingCreator.composeEffect(player.worldObj, player, 0.375, aiming ? 0 : -0.125, aiming ? 0 : -0.3125D, 0, 0.06, -0.18, 0.01, casing.getName()); + if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, 0.375, aiming ? 0 : -0.125, aiming ? 0 : -0.3125D, 0, 0.06, -0.18, 0.01, casing.getName()); } } }; public static BiConsumer ORCHESTRA_SHREDDER = (stack, ctx) -> { - EntityPlayer player = ctx.player; - if(player.worldObj.isRemote) return; + EntityLivingBase entity = ctx.entity; + if(entity.worldObj.isRemote) return; AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); }; diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory50.java b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory50.java index fa9425c42..fda9f09fd 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory50.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory50.java @@ -56,7 +56,7 @@ public class XFactory50 { } public static BiConsumer LAMBDA_SMOKE = (stack, ctx) -> { - Lego.handleStandardSmoke(ctx.player, stack, 2000, 0.05D, 1.1D, 0); + Lego.handleStandardSmoke(ctx.entity, stack, 2000, 0.05D, 1.1D, 0); }; @SuppressWarnings("incomplete-switch") public static BiFunction LAMBDA_M2_ANIMS = (stack, type) -> { diff --git a/src/main/java/com/hbm/items/weapon/sedna/impl/ItemGunChemthrower.java b/src/main/java/com/hbm/items/weapon/sedna/impl/ItemGunChemthrower.java index 4d21faecf..1b883686f 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/impl/ItemGunChemthrower.java +++ b/src/main/java/com/hbm/items/weapon/sedna/impl/ItemGunChemthrower.java @@ -14,6 +14,7 @@ import com.hbm.items.weapon.sedna.mags.MagazineFluid; import com.hbm.render.anim.HbmAnimations.AnimType; import api.hbm.fluid.IFillableItem; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.Vec3; @@ -77,7 +78,8 @@ public class ItemGunChemthrower extends ItemGunBaseNT implements IFillableItem { public static BiFunction LAMBDA_CAN_FIRE = (stack, ctx) -> { return ctx.config.getReceivers(stack)[0].getMagazine(stack).getAmount(stack) >= CONSUMPTION; }; public static BiConsumer LAMBDA_FIRE = (stack, ctx) -> { - EntityPlayer player = ctx.player; + EntityLivingBase entity = ctx.entity; + EntityPlayer player = ctx.getPlayer(); int index = ctx.configIndex; ItemGunBaseNT.playAnimation(player, stack, AnimType.CYCLE, ctx.configIndex); @@ -89,9 +91,9 @@ public class ItemGunChemthrower extends ItemGunBaseNT implements IFillableItem { double heightOffset = offset.yCoord; double sideOffset = offset.zCoord; - EntityChemical chem = new EntityChemical(player.worldObj, player, sideOffset, heightOffset, forwardOffset); + EntityChemical chem = new EntityChemical(entity.worldObj, entity, sideOffset, heightOffset, forwardOffset); chem.setFluid((FluidType) mag.getType(stack)); - player.worldObj.spawnEntityInWorld(chem); + entity.worldObj.spawnEntityInWorld(chem); mag.setAmount(stack, mag.getAmount(stack) - CONSUMPTION); ItemGunBaseNT.setWear(stack, index, Math.min(ItemGunBaseNT.getWear(stack, index) + 1F, ctx.config.getDurability(stack))); diff --git a/src/main/java/com/hbm/items/weapon/sedna/mags/IMagazine.java b/src/main/java/com/hbm/items/weapon/sedna/mags/IMagazine.java index 6fc0bf08f..11dbf6166 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/mags/IMagazine.java +++ b/src/main/java/com/hbm/items/weapon/sedna/mags/IMagazine.java @@ -24,9 +24,9 @@ public interface IMagazine { /** Sets the mag's ammo level */ public void setAmount(ItemStack stack, int amount); /** If a reload can even be initiated, i.e. the player even has bullets to load, inventory can be null */ - public boolean canReload(ItemStack stack, IInventory player); + public boolean canReload(ItemStack stack, IInventory inventory); /** The action done at the end of one reload cycle, either loading one shell or replacing the whole mag, inventory can be null */ - public void reloadAction(ItemStack stack, IInventory player); + public void reloadAction(ItemStack stack, IInventory inventory); /** The stack that should be displayed for the ammo HUD */ public ItemStack getIconForHUD(ItemStack stack); /** It explains itself */ diff --git a/src/main/java/com/hbm/items/weapon/sedna/mags/MagazineFluid.java b/src/main/java/com/hbm/items/weapon/sedna/mags/MagazineFluid.java index 44f83d895..977abb51e 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/mags/MagazineFluid.java +++ b/src/main/java/com/hbm/items/weapon/sedna/mags/MagazineFluid.java @@ -6,7 +6,9 @@ import com.hbm.items.ModItems; import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.particle.SpentCasing; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; public class MagazineFluid implements IMagazine { @@ -45,8 +47,8 @@ public class MagazineFluid implements IMagazine { @Override public int getAmount(ItemStack stack) { return getMagCount(stack, index); } @Override public void setAmount(ItemStack stack, int amount) { setMagCount(stack, index, amount); } - @Override public boolean canReload(ItemStack stack, EntityPlayer player) { return false; } - @Override public void reloadAction(ItemStack stack, EntityPlayer player) { } + @Override public boolean canReload(ItemStack stack, IInventory inventory) { return false; } + @Override public void reloadAction(ItemStack stack, IInventory inventory) { } @Override public SpentCasing getCasing(ItemStack stack) { return null; } @Override public ItemStack getIconForHUD(ItemStack stack) { return new ItemStack(ModItems.fluid_icon, 1, this.getMagType(stack, index)); }