mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-12-12 01:40:44 +01:00
Remove unneeded GeyserItemStack constructor and add comments
This commit is contained in:
parent
8928d554a1
commit
50f295b4cd
5 changed files with 12 additions and 8 deletions
|
@ -91,11 +91,7 @@ public class GeyserItemStack {
|
|||
}
|
||||
|
||||
public static GeyserItemStack from(ItemStack itemStack) {
|
||||
return from(itemStack, 1);
|
||||
}
|
||||
|
||||
public static GeyserItemStack from(ItemStack itemStack, int netId) {
|
||||
return itemStack == null ? EMPTY : new GeyserItemStack(itemStack.getId(), itemStack.getAmount(), itemStack.getNbt(), netId);
|
||||
return itemStack == null ? EMPTY : new GeyserItemStack(itemStack.getId(), itemStack.getAmount(), itemStack.getNbt());
|
||||
}
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
|
|
|
@ -757,7 +757,7 @@ public abstract class InventoryTranslator {
|
|||
ItemStack javaCreativeItem = ItemTranslator.translateToJava(creativeItem);
|
||||
|
||||
if (isCursor(transferAction.getDestination())) {
|
||||
session.getPlayerInventory().setCursor(GeyserItemStack.from(javaCreativeItem, session.getNextItemNetId()), session);
|
||||
session.getPlayerInventory().setCursor(GeyserItemStack.from(javaCreativeItem), session);
|
||||
return acceptRequest(request, Collections.singletonList(
|
||||
new ItemStackResponsePacket.ContainerEntry(ContainerSlotType.CURSOR,
|
||||
Collections.singletonList(makeItemEntry(0, session.getPlayerInventory().getCursor())))));
|
||||
|
@ -769,7 +769,7 @@ public abstract class InventoryTranslator {
|
|||
existingItem.setAmount(existingItem.getAmount() + transferAction.getCount());
|
||||
javaCreativeItem = existingItem.getItemStack();
|
||||
} else {
|
||||
inventory.setItem(javaSlot, GeyserItemStack.from(javaCreativeItem, session.getNextItemNetId()), session);
|
||||
inventory.setItem(javaSlot, GeyserItemStack.from(javaCreativeItem), session);
|
||||
}
|
||||
ClientCreativeInventoryActionPacket creativeActionPacket = new ClientCreativeInventoryActionPacket(
|
||||
javaSlot,
|
||||
|
|
|
@ -86,7 +86,7 @@ public class StonecutterInventoryTranslator extends AbstractBlockInventoryTransl
|
|||
container.setStonecutterButton(button);
|
||||
if (inventory.getItem(1).getJavaId() != javaOutput.getId()) {
|
||||
// We don't know there is an output here, so we tell ourselves that there is
|
||||
inventory.setItem(1, GeyserItemStack.from(javaOutput, session.getNextItemNetId()), session);
|
||||
inventory.setItem(1, GeyserItemStack.from(javaOutput), session);
|
||||
}
|
||||
}
|
||||
return translateRequest(session, inventory, request);
|
||||
|
|
|
@ -47,6 +47,11 @@ import org.geysermc.connector.network.translators.item.*;
|
|||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Used to send all valid recipes from Java to Bedrock.
|
||||
*
|
||||
* Bedrock REQUIRES a CraftingDataPacket to be sent in order to craft anything.
|
||||
*/
|
||||
@Translator(packet = ServerDeclareRecipesPacket.class)
|
||||
public class JavaDeclareRecipesTranslator extends PacketTranslator<ServerDeclareRecipesPacket> {
|
||||
|
||||
|
|
|
@ -33,6 +33,9 @@ import org.geysermc.connector.network.translators.Translator;
|
|||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Used to list recipes that we can definitely use the recipe book for (and therefore save on packet usage)
|
||||
*/
|
||||
@Translator(packet = ServerUnlockRecipesPacket.class)
|
||||
public class JavaUnlockRecipesTranslator extends PacketTranslator<ServerUnlockRecipesPacket> {
|
||||
|
||||
|
|
Loading…
Reference in a new issue