forked from GeyserMC/Geyser
Make my life tolerable
This commit is contained in:
parent
1705f1034c
commit
f47cf32d90
1 changed files with 12 additions and 1 deletions
|
@ -136,6 +136,10 @@ public abstract class InventoryTranslator {
|
||||||
case PLACE: {
|
case PLACE: {
|
||||||
TransferStackRequestActionData transferAction = (TransferStackRequestActionData) action;
|
TransferStackRequestActionData transferAction = (TransferStackRequestActionData) action;
|
||||||
if (!(checkNetId(session, inventory, transferAction.getSource()) && checkNetId(session, inventory, transferAction.getDestination()))) {
|
if (!(checkNetId(session, inventory, transferAction.getSource()) && checkNetId(session, inventory, transferAction.getDestination()))) {
|
||||||
|
if (session.getGameMode().equals(GameMode.CREATIVE) && transferAction.getSource().getContainer() == ContainerSlotType.CRAFTING_INPUT &&
|
||||||
|
transferAction.getSource().getSlot() >= 28 && transferAction.getSource().getSlot() <= 31) {
|
||||||
|
return rejectRequest(request, false);
|
||||||
|
}
|
||||||
session.getConnector().getLogger().error("DEBUG: About to reject request.");
|
session.getConnector().getLogger().error("DEBUG: About to reject request.");
|
||||||
session.getConnector().getLogger().error("Source: " + transferAction.getSource().toString() + " Result: " + checkNetId(session, inventory, transferAction.getSource()));
|
session.getConnector().getLogger().error("Source: " + transferAction.getSource().toString() + " Result: " + checkNetId(session, inventory, transferAction.getSource()));
|
||||||
session.getConnector().getLogger().error("Destination: " + transferAction.getDestination().toString() + " Result: " + checkNetId(session, inventory, transferAction.getDestination()));
|
session.getConnector().getLogger().error("Destination: " + transferAction.getDestination().toString() + " Result: " + checkNetId(session, inventory, transferAction.getDestination()));
|
||||||
|
@ -504,7 +508,14 @@ public abstract class InventoryTranslator {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStackResponsePacket.Response rejectRequest(ItemStackRequestPacket.Request request) {
|
public static ItemStackResponsePacket.Response rejectRequest(ItemStackRequestPacket.Request request) {
|
||||||
new Throwable("DEBUGGING: ItemStackRequest rejected").printStackTrace(); //TODO: temporary debugging
|
return rejectRequest(request, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStackResponsePacket.Response rejectRequest(ItemStackRequestPacket.Request request, boolean throwError) {
|
||||||
|
if (throwError) {
|
||||||
|
// Currently for debugging, but might be worth it to keep in the future if something goes terribly wrong.
|
||||||
|
new Throwable("DEBUGGING: ItemStackRequest rejected").printStackTrace();
|
||||||
|
}
|
||||||
return new ItemStackResponsePacket.Response(ItemStackResponsePacket.ResponseStatus.ERROR, request.getRequestId(), Collections.emptyList());
|
return new ItemStackResponsePacket.Response(ItemStackResponsePacket.ResponseStatus.ERROR, request.getRequestId(), Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue