Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/main/java/forestry/core/inventory/ItemInventory.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,18 @@ private void setUID() {
public boolean isParentItemEquipped() {
return switch (location.type()) {
case HELD_BY_PLAYER, UNKNOWN -> isSameItemInventory(player.getCurrentEquippedItem(), parent);
case PLAYER_INVENTORY -> true;
case PLAYER_INVENTORY -> isSameItemInventory(player.inventory.getStackInSlot(location.slotIdx()), parent);
};
}

public EntityPlayer getPlayer() {
return player;
}

public ItemLocation getLocation() {
return location;
}

public boolean isParentItemInventory(ItemStack itemStack) {
ItemStack parent = getParent();
return isSameItemInventory(parent, itemStack);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/forestry/core/items/ItemWithGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer
}

protected void openGui(EntityPlayer entityplayer) {
GuiHandler.openGui(entityplayer, this);
GuiHandler.openGui(entityplayer, this, (short) 0, entityplayer.inventory.currentItem);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ public ItemInventoryBackpackPaged(EntityPlayer player, int size, ItemStack items

@Override
public void flipPage(EntityPlayer player, short page) {
GuiHandler.openGui(player, backpackNaturalist, page);
ItemLocation loc = getLocation();
if (loc.type() == ItemLocation.Type.PLAYER_INVENTORY) {
GuiHandler.openGui(player, backpackNaturalist, page, loc.slotIdx());
} else {
GuiHandler.openGui(player, backpackNaturalist, page);
}
}
}
2 changes: 1 addition & 1 deletion src/main/java/forestry/storage/items/ItemBackpack.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public boolean getShareTag() {

@Override
protected void openGui(EntityPlayer entityplayer) {
GuiHandler.openGui(entityplayer, this, (short) type.ordinal());
GuiHandler.openGui(entityplayer, this, (short) type.ordinal(), entityplayer.inventory.currentItem);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public ItemBackpackNaturalist(ISpeciesRoot speciesRoot, IBackpackDefinition defi

@Override
protected void openGui(EntityPlayer entityplayer) {
GuiHandler.openGui(entityplayer, this);
GuiHandler.openGui(entityplayer, this, (short) 0, entityplayer.inventory.currentItem);
}

@Override
Expand Down