From 691747d2f3723a5c3eb7c0f19eb8deb4d28b5e46 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 23 Nov 2016 18:38:13 +0100 Subject: [PATCH] Fixed lenses of the killer not dropping player drops Fixed batteries dupe bug --- .../de/ellpeck/actuallyadditions/mod/items/ItemBattery.java | 4 ++-- .../actuallyadditions/mod/items/lens/LensEvenMoarDeath.java | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBattery.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBattery.java index 4caa4a4da..508c9f0a6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBattery.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBattery.java @@ -59,12 +59,12 @@ public class ItemBattery extends ItemEnergy{ Item item = slot.getItem(); if(item instanceof IEnergyContainerItem){ - received = ((IEnergyContainerItem)item).receiveEnergy(slot, this.getEnergyStored(stack), false); + received = ((IEnergyContainerItem)item).receiveEnergy(slot, this.extractEnergy(stack, Integer.MAX_VALUE, true), false); } else if(ActuallyAdditions.teslaLoaded && slot.hasCapability(TeslaUtil.teslaConsumer, null)){ ITeslaConsumer cap = slot.getCapability(TeslaUtil.teslaConsumer, null); if(cap != null){ - received = (int)cap.givePower(this.getEnergyStored(stack), false); + received = (int)cap.givePower(this.extractEnergy(stack, Integer.MAX_VALUE, true), false); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensEvenMoarDeath.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensEvenMoarDeath.java index 5852b85f5..cc16f52c7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensEvenMoarDeath.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensEvenMoarDeath.java @@ -13,6 +13,9 @@ package de.ellpeck.actuallyadditions.mod.items.lens; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.mod.util.ModUtil; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.world.WorldServer; +import net.minecraftforge.common.util.FakePlayer; +import net.minecraftforge.common.util.FakePlayerFactory; import net.minecraftforge.fml.relauncher.ReflectionHelper; public class LensEvenMoarDeath extends LensDeath{ @@ -20,6 +23,9 @@ public class LensEvenMoarDeath extends LensDeath{ @Override protected void onAttacked(EntityLivingBase entity, IAtomicReconstructor tile){ try{ + FakePlayer fake = FakePlayerFactory.getMinecraft((WorldServer)tile.getWorldObject()); + ReflectionHelper.setPrivateValue(EntityLivingBase.class, entity, fake, 36); + ReflectionHelper.setPrivateValue(EntityLivingBase.class, entity, 100, 37); } catch(Exception e){