Fixed server sided issue with Attractor Array

Added Movement Array, and helped generalize the Arrays a bit more
This commit is contained in:
WayofTime 2016-06-29 07:43:04 -04:00
parent 22c1f0db55
commit 1836fc742d
11 changed files with 130 additions and 13 deletions

View file

@ -56,6 +56,11 @@ public class AlchemyArrayEffectAttractor extends AlchemyArrayEffect
@Override
public boolean update(TileEntity tile, int ticksActive)
{
if (tile.getWorld().isRemote)
{
return false;
}
BlockPos pos = tile.getPos();
counter++;
if (counter < 10)

View file

@ -1,8 +1,14 @@
package WayofTime.bloodmagic.alchemyArray;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import WayofTime.bloodmagic.api.alchemyCrafting.AlchemyArrayEffect;
import WayofTime.bloodmagic.api.iface.IAlchemyArray;
public class AlchemyArrayEffectMovement extends AlchemyArrayEffect
{
@ -17,6 +23,46 @@ public class AlchemyArrayEffectMovement extends AlchemyArrayEffect
return false;
}
@Override
public void onEntityCollidedWithBlock(IAlchemyArray array, World world, BlockPos pos, IBlockState state, Entity entity)
{
double motionY = 0.5;
double speed = 3;
EnumFacing direction = array.getRotation();
entity.motionY = motionY;
entity.fallDistance = 0;
switch (direction)
{
case NORTH:
entity.motionX = 0;
entity.motionY = motionY;
entity.motionZ = -speed;
break;
case SOUTH:
entity.motionX = 0;
entity.motionY = motionY;
entity.motionZ = speed;
break;
case WEST:
entity.motionX = -speed;
entity.motionY = motionY;
entity.motionZ = 0;
break;
case EAST:
entity.motionX = speed;
entity.motionY = motionY;
entity.motionZ = 0;
break;
default:
break;
}
}
@Override
public void writeToNBT(NBTTagCompound tag)
{