Skip to content

Commit

Permalink
Fix cartography window
Browse files Browse the repository at this point in the history
  • Loading branch information
NichtStudioCode committed Apr 23, 2024
1 parent 000256f commit 54ce310
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class CartographyInventoryImpl extends CartographyTableMenu implements Cartograp
);

private final ResultContainer resultContainer = ReflectionUtils.getFieldValue(RESULT_CONTAINER_FIELD, this);
private final Component title;
private final CraftInventoryView view;
private final ServerPlayer player;

Expand All @@ -47,7 +46,7 @@ public CartographyInventoryImpl(ServerPlayer player, Component title) {
super(player.nextContainerCounter(), player.getInventory(), ContainerLevelAccess.create(player.level(), new BlockPos(0, 0, 0)));

this.player = player;
this.title = title;
setTitle(title);
CraftInventoryCartography inventory = new CraftInventoryCartography(container, resultContainer);
view = new CraftInventoryView(player.getBukkitEntity(), inventory, this);
}
Expand All @@ -62,7 +61,7 @@ public void open() {
player.containerMenu = this;

// send open packet
player.connection.send(new ClientboundOpenScreenPacket(containerId, MenuType.CARTOGRAPHY_TABLE, title));
player.connection.send(new ClientboundOpenScreenPacket(containerId, MenuType.CARTOGRAPHY_TABLE, getTitle()));

// send initial items
NonNullList<ItemStack> itemsList = NonNullList.of(ItemStack.EMPTY, getItem(0), getItem(1), getItem(2));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class CartographyInventoryImpl extends CartographyTableMenu implements Cartograp
);

private final ResultContainer resultContainer = ReflectionUtils.getFieldValue(RESULT_CONTAINER_FIELD, this);
private final Component title;
private final CraftInventoryView view;
private final ServerPlayer player;

Expand All @@ -47,7 +46,7 @@ public CartographyInventoryImpl(ServerPlayer player, Component title) {
super(player.nextContainerCounter(), player.getInventory(), ContainerLevelAccess.create(player.level(), new BlockPos(0, 0, 0)));

this.player = player;
this.title = title;
setTitle(title);
CraftInventoryCartography inventory = new CraftInventoryCartography(container, resultContainer);
view = new CraftInventoryView(player.getBukkitEntity(), inventory, this);
}
Expand All @@ -62,7 +61,7 @@ public void open() {
player.containerMenu = this;

// send open packet
player.connection.send(new ClientboundOpenScreenPacket(containerId, MenuType.CARTOGRAPHY_TABLE, title));
player.connection.send(new ClientboundOpenScreenPacket(containerId, MenuType.CARTOGRAPHY_TABLE, getTitle()));

// send initial items
NonNullList<ItemStack> itemsList = NonNullList.of(ItemStack.EMPTY, getItem(0), getItem(1), getItem(2));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class CartographyInventoryImpl extends CartographyTableMenu implements Cartograp
);

private final ResultContainer resultContainer = ReflectionUtils.getFieldValue(RESULT_CONTAINER_FIELD, this);
private final Component title;
private final CraftInventoryView view;
private final ServerPlayer player;

Expand All @@ -47,7 +46,7 @@ public CartographyInventoryImpl(ServerPlayer player, Component title) {
super(player.nextContainerCounter(), player.getInventory(), ContainerLevelAccess.create(player.level(), new BlockPos(0, 0, 0)));

this.player = player;
this.title = title;
setTitle(title);
CraftInventoryCartography inventory = new CraftInventoryCartography(container, resultContainer);
view = new CraftInventoryView(player.getBukkitEntity(), inventory, this);
}
Expand All @@ -62,7 +61,7 @@ public void open() {
player.containerMenu = this;

// send open packet
player.connection.send(new ClientboundOpenScreenPacket(containerId, MenuType.CARTOGRAPHY_TABLE, title));
player.connection.send(new ClientboundOpenScreenPacket(containerId, MenuType.CARTOGRAPHY_TABLE, getTitle()));

// send initial items
NonNullList<ItemStack> itemsList = NonNullList.of(ItemStack.EMPTY, getItem(0), getItem(1), getItem(2));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class CartographyInventoryImpl extends CartographyTableMenu implements Cartograp
);

private final ResultContainer resultContainer = ReflectionUtils.getFieldValue(RESULT_CONTAINER_FIELD, this);
private final Component title;
private final CraftInventoryView view;
private final ServerPlayer player;

Expand All @@ -47,7 +46,7 @@ public CartographyInventoryImpl(ServerPlayer player, Component title) {
super(player.nextContainerCounter(), player.getInventory(), ContainerLevelAccess.create(player.level(), new BlockPos(0, 0, 0)));

this.player = player;
this.title = title;
setTitle(title);
CraftInventoryCartography inventory = new CraftInventoryCartography(container, resultContainer);
view = new CraftInventoryView(player.getBukkitEntity(), inventory, this);
}
Expand All @@ -62,7 +61,7 @@ public void open() {
player.containerMenu = this;

// send open packet
player.connection.send(new ClientboundOpenScreenPacket(containerId, MenuType.CARTOGRAPHY_TABLE, title));
player.connection.send(new ClientboundOpenScreenPacket(containerId, MenuType.CARTOGRAPHY_TABLE, getTitle()));

// send initial items
NonNullList<ItemStack> itemsList = NonNullList.of(ItemStack.EMPTY, getItem(0), getItem(1), getItem(2));
Expand Down

0 comments on commit 54ce310

Please sign in to comment.