Files
TinkersConstruct/src/main/java/tconstruct/tools/entity/FancyEntityItem.java
T
unix-supremacistandAlex Ponebshek 3e2ba6ac16 adding the config options from the tinkered constructor fork (#73)
* config option for invulnerability of dropped tools and base EntityItem despawn time

* config option to drop life canisters on death

* Added config option for dagger damage multiplier when thrown, default = 3x

* emulate vanilla behavior by default

---------

Co-authored-by: Alex Ponebshek <alexbobp@gmail.com>
2023-02-12 08:37:14 +01:00

54 lines
1.8 KiB
Java

package tconstruct.tools.entity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import tconstruct.util.config.PHConstruct;
public class FancyEntityItem extends EntityItem {
public FancyEntityItem(World par1World, double par2, double par4, double par6) {
super(par1World, par2, par4, par6);
if (PHConstruct.indestructible) {
this.isImmuneToFire = true;
this.lifespan = 72000;
}
}
public FancyEntityItem(World par1World, double par2, double par4, double par6, ItemStack par8ItemStack) {
this(par1World, par2, par4, par6);
this.setEntityItemStack(par8ItemStack);
this.lifespan = (par8ItemStack.getItem() == null ? 6000
: par8ItemStack.getItem().getEntityLifespan(par8ItemStack, par1World));
}
public FancyEntityItem(World par1World) {
super(par1World);
if (PHConstruct.indestructible) {
this.isImmuneToFire = true;
this.lifespan = 72000;
}
}
public FancyEntityItem(World world, Entity original, ItemStack stack) {
this(world, original.posX, original.posY, original.posZ);
this.delayBeforeCanPickup = 20;
this.motionX = original.motionX;
this.motionY = original.motionY;
this.motionZ = original.motionZ;
this.setEntityItemStack(stack);
}
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) {
if (PHConstruct.indestructible) {
if (par1DamageSource.getDamageType().equals("outOfWorld")) return true;
return false;
} else {
return super.attackEntityFrom(par1DamageSource, par2);
}
}
}