From 707be222f5bdf52742486217b8928d42e52c0563 Mon Sep 17 00:00:00 2001 From: WayofTime Date: Tue, 28 Jun 2016 13:35:42 -0400 Subject: [PATCH] Added a small amount of Alchemy Array infrastructure. --- .../api/alchemyCrafting/AlchemyArrayEffect.java | 9 +++++++++ .../WayofTime/bloodmagic/block/BlockAlchemyArray.java | 10 ++++++++++ .../WayofTime/bloodmagic/tile/TileAlchemyArray.java | 11 ++++++++++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/main/java/WayofTime/bloodmagic/api/alchemyCrafting/AlchemyArrayEffect.java b/src/main/java/WayofTime/bloodmagic/api/alchemyCrafting/AlchemyArrayEffect.java index 0e2641c9..080dceb8 100644 --- a/src/main/java/WayofTime/bloodmagic/api/alchemyCrafting/AlchemyArrayEffect.java +++ b/src/main/java/WayofTime/bloodmagic/api/alchemyCrafting/AlchemyArrayEffect.java @@ -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) + { + + } } diff --git a/src/main/java/WayofTime/bloodmagic/block/BlockAlchemyArray.java b/src/main/java/WayofTime/bloodmagic/block/BlockAlchemyArray.java index 71542c78..2f998424 100644 --- a/src/main/java/WayofTime/bloodmagic/block/BlockAlchemyArray.java +++ b/src/main/java/WayofTime/bloodmagic/block/BlockAlchemyArray.java @@ -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) { diff --git a/src/main/java/WayofTime/bloodmagic/tile/TileAlchemyArray.java b/src/main/java/WayofTime/bloodmagic/tile/TileAlchemyArray.java index 135885e7..0ceee1ad 100644 --- a/src/main/java/WayofTime/bloodmagic/tile/TileAlchemyArray.java +++ b/src/main/java/WayofTime/bloodmagic/tile/TileAlchemyArray.java @@ -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) {