Added a small amount of Alchemy Array infrastructure.

This commit is contained in:
WayofTime 2016-06-28 13:35:42 -04:00
parent fdaa32af0c
commit 707be222f5
3 changed files with 29 additions and 1 deletions

View file

@ -2,8 +2,12 @@ package WayofTime.bloodmagic.api.alchemyCrafting;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
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.math.BlockPos;
import net.minecraft.world.World;
@RequiredArgsConstructor
public abstract class AlchemyArrayEffect
@ -18,4 +22,9 @@ public abstract class AlchemyArrayEffect
public abstract void readFromNBT(NBTTagCompound tag);
public abstract AlchemyArrayEffect getNewCopy();
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity)
{
}
}

View file

@ -44,6 +44,16 @@ public class BlockAlchemyArray extends BlockContainer
// No-op
}
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity)
{
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileAlchemyArray)
{
((TileAlchemyArray) tile).onEntityCollidedWithBlock(state, entity);
}
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{

View file

@ -1,6 +1,7 @@
package WayofTime.bloodmagic.tile;
import net.minecraft.inventory.InventoryHelper;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
@ -21,6 +22,14 @@ public class TileAlchemyArray extends TileInventory implements ITickable
super(2, "alchemyArray");
}
public void onEntityCollidedWithBlock(IBlockState state, Entity entity)
{
if (arrayEffect != null)
{
arrayEffect.onEntityCollidedWithBlock(worldObj, pos, state, entity);
}
}
@Override
public void readFromNBT(NBTTagCompound tagCompound)
{