mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-26 04:59:23 +01:00
Closes #1178
This commit is contained in:
parent
e4aa4a3b0b
commit
1cca640345
4 changed files with 34 additions and 45 deletions
|
@ -27,6 +27,7 @@ public interface IEnergyTile{
|
|||
|
||||
int getZ();
|
||||
|
||||
//TODO: Rename to getWorld
|
||||
World getWorldObject();
|
||||
|
||||
void extractEnergy(int amount);
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
* This file ("LensEvenMoarDeath.java") is part of the Actually Additions mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2015-2017 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.items.lens;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
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{
|
||||
|
||||
@Override
|
||||
protected void onAttacked(EntityLivingBase entity, IAtomicReconstructor tile){
|
||||
if(tile.getWorldObject() instanceof WorldServer){
|
||||
try{
|
||||
FakePlayer fake = FakePlayerFactory.getMinecraft((WorldServer)tile.getWorldObject());
|
||||
ReflectionHelper.setPrivateValue(EntityLivingBase.class, entity, fake, 37);
|
||||
|
||||
ReflectionHelper.setPrivateValue(EntityLivingBase.class, entity, 100, 38);
|
||||
}
|
||||
catch(Exception e){
|
||||
ActuallyAdditions.LOGGER.error("A Damage Lens at "+tile.getX()+", "+tile.getY()+", "+tile.getZ()+" in World "+tile.getWorldObject().provider.getDimension()+" threw an Exception! Don't let that happen again!", e);
|
||||
}
|
||||
}
|
||||
|
||||
super.onAttacked(entity, tile);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getUsePerEntity(){
|
||||
return 2500;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* This file ("LensEvenMoarDeath.java") is part of the Actually Additions mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2015-2017 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.items.lens;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.util.FakePlayerFactory;
|
||||
|
||||
public class LensKiller extends LensDeath {
|
||||
|
||||
@Override
|
||||
protected void onAttacked(EntityLivingBase entity, IAtomicReconstructor tile) {
|
||||
if (!tile.getWorldObject().isRemote) {
|
||||
entity.attackEntityFrom(DamageSource.causePlayerDamage(FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject())), 20);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getUsePerEntity() {
|
||||
return 2500;
|
||||
}
|
||||
}
|
|
@ -19,7 +19,7 @@ public final class Lenses{
|
|||
ActuallyAdditionsAPI.lensDefaultConversion = new LensConversion();
|
||||
ActuallyAdditionsAPI.lensDetonation = new LensDetonation();
|
||||
ActuallyAdditionsAPI.lensDeath = new LensDeath();
|
||||
ActuallyAdditionsAPI.lensEvenMoarDeath = new LensEvenMoarDeath();
|
||||
ActuallyAdditionsAPI.lensEvenMoarDeath = new LensKiller();
|
||||
ActuallyAdditionsAPI.lensColor = new LensColor();
|
||||
ActuallyAdditionsAPI.lensDisruption = new LensDisruption();
|
||||
ActuallyAdditionsAPI.lensDisenchanting = new LensDisenchanting();
|
||||
|
|
Loading…
Reference in a new issue