mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Make changes required for Protocol 2.6.2
This commit is contained in:
parent
85b8fe2734
commit
605201afc0
7 changed files with 25 additions and 40 deletions
connector/src/main/java/org/geysermc/connector/network/translators/inventory
|
@ -33,9 +33,9 @@ import com.github.steveice10.mc.protocol.data.game.recipe.data.ShapedRecipeData;
|
||||||
import com.github.steveice10.mc.protocol.data.game.recipe.data.ShapelessRecipeData;
|
import com.github.steveice10.mc.protocol.data.game.recipe.data.ShapelessRecipeData;
|
||||||
import com.github.steveice10.mc.protocol.data.game.window.WindowType;
|
import com.github.steveice10.mc.protocol.data.game.window.WindowType;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType;
|
import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||||
|
import com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData;
|
import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.*;
|
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.*;
|
||||||
import com.nukkitx.protocol.bedrock.packet.ItemStackRequestPacket;
|
|
||||||
import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket;
|
import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket;
|
||||||
import it.unimi.dsi.fastutil.ints.*;
|
import it.unimi.dsi.fastutil.ints.*;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
@ -141,14 +141,14 @@ public abstract class InventoryTranslator {
|
||||||
/**
|
/**
|
||||||
* If {@link #shouldHandleRequestFirst(StackRequestActionData, Inventory)} returns true, this will be called
|
* If {@link #shouldHandleRequestFirst(StackRequestActionData, Inventory)} returns true, this will be called
|
||||||
*/
|
*/
|
||||||
public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequestPacket.Request request) {
|
public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void translateRequests(GeyserSession session, Inventory inventory, List<ItemStackRequestPacket.Request> requests) {
|
public void translateRequests(GeyserSession session, Inventory inventory, List<ItemStackRequest> requests) {
|
||||||
boolean refresh = false;
|
boolean refresh = false;
|
||||||
ItemStackResponsePacket responsePacket = new ItemStackResponsePacket();
|
ItemStackResponsePacket responsePacket = new ItemStackResponsePacket();
|
||||||
for (ItemStackRequestPacket.Request request : requests) {
|
for (ItemStackRequest request : requests) {
|
||||||
ItemStackResponsePacket.Response response;
|
ItemStackResponsePacket.Response response;
|
||||||
if (request.getActions().length > 0) {
|
if (request.getActions().length > 0) {
|
||||||
StackRequestActionData firstAction = request.getActions()[0];
|
StackRequestActionData firstAction = request.getActions()[0];
|
||||||
|
@ -181,7 +181,7 @@ public abstract class InventoryTranslator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStackResponsePacket.Response translateRequest(GeyserSession session, Inventory inventory, ItemStackRequestPacket.Request request) {
|
public ItemStackResponsePacket.Response translateRequest(GeyserSession session, Inventory inventory, ItemStackRequest 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()) {
|
||||||
|
@ -380,7 +380,7 @@ public abstract class InventoryTranslator {
|
||||||
return acceptRequest(request, makeContainerEntries(session, inventory, affectedSlots));
|
return acceptRequest(request, makeContainerEntries(session, inventory, affectedSlots));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStackResponsePacket.Response translateCraftingRequest(GeyserSession session, Inventory inventory, ItemStackRequestPacket.Request request) {
|
public ItemStackResponsePacket.Response translateCraftingRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) {
|
||||||
int recipeId = 0;
|
int recipeId = 0;
|
||||||
int resultSize = 0;
|
int resultSize = 0;
|
||||||
int timesCrafted = 0;
|
int timesCrafted = 0;
|
||||||
|
@ -485,7 +485,7 @@ public abstract class InventoryTranslator {
|
||||||
return acceptRequest(request, makeContainerEntries(session, inventory, plan.getAffectedSlots()));
|
return acceptRequest(request, makeContainerEntries(session, inventory, plan.getAffectedSlots()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStackResponsePacket.Response translateAutoCraftingRequest(GeyserSession session, Inventory inventory, ItemStackRequestPacket.Request request) {
|
public ItemStackResponsePacket.Response translateAutoCraftingRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) {
|
||||||
int gridSize;
|
int gridSize;
|
||||||
int gridDimensions;
|
int gridDimensions;
|
||||||
if (this instanceof PlayerInventoryTranslator) {
|
if (this instanceof PlayerInventoryTranslator) {
|
||||||
|
@ -681,7 +681,7 @@ public abstract class InventoryTranslator {
|
||||||
return acceptRequest(request, makeContainerEntries(session, inventory, plan.getAffectedSlots()));
|
return acceptRequest(request, makeContainerEntries(session, inventory, plan.getAffectedSlots()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStackResponsePacket.Response translateCreativeRequest(GeyserSession session, Inventory inventory, ItemStackRequestPacket.Request request) {
|
public ItemStackResponsePacket.Response translateCreativeRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) {
|
||||||
// Handled in PlayerInventoryTranslator
|
// Handled in PlayerInventoryTranslator
|
||||||
return rejectRequest(request);
|
return rejectRequest(request);
|
||||||
}
|
}
|
||||||
|
@ -717,15 +717,15 @@ public abstract class InventoryTranslator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStackResponsePacket.Response acceptRequest(ItemStackRequestPacket.Request request, List<ItemStackResponsePacket.ContainerEntry> containerEntries) {
|
public static ItemStackResponsePacket.Response acceptRequest(ItemStackRequest request, List<ItemStackResponsePacket.ContainerEntry> containerEntries) {
|
||||||
return new ItemStackResponsePacket.Response(ItemStackResponsePacket.ResponseStatus.OK, request.getRequestId(), containerEntries);
|
return new ItemStackResponsePacket.Response(ItemStackResponsePacket.ResponseStatus.OK, request.getRequestId(), containerEntries);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStackResponsePacket.Response rejectRequest(ItemStackRequestPacket.Request request) {
|
public static ItemStackResponsePacket.Response rejectRequest(ItemStackRequest request) {
|
||||||
return rejectRequest(request, true);
|
return rejectRequest(request, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStackResponsePacket.Response rejectRequest(ItemStackRequestPacket.Request request, boolean throwError) {
|
public static ItemStackResponsePacket.Response rejectRequest(ItemStackRequest request, boolean throwError) {
|
||||||
if (throwError) {
|
if (throwError) {
|
||||||
// Currently for debugging, but might be worth it to keep in the future if something goes terribly wrong.
|
// Currently for debugging, but might be worth it to keep in the future if something goes terribly wrong.
|
||||||
new Throwable("DEBUGGING: ItemStackRequest rejected " + request.toString()).printStackTrace();
|
new Throwable("DEBUGGING: ItemStackRequest rejected " + request.toString()).printStackTrace();
|
||||||
|
@ -811,9 +811,9 @@ public abstract class InventoryTranslator {
|
||||||
public static ItemStackResponsePacket.ItemEntry makeItemEntry(int bedrockSlot, GeyserItemStack itemStack) {
|
public static ItemStackResponsePacket.ItemEntry makeItemEntry(int bedrockSlot, GeyserItemStack itemStack) {
|
||||||
ItemStackResponsePacket.ItemEntry itemEntry;
|
ItemStackResponsePacket.ItemEntry itemEntry;
|
||||||
if (!itemStack.isEmpty()) {
|
if (!itemStack.isEmpty()) {
|
||||||
itemEntry = new ItemStackResponsePacket.ItemEntry((byte) bedrockSlot, (byte) bedrockSlot, (byte) itemStack.getAmount(), itemStack.getNetId(), "");
|
itemEntry = new ItemStackResponsePacket.ItemEntry((byte) bedrockSlot, (byte) bedrockSlot, (byte) itemStack.getAmount(), itemStack.getNetId(), "", 0);
|
||||||
} else {
|
} else {
|
||||||
itemEntry = new ItemStackResponsePacket.ItemEntry((byte) bedrockSlot, (byte) bedrockSlot, (byte) 0, 0, "");
|
itemEntry = new ItemStackResponsePacket.ItemEntry((byte) bedrockSlot, (byte) bedrockSlot, (byte) 0, 0, "", 0);
|
||||||
}
|
}
|
||||||
return itemEntry;
|
return itemEntry;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,14 +28,10 @@ package org.geysermc.connector.network.translators.inventory.translators;
|
||||||
import com.github.steveice10.mc.protocol.data.game.window.WindowType;
|
import com.github.steveice10.mc.protocol.data.game.window.WindowType;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientRenameItemPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientRenameItemPacket;
|
||||||
import com.nukkitx.nbt.NbtMap;
|
import com.nukkitx.nbt.NbtMap;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType;
|
import com.nukkitx.protocol.bedrock.data.inventory.*;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.ContainerType;
|
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData;
|
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.CraftResultsDeprecatedStackRequestActionData;
|
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.CraftResultsDeprecatedStackRequestActionData;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData;
|
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionType;
|
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionType;
|
||||||
import com.nukkitx.protocol.bedrock.packet.ItemStackRequestPacket;
|
|
||||||
import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket;
|
import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket;
|
||||||
import org.geysermc.connector.inventory.AnvilContainer;
|
import org.geysermc.connector.inventory.AnvilContainer;
|
||||||
import org.geysermc.connector.inventory.GeyserItemStack;
|
import org.geysermc.connector.inventory.GeyserItemStack;
|
||||||
|
@ -61,7 +57,7 @@ public class AnvilInventoryTranslator extends AbstractBlockInventoryTranslator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequestPacket.Request request) {
|
public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) {
|
||||||
if (!(request.getActions()[1] instanceof CraftResultsDeprecatedStackRequestActionData)) {
|
if (!(request.getActions()[1] instanceof CraftResultsDeprecatedStackRequestActionData)) {
|
||||||
// Just silently log an error
|
// Just silently log an error
|
||||||
session.getConnector().getLogger().debug("Something isn't quite right with taking an item out of an anvil.");
|
session.getConnector().getLogger().debug("Something isn't quite right with taking an item out of an anvil.");
|
||||||
|
|
|
@ -32,12 +32,12 @@ import com.nukkitx.nbt.NbtMap;
|
||||||
import com.nukkitx.nbt.NbtMapBuilder;
|
import com.nukkitx.nbt.NbtMapBuilder;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType;
|
import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.ContainerType;
|
import com.nukkitx.protocol.bedrock.data.inventory.ContainerType;
|
||||||
|
import com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData;
|
import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.BeaconPaymentStackRequestActionData;
|
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.BeaconPaymentStackRequestActionData;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData;
|
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionType;
|
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionType;
|
||||||
import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket;
|
import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket;
|
||||||
import com.nukkitx.protocol.bedrock.packet.ItemStackRequestPacket;
|
|
||||||
import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket;
|
import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket;
|
||||||
import org.geysermc.connector.inventory.BeaconContainer;
|
import org.geysermc.connector.inventory.BeaconContainer;
|
||||||
import org.geysermc.connector.inventory.Inventory;
|
import org.geysermc.connector.inventory.Inventory;
|
||||||
|
@ -93,7 +93,7 @@ public class BeaconInventoryTranslator extends AbstractBlockInventoryTranslator
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequestPacket.Request request) {
|
public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) {
|
||||||
// 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());
|
||||||
|
|
|
@ -27,14 +27,10 @@ package org.geysermc.connector.network.translators.inventory.translators;
|
||||||
|
|
||||||
import com.github.steveice10.mc.protocol.data.game.window.WindowType;
|
import com.github.steveice10.mc.protocol.data.game.window.WindowType;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientClickWindowButtonPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientClickWindowButtonPacket;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType;
|
import com.nukkitx.protocol.bedrock.data.inventory.*;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.ContainerType;
|
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.EnchantOptionData;
|
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData;
|
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.CraftRecipeStackRequestActionData;
|
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.CraftRecipeStackRequestActionData;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData;
|
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionType;
|
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionType;
|
||||||
import com.nukkitx.protocol.bedrock.packet.ItemStackRequestPacket;
|
|
||||||
import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket;
|
import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket;
|
||||||
import com.nukkitx.protocol.bedrock.packet.PlayerEnchantOptionsPacket;
|
import com.nukkitx.protocol.bedrock.packet.PlayerEnchantOptionsPacket;
|
||||||
import org.geysermc.connector.inventory.EnchantingContainer;
|
import org.geysermc.connector.inventory.EnchantingContainer;
|
||||||
|
@ -109,7 +105,7 @@ public class EnchantingInventoryTranslator extends AbstractBlockInventoryTransla
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequestPacket.Request request) {
|
public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) {
|
||||||
// Client has requested an item to be enchanted
|
// Client has requested an item to be enchanted
|
||||||
CraftRecipeStackRequestActionData craftRecipeData = (CraftRecipeStackRequestActionData) request.getActions()[0];
|
CraftRecipeStackRequestActionData craftRecipeData = (CraftRecipeStackRequestActionData) request.getActions()[0];
|
||||||
EnchantingContainer enchantingInventory = (EnchantingContainer) inventory;
|
EnchantingContainer enchantingInventory = (EnchantingContainer) inventory;
|
||||||
|
|
|
@ -32,11 +32,11 @@ import com.nukkitx.nbt.NbtMap;
|
||||||
import com.nukkitx.nbt.NbtType;
|
import com.nukkitx.nbt.NbtType;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType;
|
import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.ContainerType;
|
import com.nukkitx.protocol.bedrock.data.inventory.ContainerType;
|
||||||
|
import com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData;
|
import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.CraftResultsDeprecatedStackRequestActionData;
|
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.CraftResultsDeprecatedStackRequestActionData;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData;
|
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionType;
|
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionType;
|
||||||
import com.nukkitx.protocol.bedrock.packet.ItemStackRequestPacket;
|
|
||||||
import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket;
|
import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||||
|
@ -120,7 +120,7 @@ public class LoomInventoryTranslator extends AbstractBlockInventoryTranslator {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequestPacket.Request request) {
|
public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) {
|
||||||
// TODO: I anticipate this will be changed in the future to use something non-deprecated. Keep an eye out.
|
// TODO: I anticipate this will be changed in the future to use something non-deprecated. Keep an eye out.
|
||||||
StackRequestActionData data = request.getActions()[1];
|
StackRequestActionData data = request.getActions()[1];
|
||||||
if (!(data instanceof CraftResultsDeprecatedStackRequestActionData)) {
|
if (!(data instanceof CraftResultsDeprecatedStackRequestActionData)) {
|
||||||
|
|
|
@ -33,7 +33,6 @@ import com.nukkitx.protocol.bedrock.data.inventory.*;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.*;
|
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.*;
|
||||||
import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket;
|
import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket;
|
||||||
import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket;
|
import com.nukkitx.protocol.bedrock.packet.InventorySlotPacket;
|
||||||
import com.nukkitx.protocol.bedrock.packet.ItemStackRequestPacket;
|
|
||||||
import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket;
|
import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket;
|
||||||
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
||||||
import it.unimi.dsi.fastutil.ints.IntSet;
|
import it.unimi.dsi.fastutil.ints.IntSet;
|
||||||
|
@ -51,7 +50,6 @@ import org.geysermc.connector.utils.LanguageUtils;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class PlayerInventoryTranslator extends InventoryTranslator {
|
public class PlayerInventoryTranslator extends InventoryTranslator {
|
||||||
private static final ItemData UNUSUABLE_CRAFTING_SPACE_BLOCK = InventoryUtils.createUnusableSpaceBlock(LanguageUtils.getLocaleStringLog("geyser.inventory.unusable_item.creative"));
|
private static final ItemData UNUSUABLE_CRAFTING_SPACE_BLOCK = InventoryUtils.createUnusableSpaceBlock(LanguageUtils.getLocaleStringLog("geyser.inventory.unusable_item.creative"));
|
||||||
|
@ -211,12 +209,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translateRequests(GeyserSession session, Inventory inventory, List<ItemStackRequestPacket.Request> requests) {
|
public ItemStackResponsePacket.Response translateRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) {
|
||||||
super.translateRequests(session, inventory, requests);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStackResponsePacket.Response translateRequest(GeyserSession session, Inventory inventory, ItemStackRequestPacket.Request request) {
|
|
||||||
if (session.getGameMode() != GameMode.CREATIVE) {
|
if (session.getGameMode() != GameMode.CREATIVE) {
|
||||||
return super.translateRequest(session, inventory, request);
|
return super.translateRequest(session, inventory, request);
|
||||||
}
|
}
|
||||||
|
@ -377,7 +370,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStackResponsePacket.Response translateCreativeRequest(GeyserSession session, Inventory inventory, ItemStackRequestPacket.Request request) {
|
public ItemStackResponsePacket.Response translateCreativeRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) {
|
||||||
ItemStack javaCreativeItem = null;
|
ItemStack javaCreativeItem = null;
|
||||||
IntSet affectedSlots = new IntOpenHashSet();
|
IntSet affectedSlots = new IntOpenHashSet();
|
||||||
CraftState craftState = CraftState.START;
|
CraftState craftState = CraftState.START;
|
||||||
|
|
|
@ -30,11 +30,11 @@ import com.github.steveice10.mc.protocol.data.game.window.WindowType;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientClickWindowButtonPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientClickWindowButtonPacket;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType;
|
import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.ContainerType;
|
import com.nukkitx.protocol.bedrock.data.inventory.ContainerType;
|
||||||
|
import com.nukkitx.protocol.bedrock.data.inventory.ItemStackRequest;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData;
|
import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.CraftResultsDeprecatedStackRequestActionData;
|
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.CraftResultsDeprecatedStackRequestActionData;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData;
|
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionType;
|
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionType;
|
||||||
import com.nukkitx.protocol.bedrock.packet.ItemStackRequestPacket;
|
|
||||||
import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket;
|
import com.nukkitx.protocol.bedrock.packet.ItemStackResponsePacket;
|
||||||
import it.unimi.dsi.fastutil.ints.IntList;
|
import it.unimi.dsi.fastutil.ints.IntList;
|
||||||
import org.geysermc.connector.inventory.GeyserItemStack;
|
import org.geysermc.connector.inventory.GeyserItemStack;
|
||||||
|
@ -58,7 +58,7 @@ public class StonecutterInventoryTranslator extends AbstractBlockInventoryTransl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequestPacket.Request request) {
|
public ItemStackResponsePacket.Response translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) {
|
||||||
// TODO: Also surely to change in the future
|
// TODO: Also surely to change in the future
|
||||||
StackRequestActionData data = request.getActions()[1];
|
StackRequestActionData data = request.getActions()[1];
|
||||||
if (!(data instanceof CraftResultsDeprecatedStackRequestActionData)) {
|
if (!(data instanceof CraftResultsDeprecatedStackRequestActionData)) {
|
||||||
|
|
Loading…
Reference in a new issue