Skip to content

Commit

Permalink
rename "clipboard" data component to "clipboard_content"
Browse files Browse the repository at this point in the history
  • Loading branch information
IchHabeHunger54 committed Jul 18, 2024
1 parent c6ee902 commit c7fa5e7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class ClipboardScreen extends Screen {
public ClipboardScreen(ItemStack stack) {
super(stack.getHoverName());
this.stack = stack;
this.data = stack.get(BCDataComponents.CLIPBOARD);
this.data = stack.get(BCDataComponents.CLIPBOARD_CONTENT);
}

@Override
Expand Down Expand Up @@ -93,7 +93,7 @@ public void renderBackground(GuiGraphics graphics, int mouseX, int mouseY, float
}

private void close() {
stack.set(BCDataComponents.CLIPBOARD, data);
stack.set(BCDataComponents.CLIPBOARD_CONTENT, data);
PacketDistributor.sendToServer(new ClipboardItemSyncPacket(data));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.minecraftschurlimods.bibliocraft.content.clipboard;

import com.github.minecraftschurlimods.bibliocraft.init.BCDataComponents;
import com.github.minecraftschurlimods.bibliocraft.util.ClientUtil;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
Expand All @@ -12,7 +13,7 @@

public class ClipboardItem extends Item {
public ClipboardItem() {
super(new Properties().stacksTo(1));
super(new Properties().stacksTo(1).component(BCDataComponents.CLIPBOARD_CONTENT.get(), ClipboardContent.DEFAULT));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static void handle(ClipboardItemSyncPacket packet, IPayloadContext contex
stack = player.getOffhandItem();
if (!stack.is(BCItems.CLIPBOARD)) return;
}
stack.set(BCDataComponents.CLIPBOARD, packet.content);
stack.set(BCDataComponents.CLIPBOARD_CONTENT, packet.content);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.util.function.Supplier;

public interface BCDataComponents {
Supplier<DataComponentType<ClipboardContent>> CLIPBOARD = BCRegistries.DATA_COMPONENTS.register("clipboard", () -> DataComponentType.<ClipboardContent>builder().persistent(ClipboardContent.CODEC).networkSynchronized(ClipboardContent.STREAM_CODEC).build());
Supplier<DataComponentType<ClipboardContent>> CLIPBOARD_CONTENT = BCRegistries.DATA_COMPONENTS.register("clipboard_content", () -> DataComponentType.<ClipboardContent>builder().persistent(ClipboardContent.CODEC).networkSynchronized(ClipboardContent.STREAM_CODEC).build());

/**
* Empty method, called by {@link BCRegistries#init(net.neoforged.bus.api.IEventBus)} to classload this class.
Expand Down

0 comments on commit c7fa5e7

Please sign in to comment.