use of com.bluepowermod.tile.tier1.TileInsulatedWire in project BluePower by Qmunity.
the class BlockInsulatedAlloyWire method getCloneItemStack.
@Override
public ItemStack getCloneItemStack(IBlockReader world, BlockPos pos, BlockState state) {
TileEntity tileentity = world.getBlockEntity(pos);
ItemStack stack = ItemStack.EMPTY;
if (tileentity instanceof TileBPMultipart) {
tileentity = ((TileBPMultipart) tileentity).getTileForState(state);
}
if (tileentity instanceof TileInsulatedWire) {
CompoundNBT nbt = new CompoundNBT();
nbt.putString("color", ((TileInsulatedWire) tileentity).getColor().name());
stack = new ItemStack(this, 1, nbt);
}
return stack;
}
use of com.bluepowermod.tile.tier1.TileInsulatedWire in project BluePower by Qmunity.
the class ItemPaintBrush method useOn.
@Override
public ActionResultType useOn(ItemUseContext context) {
TileEntity tile = context.getLevel().getBlockEntity(context.getClickedPos());
boolean changed = false;
if (tile instanceof TileInsulatedWire) {
changed = ((TileInsulatedWire) tile).setColor(color);
if (changed && context.getPlayer() != null)
context.getPlayer().setItemInHand(context.getHand(), new ItemStack(BPItems.paint_brush.get(0)));
}
return super.useOn(context);
}
use of com.bluepowermod.tile.tier1.TileInsulatedWire in project BluePower by Qmunity.
the class BlockInsulatedAlloyWire method getDrops.
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
TileEntity tileentity = builder.getParameter(LootParameters.BLOCK_ENTITY);
List<ItemStack> itemStacks = new ArrayList<>();
if (tileentity instanceof TileBPMultipart) {
tileentity = ((TileBPMultipart) tileentity).getTileForState(state);
}
if (tileentity instanceof TileInsulatedWire) {
CompoundNBT nbt = new CompoundNBT();
nbt.putString("color", ((TileInsulatedWire) tileentity).getColor().name());
ItemStack stack = new ItemStack(this, 1, nbt);
itemStacks.add(stack);
}
return itemStacks;
}
Aggregations