2016-06-28 13:55:26 -04:00
|
|
|
package WayofTime.bloodmagic.alchemyArray;
|
|
|
|
|
2018-02-15 18:49:01 -08:00
|
|
|
import WayofTime.bloodmagic.iface.IAlchemyArray;
|
2016-06-29 07:43:04 -04:00
|
|
|
import net.minecraft.block.state.IBlockState;
|
|
|
|
import net.minecraft.entity.Entity;
|
2016-06-28 13:55:26 -04:00
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
2016-06-29 07:43:04 -04:00
|
|
|
import net.minecraft.util.EnumFacing;
|
|
|
|
import net.minecraft.util.math.BlockPos;
|
|
|
|
import net.minecraft.world.World;
|
2016-06-28 13:55:26 -04:00
|
|
|
|
2017-08-15 21:30:48 -07:00
|
|
|
public class AlchemyArrayEffectMovement extends AlchemyArrayEffect {
|
|
|
|
public AlchemyArrayEffectMovement(String key) {
|
2016-06-28 13:55:26 -04:00
|
|
|
super(key);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-08-15 21:30:48 -07:00
|
|
|
public boolean update(TileEntity tile, int ticksActive) {
|
2016-06-28 13:55:26 -04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-06-29 07:43:04 -04:00
|
|
|
@Override
|
2017-08-15 21:30:48 -07:00
|
|
|
public void onEntityCollidedWithBlock(IAlchemyArray array, World world, BlockPos pos, IBlockState state, Entity entity) {
|
2016-06-29 07:43:04 -04:00
|
|
|
double motionY = 0.5;
|
|
|
|
double speed = 3;
|
|
|
|
EnumFacing direction = array.getRotation();
|
|
|
|
|
|
|
|
entity.motionY = motionY;
|
|
|
|
entity.fallDistance = 0;
|
|
|
|
|
2017-08-15 21:30:48 -07:00
|
|
|
switch (direction) {
|
|
|
|
case NORTH:
|
|
|
|
entity.motionX = 0;
|
|
|
|
entity.motionY = motionY;
|
|
|
|
entity.motionZ = -speed;
|
|
|
|
break;
|
2016-06-29 07:43:04 -04:00
|
|
|
|
2017-08-15 21:30:48 -07:00
|
|
|
case SOUTH:
|
|
|
|
entity.motionX = 0;
|
|
|
|
entity.motionY = motionY;
|
|
|
|
entity.motionZ = speed;
|
|
|
|
break;
|
2016-06-29 07:43:04 -04:00
|
|
|
|
2017-08-15 21:30:48 -07:00
|
|
|
case WEST:
|
|
|
|
entity.motionX = -speed;
|
|
|
|
entity.motionY = motionY;
|
|
|
|
entity.motionZ = 0;
|
|
|
|
break;
|
2016-06-29 07:43:04 -04:00
|
|
|
|
2017-08-15 21:30:48 -07:00
|
|
|
case EAST:
|
|
|
|
entity.motionX = speed;
|
|
|
|
entity.motionY = motionY;
|
|
|
|
entity.motionZ = 0;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2016-06-29 07:43:04 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-28 13:55:26 -04:00
|
|
|
@Override
|
2017-08-15 21:30:48 -07:00
|
|
|
public void writeToNBT(NBTTagCompound tag) {
|
2016-06-28 13:55:26 -04:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-08-15 21:30:48 -07:00
|
|
|
public void readFromNBT(NBTTagCompound tag) {
|
2016-06-28 13:55:26 -04:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-08-15 21:30:48 -07:00
|
|
|
public AlchemyArrayEffect getNewCopy() {
|
2016-06-28 13:55:26 -04:00
|
|
|
return new AlchemyArrayEffectMovement(key);
|
|
|
|
}
|
|
|
|
}
|