diff options
author | draknyte1 <draknyte1@hotmail.com> | 2017-02-02 10:42:04 +1000 |
---|---|---|
committer | draknyte1 <draknyte1@hotmail.com> | 2017-02-02 10:42:04 +1000 |
commit | 2a688e006c07c1240966c2829906a1752031153c (patch) | |
tree | 67468ecacaa6e77ec2581532e2fe96fcced6b39c /src/Java/powercrystals/minefactoryreloaded/api/ReplacementBlock.java | |
parent | 233ee8c9a0a1c72953cfa6f7f5a439f2859daaf1 (diff) | |
download | GT5-Unofficial-2a688e006c07c1240966c2829906a1752031153c.tar.gz GT5-Unofficial-2a688e006c07c1240966c2829906a1752031153c.tar.bz2 GT5-Unofficial-2a688e006c07c1240966c2829906a1752031153c.zip |
+ Added a check for BuildCraft.
% Changed handling of Wrench interfaces for the Workbench.
- Removed classes I borrowed from MFR. (useless)
- Removed Psychedelicraft support. (useless)
Diffstat (limited to 'src/Java/powercrystals/minefactoryreloaded/api/ReplacementBlock.java')
-rw-r--r-- | src/Java/powercrystals/minefactoryreloaded/api/ReplacementBlock.java | 135 |
1 files changed, 0 insertions, 135 deletions
diff --git a/src/Java/powercrystals/minefactoryreloaded/api/ReplacementBlock.java b/src/Java/powercrystals/minefactoryreloaded/api/ReplacementBlock.java deleted file mode 100644 index c67e8a39a2..0000000000 --- a/src/Java/powercrystals/minefactoryreloaded/api/ReplacementBlock.java +++ /dev/null @@ -1,135 +0,0 @@ -package powercrystals.minefactoryreloaded.api; - -import net.minecraft.block.Block; -import net.minecraft.item.*; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -public class ReplacementBlock -{ - protected byte _hasMeta; - protected int _meta; - protected final Block _block; - protected final NBTTagCompound _tileTag; - - /** - * Called to replace a block in the world. - * @param world The world object - * @param x The X coord - * @param y The Y coord - * @param z The Z coord - * @param stack The ItemStack being used to replace the block (may be null) - * @return True if the block was set successfully - */ - public boolean replaceBlock(World world, int x, int y, int z, ItemStack stack) - { - int meta = getMeta(world, x, y, z, stack); - if (world.setBlock(x, y, z, _block, meta, 3)) - { - if (hasTag(stack) && _block.hasTileEntity(meta)) - { - TileEntity tile = world.getTileEntity(x, y, z); - if (tile != null) - tile.readFromNBT(getTag(world, x, y, z, stack)); - } - return true; - } - return false; - } - - /** - * Called to get the metadata of the replacement block in the world. - * @param world The world object - * @param x The X coord - * @param y The Y coord - * @param z The Z coord - * @param stack The ItemStack being used to replace the block (may be null) - * @return The metadata of the block - */ - protected int getMeta(World world, int x, int y, int z, ItemStack stack) - { - int m = 0; - if (_hasMeta > 0) - { - if (_hasMeta > 1) - return _meta; - m = stack.getItemDamage(); - Item item = stack.getItem(); - if (item instanceof ItemBlock) - m = ((ItemBlock)item).getMetadata(m); - } - return m; - } - - /** - * Called to set the metdata of this ReplacementBlock to a fixed value - * @param meta The metadata of the block - * @return This instance - */ - public ReplacementBlock setMeta(int meta) - { - if (meta >= 0) - { - _hasMeta = 2; - _meta = meta; - } - return this; - } - - /** - * Called to set the metdata of this ReplacementBlock to a value read from an ItemStack - * @param meta The metadata of the block - * @return This instance - */ - public ReplacementBlock setMeta(boolean hasMeta) - { - _hasMeta = (byte) (hasMeta ? 1 : 0); - return this; - } - - /** - * Called to get the NBTTagCompound a TileEntity will read its state from - * @param world The world object - * @param x The X coord - * @param y The Y coord - * @param z The Z coord - * @param stack The ItemStack being used to replace the block (may be null) - * @return The NBTTagCompound a TileEntity will read its state from - */ - protected NBTTagCompound getTag(World world, int x, int y, int z, ItemStack stack) - { - return _tileTag; - } - - /** - * Called to see if a TileEntity should have its state set - * @param stack The ItemStack being used to replace the block (may be null) - * @return True if the TileEntity should have its state set - */ - protected boolean hasTag(ItemStack stack) - { - return _tileTag != null; - } - - public ReplacementBlock(Item block) - { - this(Block.getBlockFromItem(block)); - } - - public ReplacementBlock(Item block, NBTTagCompound tag) - { - this(Block.getBlockFromItem(block), tag); - } - - public ReplacementBlock(Block block) - { - this(block, null); - } - - public ReplacementBlock(Block block, NBTTagCompound tag) - { - _block = block; - _tileTag = tag; - } -} |