Search in sources :

Example 1 with TileInsulatedWire

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;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) CompoundNBT(net.minecraft.nbt.CompoundNBT) TileInsulatedWire(com.bluepowermod.tile.tier1.TileInsulatedWire) TileBPMultipart(com.bluepowermod.tile.TileBPMultipart) ItemStack(net.minecraft.item.ItemStack)

Example 2 with TileInsulatedWire

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);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileInsulatedWire(com.bluepowermod.tile.tier1.TileInsulatedWire) ItemStack(net.minecraft.item.ItemStack)

Example 3 with TileInsulatedWire

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;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) CompoundNBT(net.minecraft.nbt.CompoundNBT) TileInsulatedWire(com.bluepowermod.tile.tier1.TileInsulatedWire) ArrayList(java.util.ArrayList) TileBPMultipart(com.bluepowermod.tile.TileBPMultipart) ItemStack(net.minecraft.item.ItemStack)

Aggregations

TileInsulatedWire (com.bluepowermod.tile.tier1.TileInsulatedWire)3 ItemStack (net.minecraft.item.ItemStack)3 TileEntity (net.minecraft.tileentity.TileEntity)3 TileBPMultipart (com.bluepowermod.tile.TileBPMultipart)2 CompoundNBT (net.minecraft.nbt.CompoundNBT)2 ArrayList (java.util.ArrayList)1