Merge branch 'server-inventory' of https://github.com/GeyserMC/Geyser into server-inventory

This commit is contained in:
Camotoy 2021-03-12 11:51:48 -05:00
commit d4c21bb74c
No known key found for this signature in database
GPG key ID: 7EEFB66FE798081F

View file

@ -44,6 +44,7 @@ import org.geysermc.connector.inventory.GeyserItemStack;
import org.geysermc.connector.inventory.Inventory; import org.geysermc.connector.inventory.Inventory;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.inventory.BedrockContainerSlot; import org.geysermc.connector.network.translators.inventory.BedrockContainerSlot;
import org.geysermc.connector.network.translators.inventory.SlotType;
import org.geysermc.connector.network.translators.inventory.updater.UIInventoryUpdater; import org.geysermc.connector.network.translators.inventory.updater.UIInventoryUpdater;
import org.geysermc.connector.network.translators.item.translators.BannerTranslator; import org.geysermc.connector.network.translators.item.translators.BannerTranslator;
@ -144,7 +145,7 @@ public class LoomInventoryTranslator extends AbstractBlockInventoryTranslator {
ClientClickWindowButtonPacket packet = new ClientClickWindowButtonPacket(inventory.getId(), index); ClientClickWindowButtonPacket packet = new ClientClickWindowButtonPacket(inventory.getId(), index);
session.sendDownstreamPacket(packet); session.sendDownstreamPacket(packet);
GeyserItemStack inputCopy = inventory.getItem(0).copy(); GeyserItemStack inputCopy = inventory.getItem(0).copy(1);
inputCopy.setNetId(session.getNextItemNetId()); inputCopy.setNetId(session.getNextItemNetId());
// Add the pattern manually, for better item synchronization // Add the pattern manually, for better item synchronization
if (inputCopy.getNbt() == null) { if (inputCopy.getNbt() == null) {
@ -219,4 +220,12 @@ public class LoomInventoryTranslator extends AbstractBlockInventoryTranslator {
} }
return super.javaSlotToBedrock(slot); return super.javaSlotToBedrock(slot);
} }
@Override
public SlotType getSlotType(int javaSlot) {
if (javaSlot == 3) {
return SlotType.OUTPUT;
}
return super.getSlotType(javaSlot);
}
} }