forked from GeyserMC/Geyser
Fix Merchant Inventory Transaction (#1017)
This commit is contained in:
parent
5c2a225533
commit
d03f56e7e8
1 changed files with 19 additions and 13 deletions
|
@ -60,15 +60,23 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int bedrockSlotToJava(InventoryActionData action) {
|
public int bedrockSlotToJava(InventoryActionData action) {
|
||||||
if (action.getSource().getContainerId() == ContainerId.UI) {
|
switch (action.getSource().getContainerId()) {
|
||||||
switch (action.getSlot()) {
|
case ContainerId.UI:
|
||||||
case 4:
|
switch (action.getSlot()) {
|
||||||
return 0;
|
case 4:
|
||||||
case 5:
|
return 0;
|
||||||
return 1;
|
case 5:
|
||||||
case 50:
|
return 1;
|
||||||
return 2;
|
case 50:
|
||||||
}
|
return 2;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case -28: // Trading 1?
|
||||||
|
return 0;
|
||||||
|
case -29: // Trading 2?
|
||||||
|
return 1;
|
||||||
|
case -30: // Trading Output?
|
||||||
|
return 2;
|
||||||
}
|
}
|
||||||
return super.bedrockSlotToJava(action);
|
return super.bedrockSlotToJava(action);
|
||||||
}
|
}
|
||||||
|
@ -109,10 +117,8 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translateActions(GeyserSession session, Inventory inventory, List<InventoryActionData> actions) {
|
public void translateActions(GeyserSession session, Inventory inventory, List<InventoryActionData> actions) {
|
||||||
for (InventoryActionData action : actions) {
|
if (actions.stream().anyMatch(a -> a.getSource().getContainerId() == -31)) {
|
||||||
if (action.getSource().getType() == InventorySource.Type.NON_IMPLEMENTED_TODO) {
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
super.translateActions(session, inventory, actions);
|
super.translateActions(session, inventory, actions);
|
||||||
|
|
Loading…
Reference in a new issue