mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-25 14:34:28 +00:00
Clean up pick block handling (see SleepyTrousers/EnderCore@77daaed)
This commit is contained in:
1 parent
a6631e2cac
commit
89b379b9c7
4 files changed
+9
-28
No files matched your search
@@ -130,19 +130,6 @@ public class BlockBuffer extends AbstractMachineBlock<TileBuffer> implements IFa
|
||||
return meta;
|
||||
}
|
||||
|
||||
// TODO refactor machines so all have this functionality
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
return createDrop((TileBuffer) world.getTileEntity(x, y, z));
|
||||
}
|
||||
|
||||
private ItemStack createDrop(TileBuffer te) {
|
||||
ItemStack stack = new ItemStack(this, 1, BlockItemBuffer.Type.get(te).ordinal());
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
te.writeCommon(stack.stackTagCompound);
|
||||
return stack;
|
||||
}
|
||||
|
||||
public ItemStack createItemStackForSourceBlock(ItemStack machine, Block block, int sourceMeta) {
|
||||
PainterUtil.setSourceBlock(machine, block, sourceMeta);
|
||||
return machine;
|
||||
|
||||
@@ -42,9 +42,9 @@ public class BlockItemBuffer extends ItemBlockWithMetadata {
|
||||
return "tile." + ModObject.blockBuffer.unlocalisedName + "." + name().toLowerCase(Locale.US);
|
||||
}
|
||||
|
||||
public static ItemStack getStack(Type type) {
|
||||
return new ItemStack(EnderIO.blockBuffer, 1, type.ordinal());
|
||||
}
|
||||
public static ItemStack getStack(Type type) {
|
||||
return new ItemStack(EnderIO.blockBuffer, 1, type.ordinal());
|
||||
}
|
||||
}
|
||||
|
||||
public BlockItemBuffer(Block block) {
|
||||
|
||||
@@ -78,6 +78,12 @@ public class TileBuffer extends AbstractPowerConsumerEntity implements IPaintabl
|
||||
dist.neighboursChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToItemStack(ItemStack stack) {
|
||||
super.writeToItemStack(stack);
|
||||
stack.setItemDamage(BlockItemBuffer.Type.get(this).ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack var2, int side) {
|
||||
|
||||
@@ -6,7 +6,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@@ -19,7 +18,6 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.BlockEio;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.TileEntityEio;
|
||||
import crazypants.enderio.api.redstone.IRedstoneConnectable;
|
||||
|
||||
public class BlockElectricLight extends BlockEio implements IRedstoneConnectable {
|
||||
@@ -201,16 +199,6 @@ public class BlockElectricLight extends BlockEio implements IRedstoneConnectable
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
ItemStack stack = new ItemStack(this);
|
||||
if(te instanceof TileElectricLight) {
|
||||
processDrop(world, x, y, z, (TileEntityEio) te, stack);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
/* IRedstoneConnectable */
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user