Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-04 23:30:17 +01:00
More cartography parity fixes
Dieser Commit ist enthalten in:
Ursprung
370f3c18ba
Commit
e493415241
@ -357,17 +357,28 @@ public abstract class InventoryTranslator {
|
||||
if (inventory instanceof CartographyContainer) {
|
||||
// TODO add this for more inventories? Only seems to glitch out the cartography table, though.
|
||||
ConsumeStackRequestActionData consumeData = (ConsumeStackRequestActionData) action;
|
||||
|
||||
int sourceSlot = bedrockSlotToJava(consumeData.getSource());
|
||||
if (sourceSlot == 0 && inventory.getItem(1).isEmpty()) {
|
||||
// Java doesn't allow an item to be renamed; this is why CARTOGRAPHY_ADDITIONAL could remain empty for Bedrock
|
||||
// We check this during slot 0 since setting the inventory slots here messes up shouldRejectItemPlace
|
||||
if ((sourceSlot == 0 && inventory.getItem(1).isEmpty()) || (sourceSlot == 1 && inventory.getItem(0).isEmpty())) {
|
||||
// Java doesn't allow an item to be renamed; this is why one of the slots could remain empty for Bedrock
|
||||
// We check this now since setting the inventory slots here messes up shouldRejectItemPlace
|
||||
return rejectRequest(request, false);
|
||||
}
|
||||
|
||||
GeyserItemStack item = inventory.getItem(sourceSlot);
|
||||
item.setAmount(item.getAmount() - consumeData.getCount());
|
||||
if (item.isEmpty()) {
|
||||
inventory.setItem(sourceSlot, GeyserItemStack.EMPTY, session);
|
||||
if (sourceSlot == 1) {
|
||||
// Decrease the item count, but only after both slots are checked.
|
||||
// Otherwise, the slot 1 check will fail
|
||||
GeyserItemStack item = inventory.getItem(sourceSlot);
|
||||
item.setAmount(item.getAmount() - consumeData.getCount());
|
||||
if (item.isEmpty()) {
|
||||
inventory.setItem(sourceSlot, GeyserItemStack.EMPTY, session);
|
||||
}
|
||||
|
||||
GeyserItemStack itemZero = inventory.getItem(0);
|
||||
itemZero.setAmount(itemZero.getAmount() - consumeData.getCount());
|
||||
if (itemZero.isEmpty()) {
|
||||
inventory.setItem(0, GeyserItemStack.EMPTY, session);
|
||||
}
|
||||
}
|
||||
affectedSlots.add(sourceSlot);
|
||||
}
|
||||
|
@ -46,13 +46,13 @@ public class CartographyInventoryTranslator extends AbstractBlockInventoryTransl
|
||||
public boolean shouldRejectItemPlace(GeyserSession session, Inventory inventory, ContainerSlotType bedrockSourceContainer,
|
||||
int javaSourceSlot, ContainerSlotType bedrockDestinationContainer, int javaDestinationSlot) {
|
||||
if (javaDestinationSlot == 0) {
|
||||
// Bedrock Edition can use paper in slot 0
|
||||
// Bedrock Edition can use paper or an empty map in slot 0
|
||||
GeyserItemStack itemStack = javaSourceSlot == -1 ? session.getPlayerInventory().getCursor() : inventory.getItem(javaSourceSlot);
|
||||
return itemStack.getItemEntry().getJavaIdentifier().equals("minecraft:paper");
|
||||
return itemStack.getItemEntry().getJavaIdentifier().equals("minecraft:paper") || itemStack.getItemEntry().getJavaIdentifier().equals("minecraft:map");
|
||||
} else if (javaDestinationSlot == 1) {
|
||||
// Bedrock Edition can use a compass to create locator maps in the ADDITIONAL slot
|
||||
// Bedrock Edition can use a compass to create locator maps, or use a filled map, in the ADDITIONAL slot
|
||||
GeyserItemStack itemStack = javaSourceSlot == -1 ? session.getPlayerInventory().getCursor() : inventory.getItem(javaSourceSlot);
|
||||
return itemStack.getItemEntry().getJavaIdentifier().equals("minecraft:compass");
|
||||
return itemStack.getItemEntry().getJavaIdentifier().equals("minecraft:compass") || itemStack.getItemEntry().getJavaIdentifier().equals("minecraft:filled_map");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren