3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 00:00:41 +01:00

Remove unneeded GeyserItemStack constructor and add comments

Dieser Commit ist enthalten in:
Camotoy 2021-01-04 18:19:43 -05:00
Ursprung 8928d554a1
Commit 50f295b4cd
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F
5 geänderte Dateien mit 12 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -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() {

Datei anzeigen

@ -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,

Datei anzeigen

@ -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);

Datei anzeigen

@ -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> {

Datei anzeigen

@ -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> {