BloodMagic/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectBounce.java

52 lines
1.4 KiB
Java
Raw Normal View History

package WayofTime.bloodmagic.alchemyArray;
2017-08-15 21:30:48 -07:00
import WayofTime.bloodmagic.api.alchemyCrafting.AlchemyArrayEffect;
import WayofTime.bloodmagic.api.iface.IAlchemyArray;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
2017-08-15 21:30:48 -07:00
public class AlchemyArrayEffectBounce extends AlchemyArrayEffect {
public AlchemyArrayEffectBounce(String key) {
super(key);
}
@Override
2017-08-15 21:30:48 -07:00
public boolean update(TileEntity tile, int ticksActive) {
return false;
}
@Override
2017-08-15 21:30:48 -07:00
public void onEntityCollidedWithBlock(IAlchemyArray array, World world, BlockPos pos, IBlockState state, Entity entity) {
if (entity.isSneaking()) {
return;
2017-08-15 21:30:48 -07:00
} else if (entity.motionY < 0.0D) {
entity.motionY = -entity.motionY;
2017-08-15 21:30:48 -07:00
if (!(entity instanceof EntityLivingBase)) {
entity.motionY *= 0.8D;
}
entity.fallDistance = 0;
}
}
@Override
2017-08-15 21:30:48 -07:00
public void writeToNBT(NBTTagCompound tag) {
}
@Override
2017-08-15 21:30:48 -07:00
public void readFromNBT(NBTTagCompound tag) {
}
@Override
2017-08-15 21:30:48 -07:00
public AlchemyArrayEffect getNewCopy() {
return new AlchemyArrayEffectBounce(key);
}
}