Fixed lenses of the killer not dropping player drops

Fixed batteries dupe bug
This commit is contained in:
Ellpeck 2016-11-23 18:38:13 +01:00
parent 483d20ff99
commit 691747d2f3
2 changed files with 8 additions and 2 deletions

View file

@ -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);
}
}

View file

@ -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){