mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-12-29 15:49:09 +01:00
Fix crafting output not updating sometimes (#4692)
* Only cancel crafting grid future if slot == 0 * Add some comments
This commit is contained in:
parent
cb0488a271
commit
3570caae25
1 changed files with 8 additions and 4 deletions
|
@ -71,10 +71,6 @@ public class JavaContainerSetSlotTranslator extends PacketTranslator<Clientbound
|
|||
|
||||
InventoryTranslator translator = session.getInventoryTranslator();
|
||||
if (translator != null) {
|
||||
if (session.getCraftingGridFuture() != null) {
|
||||
session.getCraftingGridFuture().cancel(false);
|
||||
}
|
||||
|
||||
int slot = packet.getSlot();
|
||||
if (slot >= inventory.getSize()) {
|
||||
GeyserLogger logger = session.getGeyser().getLogger();
|
||||
|
@ -111,14 +107,22 @@ public class JavaContainerSetSlotTranslator extends PacketTranslator<Clientbound
|
|||
* Checks for a changed output slot in the crafting grid, and ensures Bedrock sees the recipe.
|
||||
*/
|
||||
private static void updateCraftingGrid(GeyserSession session, int slot, ItemStack item, Inventory inventory, InventoryTranslator translator) {
|
||||
// Check if it's the crafting grid result slot.
|
||||
if (slot != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if there is any crafting grid.
|
||||
int gridSize = translator.getGridSize();
|
||||
if (gridSize == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Only process the most recent crafting grid result, and cancel the previous one.
|
||||
if (session.getCraftingGridFuture() != null) {
|
||||
session.getCraftingGridFuture().cancel(false);
|
||||
}
|
||||
|
||||
if (InventoryUtils.isEmpty(item)) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue