Search in sources :

Example 1 with Frequency

use of com.simibubi.create.content.logistics.RedstoneLinkNetworkHandler.Frequency in project Create by Creators-of-Create.

the class LinkedControllerBindPacket method handleItem.

@Override
protected void handleItem(ServerPlayer player, ItemStack heldItem) {
    if (player.isSpectator())
        return;
    ItemStackHandler frequencyItems = LinkedControllerItem.getFrequencyItems(heldItem);
    LinkBehaviour linkBehaviour = TileEntityBehaviour.get(player.level, linkLocation, LinkBehaviour.TYPE);
    if (linkBehaviour == null)
        return;
    Pair<Frequency, Frequency> pair = linkBehaviour.getNetworkKey();
    frequencyItems.setStackInSlot(button * 2, pair.getKey().getStack().copy());
    frequencyItems.setStackInSlot(button * 2 + 1, pair.getValue().getStack().copy());
    heldItem.getTag().put("Items", frequencyItems.serializeNBT());
}
Also used : LinkBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.linked.LinkBehaviour) ItemStackHandler(net.minecraftforge.items.ItemStackHandler) Frequency(com.simibubi.create.content.logistics.RedstoneLinkNetworkHandler.Frequency)

Aggregations

Frequency (com.simibubi.create.content.logistics.RedstoneLinkNetworkHandler.Frequency)1 LinkBehaviour (com.simibubi.create.foundation.tileEntity.behaviour.linked.LinkBehaviour)1 ItemStackHandler (net.minecraftforge.items.ItemStackHandler)1