Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-09-08 20:43:04 +02:00
Remove debug lines
Dieser Commit ist enthalten in:
Ursprung
e87ae8f0dd
Commit
196c9f5c17
@ -93,7 +93,6 @@ public class GeyserSpigot1_11CraftingListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("Sending recipes!");
|
|
||||||
sendServerRecipes(session);
|
sendServerRecipes(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -887,7 +887,6 @@ public class GeyserSession implements CommandSender {
|
|||||||
*/
|
*/
|
||||||
public void addInventoryTask(Runnable task) {
|
public void addInventoryTask(Runnable task) {
|
||||||
synchronized (inventoryLock) {
|
synchronized (inventoryLock) {
|
||||||
System.out.println("new task " + task.toString());
|
|
||||||
inventoryFuture = inventoryFuture.thenRun(task).exceptionally(throwable -> {
|
inventoryFuture = inventoryFuture.thenRun(task).exceptionally(throwable -> {
|
||||||
GeyserConnector.getInstance().getLogger().error("Error processing inventory task", throwable.getCause());
|
GeyserConnector.getInstance().getLogger().error("Error processing inventory task", throwable.getCause());
|
||||||
return null;
|
return null;
|
||||||
@ -905,7 +904,6 @@ public class GeyserSession implements CommandSender {
|
|||||||
*/
|
*/
|
||||||
public void addInventoryTask(Runnable task, long delayMillis) {
|
public void addInventoryTask(Runnable task, long delayMillis) {
|
||||||
synchronized (inventoryLock) {
|
synchronized (inventoryLock) {
|
||||||
System.out.println("new delayed task " + task.toString());
|
|
||||||
Executor delayedExecutor = command -> GeyserConnector.getInstance().getGeneralThreadPool().schedule(command, delayMillis, TimeUnit.MILLISECONDS);
|
Executor delayedExecutor = command -> GeyserConnector.getInstance().getGeneralThreadPool().schedule(command, delayMillis, TimeUnit.MILLISECONDS);
|
||||||
inventoryFuture = inventoryFuture.thenRunAsync(task, delayedExecutor).exceptionally(throwable -> {
|
inventoryFuture = inventoryFuture.thenRunAsync(task, delayedExecutor).exceptionally(throwable -> {
|
||||||
GeyserConnector.getInstance().getLogger().error("Error processing inventory task", throwable.getCause());
|
GeyserConnector.getInstance().getLogger().error("Error processing inventory task", throwable.getCause());
|
||||||
|
@ -48,7 +48,6 @@ public class BedrockContainerCloseTranslator extends PacketTranslator<ContainerC
|
|||||||
|
|
||||||
Inventory openInventory = session.getOpenInventory();
|
Inventory openInventory = session.getOpenInventory();
|
||||||
if (openInventory != null && windowId == openInventory.getId()) {
|
if (openInventory != null && windowId == openInventory.getId()) {
|
||||||
System.out.println(packet);
|
|
||||||
ClientCloseWindowPacket closeWindowPacket = new ClientCloseWindowPacket(windowId);
|
ClientCloseWindowPacket closeWindowPacket = new ClientCloseWindowPacket(windowId);
|
||||||
session.sendDownstreamPacket(closeWindowPacket);
|
session.sendDownstreamPacket(closeWindowPacket);
|
||||||
InventoryUtils.closeInventory(session, windowId);
|
InventoryUtils.closeInventory(session, windowId);
|
||||||
|
@ -52,7 +52,6 @@ public class BedrockFilterTextTranslator extends PacketTranslator<FilterTextPack
|
|||||||
if (session.getOpenInventory() instanceof AnvilContainer) {
|
if (session.getOpenInventory() instanceof AnvilContainer) {
|
||||||
// Java Edition sends a packet every time an item is renamed even slightly in GUI. Fortunately, this works out for us now
|
// Java Edition sends a packet every time an item is renamed even slightly in GUI. Fortunately, this works out for us now
|
||||||
ClientRenameItemPacket renameItemPacket = new ClientRenameItemPacket(packet.getText());
|
ClientRenameItemPacket renameItemPacket = new ClientRenameItemPacket(packet.getText());
|
||||||
System.out.println(renameItemPacket);
|
|
||||||
session.sendDownstreamPacket(renameItemPacket);
|
session.sendDownstreamPacket(renameItemPacket);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,6 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator<Inve
|
|||||||
|
|
||||||
switch (packet.getTransactionType()) {
|
switch (packet.getTransactionType()) {
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
System.out.println(packet);
|
|
||||||
if (packet.getActions().size() == 2) {
|
if (packet.getActions().size() == 2) {
|
||||||
InventoryActionData worldAction = packet.getActions().get(0);
|
InventoryActionData worldAction = packet.getActions().get(0);
|
||||||
InventoryActionData containerAction = packet.getActions().get(1);
|
InventoryActionData containerAction = packet.getActions().get(1);
|
||||||
|
@ -37,7 +37,6 @@ public class BedrockItemStackRequestTranslator extends PacketTranslator<ItemStac
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ItemStackRequestPacket packet, GeyserSession session) {
|
public void translate(ItemStackRequestPacket packet, GeyserSession session) {
|
||||||
session.getConnector().getLogger().info(packet.toString());
|
|
||||||
Inventory inventory = session.getOpenInventory();
|
Inventory inventory = session.getOpenInventory();
|
||||||
if (inventory == null)
|
if (inventory == null)
|
||||||
return;
|
return;
|
||||||
|
@ -50,8 +50,6 @@ public class BedrockLecternUpdateTranslator extends PacketTranslator<LecternUpda
|
|||||||
// So, we enter the GUI and then drop it! :)
|
// So, we enter the GUI and then drop it! :)
|
||||||
session.setDroppingLecternBook(true);
|
session.setDroppingLecternBook(true);
|
||||||
|
|
||||||
Vector3f diff = session.getPlayerEntity().getPosition().sub(packet.getBlockPosition().toFloat());
|
|
||||||
System.out.println(diff);
|
|
||||||
// Emulate an interact packet
|
// Emulate an interact packet
|
||||||
ClientPlayerPlaceBlockPacket blockPacket = new ClientPlayerPlaceBlockPacket(
|
ClientPlayerPlaceBlockPacket blockPacket = new ClientPlayerPlaceBlockPacket(
|
||||||
new Position(packet.getBlockPosition().getX(), packet.getBlockPosition().getY(), packet.getBlockPosition().getZ()),
|
new Position(packet.getBlockPosition().getX(), packet.getBlockPosition().getY(), packet.getBlockPosition().getZ()),
|
||||||
@ -79,13 +77,11 @@ public class BedrockLecternUpdateTranslator extends PacketTranslator<LecternUpda
|
|||||||
if (newJavaPage > currentJavaPage) {
|
if (newJavaPage > currentJavaPage) {
|
||||||
for (int i = currentJavaPage; i < newJavaPage; i++) {
|
for (int i = currentJavaPage; i < newJavaPage; i++) {
|
||||||
ClientClickWindowButtonPacket clickButtonPacket = new ClientClickWindowButtonPacket(session.getOpenInventory().getId(), 2);
|
ClientClickWindowButtonPacket clickButtonPacket = new ClientClickWindowButtonPacket(session.getOpenInventory().getId(), 2);
|
||||||
System.out.println(clickButtonPacket);
|
|
||||||
session.sendDownstreamPacket(clickButtonPacket);
|
session.sendDownstreamPacket(clickButtonPacket);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i = currentJavaPage; i > newJavaPage; i--) {
|
for (int i = currentJavaPage; i > newJavaPage; i--) {
|
||||||
ClientClickWindowButtonPacket clickButtonPacket = new ClientClickWindowButtonPacket(session.getOpenInventory().getId(), 1);
|
ClientClickWindowButtonPacket clickButtonPacket = new ClientClickWindowButtonPacket(session.getOpenInventory().getId(), 1);
|
||||||
System.out.println(clickButtonPacket);
|
|
||||||
session.sendDownstreamPacket(clickButtonPacket);
|
session.sendDownstreamPacket(clickButtonPacket);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -173,11 +173,9 @@ public abstract class InventoryTranslator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
session.sendUpstreamPacket(responsePacket);
|
session.sendUpstreamPacket(responsePacket);
|
||||||
System.out.println(responsePacket);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStackResponsePacket.Response translateRequest(GeyserSession session, Inventory inventory, ItemStackRequestPacket.Request request) {
|
public ItemStackResponsePacket.Response translateRequest(GeyserSession session, Inventory inventory, ItemStackRequestPacket.Request request) {
|
||||||
System.out.println(request);
|
|
||||||
ClickPlan plan = new ClickPlan(session, this, inventory);
|
ClickPlan plan = new ClickPlan(session, this, inventory);
|
||||||
IntSet affectedSlots = new IntOpenHashSet();
|
IntSet affectedSlots = new IntOpenHashSet();
|
||||||
for (StackRequestActionData action : request.getActions()) {
|
for (StackRequestActionData action : request.getActions()) {
|
||||||
@ -273,7 +271,6 @@ public abstract class InventoryTranslator {
|
|||||||
itemToUpdate.isEmpty() ? new ItemStack(0) : itemToUpdate.getItemStack()
|
itemToUpdate.isEmpty() ? new ItemStack(0) : itemToUpdate.getItemStack()
|
||||||
);
|
);
|
||||||
session.sendDownstreamPacket(creativeActionPacket);
|
session.sendDownstreamPacket(creativeActionPacket);
|
||||||
System.out.println(creativeActionPacket);
|
|
||||||
|
|
||||||
if (!sourceIsCursor) { // Cursor is always added for us as an affected slot
|
if (!sourceIsCursor) { // Cursor is always added for us as an affected slot
|
||||||
affectedSlots.add(sourceSlot);
|
affectedSlots.add(sourceSlot);
|
||||||
@ -365,7 +362,6 @@ public abstract class InventoryTranslator {
|
|||||||
sourceSlot,
|
sourceSlot,
|
||||||
oldDestinationItem.isEmpty() ? new ItemStack(0) : oldDestinationItem.getItemStack() // isEmpty check... just in case
|
oldDestinationItem.isEmpty() ? new ItemStack(0) : oldDestinationItem.getItemStack() // isEmpty check... just in case
|
||||||
);
|
);
|
||||||
System.out.println(creativeActionPacket);
|
|
||||||
session.sendDownstreamPacket(creativeActionPacket);
|
session.sendDownstreamPacket(creativeActionPacket);
|
||||||
inventory.setItem(sourceSlot, oldDestinationItem, session);
|
inventory.setItem(sourceSlot, oldDestinationItem, session);
|
||||||
}
|
}
|
||||||
@ -376,7 +372,6 @@ public abstract class InventoryTranslator {
|
|||||||
destSlot,
|
destSlot,
|
||||||
oldSourceItem.isEmpty() ? new ItemStack(0) : oldSourceItem.getItemStack()
|
oldSourceItem.isEmpty() ? new ItemStack(0) : oldSourceItem.getItemStack()
|
||||||
);
|
);
|
||||||
System.out.println(creativeActionPacket);
|
|
||||||
session.sendDownstreamPacket(creativeActionPacket);
|
session.sendDownstreamPacket(creativeActionPacket);
|
||||||
inventory.setItem(destSlot, oldSourceItem, session);
|
inventory.setItem(destSlot, oldSourceItem, session);
|
||||||
}
|
}
|
||||||
@ -433,7 +428,6 @@ public abstract class InventoryTranslator {
|
|||||||
Click.OUTSIDE_SLOT,
|
Click.OUTSIDE_SLOT,
|
||||||
droppingItem.getItemStack()
|
droppingItem.getItemStack()
|
||||||
);
|
);
|
||||||
System.out.println(packet.toString());
|
|
||||||
session.sendDownstreamPacket(packet);
|
session.sendDownstreamPacket(packet);
|
||||||
} else {
|
} else {
|
||||||
int sourceAmount = plan.getCursor().getAmount();
|
int sourceAmount = plan.getCursor().getAmount();
|
||||||
@ -458,11 +452,6 @@ public abstract class InventoryTranslator {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CRAFT_CREATIVE: {
|
|
||||||
CraftCreativeStackRequestActionData creativeAction = (CraftCreativeStackRequestActionData) action;
|
|
||||||
System.out.println(creativeAction.getCreativeItemNetworkId());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case DESTROY: {
|
case DESTROY: {
|
||||||
// Only called when a creative client wants to destroy an item... I think - Camotoy
|
// Only called when a creative client wants to destroy an item... I think - Camotoy
|
||||||
DestroyStackRequestActionData destroyAction = (DestroyStackRequestActionData) action;
|
DestroyStackRequestActionData destroyAction = (DestroyStackRequestActionData) action;
|
||||||
@ -489,7 +478,6 @@ public abstract class InventoryTranslator {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
session.sendDownstreamPacket(destroyItemPacket);
|
session.sendDownstreamPacket(destroyItemPacket);
|
||||||
System.out.println(destroyItemPacket);
|
|
||||||
affectedSlots.add(javaSlot);
|
affectedSlots.add(javaSlot);
|
||||||
} else {
|
} else {
|
||||||
// Just sync up the item on our end, since the server doesn't care what's in our cursor
|
// Just sync up the item on our end, since the server doesn't care what's in our cursor
|
||||||
@ -538,8 +526,6 @@ public abstract class InventoryTranslator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ItemStackResponsePacket.Response translateCraftingRequest(GeyserSession session, Inventory inventory, ItemStackRequestPacket.Request request) {
|
public ItemStackResponsePacket.Response translateCraftingRequest(GeyserSession session, Inventory inventory, ItemStackRequestPacket.Request request) {
|
||||||
System.out.println(request);
|
|
||||||
|
|
||||||
int recipeId = 0;
|
int recipeId = 0;
|
||||||
int resultSize = 0;
|
int resultSize = 0;
|
||||||
int timesCrafted = 0;
|
int timesCrafted = 0;
|
||||||
@ -809,8 +795,6 @@ public abstract class InventoryTranslator {
|
|||||||
boolean done = true;
|
boolean done = true;
|
||||||
for (Int2ObjectMap.Entry<Int2IntMap> entry : ingredientMap.int2ObjectEntrySet()) {
|
for (Int2ObjectMap.Entry<Int2IntMap> entry : ingredientMap.int2ObjectEntrySet()) {
|
||||||
Int2IntMap sources = entry.getValue();
|
Int2IntMap sources = entry.getValue();
|
||||||
System.out.println("Grid slot: " + entry.getIntKey());
|
|
||||||
System.out.println(sources);
|
|
||||||
if (sources.isEmpty())
|
if (sources.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -829,16 +813,10 @@ public abstract class InventoryTranslator {
|
|||||||
transferSlot(plan, sourceSlot, gridSlot, transferAmount);
|
transferSlot(plan, sourceSlot, gridSlot, transferAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int x = 0; x < 3; x++) {
|
|
||||||
int offset = x * 3;
|
|
||||||
System.out.println(plan.getItem(1 + offset).getAmount() + " " + plan.getItem(2 + offset).getAmount() + " " + plan.getItem(3 + offset).getAmount());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!done) {
|
if (!done) {
|
||||||
//TODO: sometimes the server does not agree on this slot?
|
//TODO: sometimes the server does not agree on this slot?
|
||||||
plan.add(Click.LEFT_SHIFT, 0, true);
|
plan.add(Click.LEFT_SHIFT, 0, true);
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Times looped: " + loops);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -908,7 +886,6 @@ public abstract class InventoryTranslator {
|
|||||||
javaCreativeItem
|
javaCreativeItem
|
||||||
);
|
);
|
||||||
session.sendDownstreamPacket(creativeActionPacket);
|
session.sendDownstreamPacket(creativeActionPacket);
|
||||||
System.out.println(creativeActionPacket);
|
|
||||||
Set<Integer> affectedSlots = Collections.singleton(javaSlot);
|
Set<Integer> affectedSlots = Collections.singleton(javaSlot);
|
||||||
return acceptRequest(request, makeContainerEntries(session, inventory, affectedSlots));
|
return acceptRequest(request, makeContainerEntries(session, inventory, affectedSlots));
|
||||||
}
|
}
|
||||||
@ -1017,8 +994,6 @@ public abstract class InventoryTranslator {
|
|||||||
if (!viable) {
|
if (!viable) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("TEMP SLOT CHOSEN: " + i + " => " + inventory.getItem(i));
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
//could not find a viable temp slot
|
//could not find a viable temp slot
|
||||||
|
@ -132,7 +132,6 @@ public class ClickPlan {
|
|||||||
if (clickedItemStack == InventoryUtils.REFRESH_ITEM || action.force) {
|
if (clickedItemStack == InventoryUtils.REFRESH_ITEM || action.force) {
|
||||||
session.sendDownstreamPacket(new ClientConfirmTransactionPacket(inventory.getId(), actionId, true));
|
session.sendDownstreamPacket(new ClientConfirmTransactionPacket(inventory.getId(), actionId, true));
|
||||||
}
|
}
|
||||||
System.out.println(clickPacket);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
session.getPlayerInventory().setCursor(simulatedCursor, session);
|
session.getPlayerInventory().setCursor(simulatedCursor, session);
|
||||||
@ -268,7 +267,6 @@ public class ClickPlan {
|
|||||||
if (!item.isEmpty())
|
if (!item.isEmpty())
|
||||||
item.sub(crafted);
|
item.sub(crafted);
|
||||||
}
|
}
|
||||||
System.out.println("REDUCED GRID BY " + crafted);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,7 +84,6 @@ public class BeaconInventoryTranslator extends AbstractBlockInventoryTranslator
|
|||||||
BlockEntityDataPacket packet = new BlockEntityDataPacket();
|
BlockEntityDataPacket packet = new BlockEntityDataPacket();
|
||||||
packet.setBlockPosition(position);
|
packet.setBlockPosition(position);
|
||||||
packet.setData(builder.build());
|
packet.setData(builder.build());
|
||||||
System.out.println(packet.toString());
|
|
||||||
session.sendUpstreamPacket(packet);
|
session.sendUpstreamPacket(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,7 +97,6 @@ public class BeaconInventoryTranslator extends AbstractBlockInventoryTranslator
|
|||||||
// Input a beacon payment
|
// Input a beacon payment
|
||||||
BeaconPaymentStackRequestActionData beaconPayment = (BeaconPaymentStackRequestActionData) request.getActions()[0];
|
BeaconPaymentStackRequestActionData beaconPayment = (BeaconPaymentStackRequestActionData) request.getActions()[0];
|
||||||
ClientSetBeaconEffectPacket packet = new ClientSetBeaconEffectPacket(beaconPayment.getPrimaryEffect(), beaconPayment.getSecondaryEffect());
|
ClientSetBeaconEffectPacket packet = new ClientSetBeaconEffectPacket(beaconPayment.getPrimaryEffect(), beaconPayment.getSecondaryEffect());
|
||||||
System.out.println(packet.toString());
|
|
||||||
session.sendDownstreamPacket(packet);
|
session.sendDownstreamPacket(packet);
|
||||||
return acceptRequest(request, makeContainerEntries(session, inventory, Collections.emptySet()));
|
return acceptRequest(request, makeContainerEntries(session, inventory, Collections.emptySet()));
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,6 @@ public class BrewingInventoryTranslator extends AbstractBlockInventoryTranslator
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) {
|
public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) {
|
||||||
System.out.println("Brewing stand: " + slotInfoData);
|
|
||||||
if (slotInfoData.getContainer() == ContainerSlotType.BREWING_INPUT) {
|
if (slotInfoData.getContainer() == ContainerSlotType.BREWING_INPUT) {
|
||||||
// Ingredient
|
// Ingredient
|
||||||
// TODO: This hasn't worked and then suddenly, it did.
|
// TODO: This hasn't worked and then suddenly, it did.
|
||||||
|
@ -99,7 +99,6 @@ public class EnchantingInventoryTranslator extends AbstractBlockInventoryTransla
|
|||||||
enchantingInventory.getEnchantOptions()[slotToUpdate] = enchantingInventory.getGeyserEnchantOptions()[slotToUpdate].build(session);
|
enchantingInventory.getEnchantOptions()[slotToUpdate] = enchantingInventory.getGeyserEnchantOptions()[slotToUpdate].build(session);
|
||||||
PlayerEnchantOptionsPacket packet = new PlayerEnchantOptionsPacket();
|
PlayerEnchantOptionsPacket packet = new PlayerEnchantOptionsPacket();
|
||||||
packet.getOptions().addAll(Arrays.asList(enchantingInventory.getEnchantOptions()));
|
packet.getOptions().addAll(Arrays.asList(enchantingInventory.getEnchantOptions()));
|
||||||
System.out.println(packet);
|
|
||||||
session.sendUpstreamPacket(packet);
|
session.sendUpstreamPacket(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -130,7 +129,6 @@ public class EnchantingInventoryTranslator extends AbstractBlockInventoryTransla
|
|||||||
return rejectRequest(request);
|
return rejectRequest(request);
|
||||||
}
|
}
|
||||||
ClientClickWindowButtonPacket packet = new ClientClickWindowButtonPacket(inventory.getId(), javaSlot);
|
ClientClickWindowButtonPacket packet = new ClientClickWindowButtonPacket(inventory.getId(), javaSlot);
|
||||||
System.out.println(packet);
|
|
||||||
session.sendDownstreamPacket(packet);
|
session.sendDownstreamPacket(packet);
|
||||||
return acceptRequest(request, makeContainerEntries(session, inventory, Collections.emptySet()));
|
return acceptRequest(request, makeContainerEntries(session, inventory, Collections.emptySet()));
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,6 @@ public class LoomInventoryTranslator extends AbstractBlockInventoryTranslator {
|
|||||||
// And the Java loom window has a fixed row/width of four
|
// And the Java loom window has a fixed row/width of four
|
||||||
// So... Number / 4 = row (so we don't have to bother there), and number % 4 is our column, which leads us back to our index. :)
|
// So... Number / 4 = row (so we don't have to bother there), and number % 4 is our column, which leads us back to our index. :)
|
||||||
ClientClickWindowButtonPacket packet = new ClientClickWindowButtonPacket(inventory.getId(), index);
|
ClientClickWindowButtonPacket packet = new ClientClickWindowButtonPacket(inventory.getId(), index);
|
||||||
System.out.println(packet);
|
|
||||||
session.sendDownstreamPacket(packet);
|
session.sendDownstreamPacket(packet);
|
||||||
|
|
||||||
GeyserItemStack inputCopy = inventory.getItem(0).copy();
|
GeyserItemStack inputCopy = inventory.getItem(0).copy();
|
||||||
|
@ -73,15 +73,12 @@ public class StonecutterInventoryTranslator extends AbstractBlockInventoryTransl
|
|||||||
if (results == null) {
|
if (results == null) {
|
||||||
return rejectRequest(request);
|
return rejectRequest(request);
|
||||||
}
|
}
|
||||||
System.out.println(id + " " + results);
|
|
||||||
ItemStack javaOutput = ItemTranslator.translateToJava(craftData.getResultItems()[0]);
|
ItemStack javaOutput = ItemTranslator.translateToJava(craftData.getResultItems()[0]);
|
||||||
System.out.println(javaOutput);
|
|
||||||
int button = results.indexOf(javaOutput.getId());
|
int button = results.indexOf(javaOutput.getId());
|
||||||
// If we've already pressed the button with this item, no need to press it again!
|
// If we've already pressed the button with this item, no need to press it again!
|
||||||
if (container.getStonecutterButton() != button) {
|
if (container.getStonecutterButton() != button) {
|
||||||
// Getting the index of the item in the Java stonecutter list
|
// Getting the index of the item in the Java stonecutter list
|
||||||
ClientClickWindowButtonPacket packet = new ClientClickWindowButtonPacket(inventory.getId(), button);
|
ClientClickWindowButtonPacket packet = new ClientClickWindowButtonPacket(inventory.getId(), button);
|
||||||
System.out.println(packet.toString());
|
|
||||||
session.sendDownstreamPacket(packet);
|
session.sendDownstreamPacket(packet);
|
||||||
container.setStonecutterButton(button);
|
container.setStonecutterButton(button);
|
||||||
if (inventory.getItem(1).getJavaId() != javaOutput.getId()) {
|
if (inventory.getItem(1).getJavaId() != javaOutput.getId()) {
|
||||||
|
@ -107,7 +107,6 @@ public abstract class ChestedHorseInventoryTranslator extends AbstractHorseInven
|
|||||||
InventoryContentPacket horseContentsPacket = new InventoryContentPacket();
|
InventoryContentPacket horseContentsPacket = new InventoryContentPacket();
|
||||||
horseContentsPacket.setContainerId(inventory.getId());
|
horseContentsPacket.setContainerId(inventory.getId());
|
||||||
horseContentsPacket.setContents(Arrays.asList(horseItems));
|
horseContentsPacket.setContents(Arrays.asList(horseItems));
|
||||||
System.out.println(horseContentsPacket);
|
|
||||||
session.sendUpstreamPacket(horseContentsPacket);
|
session.sendUpstreamPacket(horseContentsPacket);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,6 @@ public class HorseInventoryUpdater extends InventoryUpdater {
|
|||||||
slotPacket.setSlot(translator.javaSlotToBedrock(javaSlot));
|
slotPacket.setSlot(translator.javaSlotToBedrock(javaSlot));
|
||||||
slotPacket.setItem(inventory.getItem(javaSlot).getItemData(session));
|
slotPacket.setItem(inventory.getItem(javaSlot).getItemData(session));
|
||||||
session.sendUpstreamPacket(slotPacket);
|
session.sendUpstreamPacket(slotPacket);
|
||||||
System.out.println(slotPacket);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,6 @@ public class JavaConfirmTransactionTranslator extends PacketTranslator<ServerCon
|
|||||||
if (!packet.isAccepted()) {
|
if (!packet.isAccepted()) {
|
||||||
ClientConfirmTransactionPacket confirmPacket = new ClientConfirmTransactionPacket(packet.getWindowId(), packet.getActionId(), true);
|
ClientConfirmTransactionPacket confirmPacket = new ClientConfirmTransactionPacket(packet.getWindowId(), packet.getActionId(), true);
|
||||||
session.sendDownstreamPacket(confirmPacket);
|
session.sendDownstreamPacket(confirmPacket);
|
||||||
System.out.println(packet);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,6 @@ public class JavaOpenHorseWindowTranslator extends PacketTranslator<ServerOpenHo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerOpenHorseWindowPacket packet, GeyserSession session) {
|
public void translate(ServerOpenHorseWindowPacket packet, GeyserSession session) {
|
||||||
System.out.println(packet.toString());
|
|
||||||
Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId());
|
Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId());
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
return;
|
return;
|
||||||
@ -130,7 +129,6 @@ public class JavaOpenHorseWindowTranslator extends PacketTranslator<ServerOpenHo
|
|||||||
builder.putList("slots", NbtType.COMPOUND, slots);
|
builder.putList("slots", NbtType.COMPOUND, slots);
|
||||||
|
|
||||||
updateEquipPacket.setTag(builder.build());
|
updateEquipPacket.setTag(builder.build());
|
||||||
System.out.println(updateEquipPacket);
|
|
||||||
session.sendUpstreamPacket(updateEquipPacket);
|
session.sendUpstreamPacket(updateEquipPacket);
|
||||||
|
|
||||||
session.setInventoryTranslator(inventoryTranslator);
|
session.setInventoryTranslator(inventoryTranslator);
|
||||||
|
@ -58,7 +58,6 @@ public class JavaSetSlotTranslator extends PacketTranslator<ServerSetSlotPacket>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerSetSlotPacket packet, GeyserSession session) {
|
public void translate(ServerSetSlotPacket packet, GeyserSession session) {
|
||||||
System.out.println(packet.toString());
|
|
||||||
session.addInventoryTask(() -> {
|
session.addInventoryTask(() -> {
|
||||||
if (packet.getWindowId() == 255) { //cursor
|
if (packet.getWindowId() == 255) { //cursor
|
||||||
GeyserItemStack newItem = GeyserItemStack.from(packet.getItem());
|
GeyserItemStack newItem = GeyserItemStack.from(packet.getItem());
|
||||||
@ -125,11 +124,6 @@ public class JavaSetSlotTranslator extends PacketTranslator<ServerSetSlotPacket>
|
|||||||
height += -firstRow + 1;
|
height += -firstRow + 1;
|
||||||
width += -firstCol + 1;
|
width += -firstCol + 1;
|
||||||
|
|
||||||
System.out.println("Start Row: " + firstRow);
|
|
||||||
System.out.println("Start Column: " + firstCol);
|
|
||||||
System.out.println("Rows: " + height);
|
|
||||||
System.out.println("Columns: " + width);
|
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
recipes:
|
recipes:
|
||||||
for (Recipe recipe : session.getCraftingRecipes().values()) {
|
for (Recipe recipe : session.getCraftingRecipes().values()) {
|
||||||
@ -157,8 +151,6 @@ public class JavaSetSlotTranslator extends PacketTranslator<ServerSetSlotPacket>
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println("FOUND SHAPED RECIPE :)");
|
|
||||||
System.out.println(recipe);
|
|
||||||
// Recipe is had, don't sent packet
|
// Recipe is had, don't sent packet
|
||||||
return;
|
return;
|
||||||
} else if (recipe.getType() == RecipeType.CRAFTING_SHAPELESS) {
|
} else if (recipe.getType() == RecipeType.CRAFTING_SHAPELESS) {
|
||||||
@ -191,7 +183,6 @@ public class JavaSetSlotTranslator extends PacketTranslator<ServerSetSlotPacket>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println("Sending packet!");
|
|
||||||
|
|
||||||
UUID uuid = UUID.randomUUID();
|
UUID uuid = UUID.randomUUID();
|
||||||
int newRecipeId = session.getLastRecipeNetId().incrementAndGet();
|
int newRecipeId = session.getLastRecipeNetId().incrementAndGet();
|
||||||
@ -234,7 +225,6 @@ public class JavaSetSlotTranslator extends PacketTranslator<ServerSetSlotPacket>
|
|||||||
newRecipeId
|
newRecipeId
|
||||||
));
|
));
|
||||||
craftPacket.setCleanRecipes(false);
|
craftPacket.setCleanRecipes(false);
|
||||||
System.out.println(craftPacket);
|
|
||||||
session.sendUpstreamPacket(craftPacket);
|
session.sendUpstreamPacket(craftPacket);
|
||||||
|
|
||||||
index = 0;
|
index = 0;
|
||||||
|
@ -38,7 +38,6 @@ public class JavaWindowPropertyTranslator extends PacketTranslator<ServerWindowP
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerWindowPropertyPacket packet, GeyserSession session) {
|
public void translate(ServerWindowPropertyPacket packet, GeyserSession session) {
|
||||||
System.out.println(packet.toString());
|
|
||||||
session.addInventoryTask(() -> {
|
session.addInventoryTask(() -> {
|
||||||
Inventory inventory = InventoryUtils.getInventory(session, packet.getWindowId());
|
Inventory inventory = InventoryUtils.getInventory(session, packet.getWindowId());
|
||||||
if (inventory == null)
|
if (inventory == null)
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren