Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-24 23:30:22 +01:00
Update to new renames in MCProtocolLib
Dieser Commit ist enthalten in:
Ursprung
393c2b0f91
Commit
e5869c00d6
@ -25,13 +25,13 @@
|
||||
|
||||
package org.geysermc.platform.spigot;
|
||||
|
||||
import com.github.steveice10.mc.protocol.MinecraftConstants;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.server.ServerListPingEvent;
|
||||
import org.bukkit.util.CachedServerIcon;
|
||||
import org.geysermc.connector.common.ping.GeyserPingInfo;
|
||||
import org.geysermc.connector.network.MinecraftProtocol;
|
||||
import org.geysermc.connector.ping.IGeyserPingPassthrough;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@ -52,7 +52,7 @@ public class GeyserSpigotPingPassthrough implements IGeyserPingPassthrough {
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
GeyserPingInfo geyserPingInfo = new GeyserPingInfo(event.getMotd(),
|
||||
new GeyserPingInfo.Players(event.getMaxPlayers(), event.getNumPlayers()),
|
||||
new GeyserPingInfo.Version(Bukkit.getVersion(), MinecraftConstants.PROTOCOL_VERSION) // thanks Spigot for not exposing this, just default to latest
|
||||
new GeyserPingInfo.Version(Bukkit.getVersion(), MinecraftProtocol.getJavaProtocolVersion()) // thanks Spigot for not exposing this, just default to latest
|
||||
);
|
||||
Bukkit.getOnlinePlayers().stream().map(Player::getName).forEach(geyserPingInfo.getPlayerList()::add);
|
||||
return geyserPingInfo;
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package org.geysermc.platform.spigot;
|
||||
|
||||
import com.github.steveice10.mc.protocol.MinecraftConstants;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.data.MappingData;
|
||||
import com.viaversion.viaversion.api.protocol.ProtocolPathEntry;
|
||||
@ -39,6 +38,7 @@ import org.geysermc.connector.command.CommandManager;
|
||||
import org.geysermc.connector.common.AuthType;
|
||||
import org.geysermc.connector.configuration.GeyserConfiguration;
|
||||
import org.geysermc.connector.dump.BootstrapDumpInfo;
|
||||
import org.geysermc.connector.network.MinecraftProtocol;
|
||||
import org.geysermc.connector.network.translators.world.WorldManager;
|
||||
import org.geysermc.connector.ping.GeyserLegacyPingPassthrough;
|
||||
import org.geysermc.connector.ping.IGeyserPingPassthrough;
|
||||
@ -342,7 +342,7 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap {
|
||||
*/
|
||||
private boolean isViaVersionNeeded() {
|
||||
ProtocolVersion serverVersion = getServerProtocolVersion();
|
||||
List<ProtocolPathEntry> protocolList = Via.getManager().getProtocolManager().getProtocolPath(MinecraftConstants.PROTOCOL_VERSION,
|
||||
List<ProtocolPathEntry> protocolList = Via.getManager().getProtocolManager().getProtocolPath(MinecraftProtocol.getJavaProtocolVersion(),
|
||||
serverVersion.getVersion());
|
||||
if (protocolList == null) {
|
||||
// No translation needed!
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package org.geysermc.platform.spigot.world;
|
||||
|
||||
import com.github.steveice10.mc.protocol.MinecraftConstants;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
|
||||
import com.github.steveice10.mc.protocol.data.game.recipe.Ingredient;
|
||||
import com.github.steveice10.mc.protocol.data.game.recipe.RecipeType;
|
||||
@ -48,6 +47,7 @@ import org.bukkit.inventory.Recipe;
|
||||
import org.bukkit.inventory.ShapedRecipe;
|
||||
import org.bukkit.inventory.ShapelessRecipe;
|
||||
import org.geysermc.connector.GeyserConnector;
|
||||
import org.geysermc.connector.network.MinecraftProtocol;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.connector.network.translators.item.ItemTranslator;
|
||||
import org.geysermc.connector.utils.InventoryUtils;
|
||||
@ -73,7 +73,7 @@ public class GeyserSpigot1_11CraftingListener implements Listener {
|
||||
public GeyserSpigot1_11CraftingListener(GeyserConnector connector) {
|
||||
this.connector = connector;
|
||||
this.mappingData1_12to1_13 = Via.getManager().getProtocolManager().getProtocol(Protocol1_13To1_12_2.class).getMappingData();
|
||||
this.protocolList = Via.getManager().getProtocolManager().getProtocolPath(MinecraftConstants.PROTOCOL_VERSION,
|
||||
this.protocolList = Via.getManager().getProtocolManager().getProtocolPath(MinecraftProtocol.getJavaProtocolVersion(),
|
||||
ProtocolVersion.v1_13.getVersion());
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package org.geysermc.platform.spigot.world.manager;
|
||||
|
||||
import com.github.steveice10.mc.protocol.MinecraftConstants;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.data.MappingData;
|
||||
import com.viaversion.viaversion.api.protocol.ProtocolPathEntry;
|
||||
@ -33,6 +32,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
import org.geysermc.connector.network.MinecraftProtocol;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.platform.spigot.GeyserSpigotPlugin;
|
||||
|
||||
@ -50,7 +50,7 @@ public class GeyserSpigotLegacyNativeWorldManager extends GeyserSpigotNativeWorl
|
||||
IntList allBlockStates = adapter.getAllBlockStates();
|
||||
oldToNewBlockId = new Int2IntOpenHashMap(allBlockStates.size());
|
||||
ProtocolVersion serverVersion = plugin.getServerProtocolVersion();
|
||||
List<ProtocolPathEntry> protocolList = Via.getManager().getProtocolManager().getProtocolPath(MinecraftConstants.PROTOCOL_VERSION,
|
||||
List<ProtocolPathEntry> protocolList = Via.getManager().getProtocolManager().getProtocolPath(MinecraftProtocol.getJavaProtocolVersion(),
|
||||
serverVersion.getVersion());
|
||||
for (int oldBlockId : allBlockStates) {
|
||||
int newBlockId = oldBlockId;
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package org.geysermc.platform.spigot.world.manager;
|
||||
|
||||
import com.github.steveice10.mc.protocol.MinecraftConstants;
|
||||
import com.nukkitx.math.vector.Vector3i;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
@ -39,6 +38,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BookMeta;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.geysermc.connector.network.MinecraftProtocol;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.connector.network.translators.inventory.translators.LecternInventoryTranslator;
|
||||
import org.geysermc.connector.network.translators.world.GeyserWorldManager;
|
||||
@ -57,7 +57,7 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager {
|
||||
/**
|
||||
* The current client protocol version for ViaVersion usage.
|
||||
*/
|
||||
protected static final int CLIENT_PROTOCOL_VERSION = MinecraftConstants.PROTOCOL_VERSION;
|
||||
protected static final int CLIENT_PROTOCOL_VERSION = MinecraftProtocol.getJavaProtocolVersion();
|
||||
|
||||
private final Plugin plugin;
|
||||
|
||||
|
@ -25,8 +25,8 @@
|
||||
|
||||
package org.geysermc.platform.sponge;
|
||||
|
||||
import com.github.steveice10.mc.protocol.MinecraftConstants;
|
||||
import org.geysermc.connector.common.ping.GeyserPingInfo;
|
||||
import org.geysermc.connector.network.MinecraftProtocol;
|
||||
import org.geysermc.connector.ping.IGeyserPingPassthrough;
|
||||
import org.spongepowered.api.MinecraftVersion;
|
||||
import org.spongepowered.api.Sponge;
|
||||
@ -73,7 +73,7 @@ public class GeyserSpongePingPassthrough implements IGeyserPingPassthrough {
|
||||
),
|
||||
new GeyserPingInfo.Version(
|
||||
event.getResponse().getVersion().getName(),
|
||||
MinecraftConstants.PROTOCOL_VERSION) // thanks for also not exposing this sponge
|
||||
MinecraftProtocol.getJavaProtocolVersion()) // thanks for also not exposing this sponge
|
||||
);
|
||||
event.getResponse().getPlayers().get().getProfiles().stream()
|
||||
.map(GameProfile::getName)
|
||||
|
@ -28,7 +28,6 @@ package org.geysermc.connector;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.github.steveice10.mc.protocol.MinecraftConstants;
|
||||
import com.github.steveice10.packetlib.tcp.TcpSession;
|
||||
import com.nukkitx.network.raknet.RakNetConstants;
|
||||
import com.nukkitx.network.util.EventLoops;
|
||||
@ -93,7 +92,6 @@ public class GeyserConnector {
|
||||
public static final String NAME = "Geyser";
|
||||
public static final String GIT_VERSION = "DEV"; // A fallback for running in IDEs
|
||||
public static final String VERSION = "DEV"; // A fallback for running in IDEs
|
||||
public static final String MINECRAFT_VERSION = MinecraftConstants.GAME_VERSION; // Change if multiple version strings are supported
|
||||
|
||||
/**
|
||||
* Oauth client ID for Microsoft authentication
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
package org.geysermc.connector.command.defaults;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.ClientRequest;
|
||||
import com.github.steveice10.mc.protocol.data.game.ClientCommand;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientCommandPacket;
|
||||
import org.geysermc.connector.GeyserConnector;
|
||||
import org.geysermc.connector.command.CommandSender;
|
||||
@ -43,7 +43,7 @@ public class StatisticsCommand extends GeyserCommand {
|
||||
if (session == null) return;
|
||||
|
||||
session.setWaitingForStatistics(true);
|
||||
ServerboundClientCommandPacket ServerboundClientCommandPacket = new ServerboundClientCommandPacket(ClientRequest.STATS);
|
||||
ServerboundClientCommandPacket ServerboundClientCommandPacket = new ServerboundClientCommandPacket(ClientCommand.STATS);
|
||||
session.sendDownstreamPacket(ServerboundClientCommandPacket);
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ import org.geysermc.connector.GeyserConnector;
|
||||
import org.geysermc.connector.command.CommandSender;
|
||||
import org.geysermc.connector.command.GeyserCommand;
|
||||
import org.geysermc.connector.common.ChatColor;
|
||||
import org.geysermc.connector.network.BedrockProtocol;
|
||||
import org.geysermc.connector.network.MinecraftProtocol;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.connector.utils.FileUtils;
|
||||
import org.geysermc.connector.utils.LanguageUtils;
|
||||
@ -56,15 +56,15 @@ public class VersionCommand extends GeyserCommand {
|
||||
@Override
|
||||
public void execute(GeyserSession session, CommandSender sender, String[] args) {
|
||||
String bedrockVersions;
|
||||
List<BedrockPacketCodec> supportedCodecs = BedrockProtocol.SUPPORTED_BEDROCK_CODECS;
|
||||
List<BedrockPacketCodec> supportedCodecs = MinecraftProtocol.SUPPORTED_BEDROCK_CODECS;
|
||||
if (supportedCodecs.size() > 1) {
|
||||
bedrockVersions = supportedCodecs.get(0).getMinecraftVersion() + " - " + supportedCodecs.get(supportedCodecs.size() - 1).getMinecraftVersion();
|
||||
} else {
|
||||
bedrockVersions = BedrockProtocol.SUPPORTED_BEDROCK_CODECS.get(0).getMinecraftVersion();
|
||||
bedrockVersions = MinecraftProtocol.SUPPORTED_BEDROCK_CODECS.get(0).getMinecraftVersion();
|
||||
}
|
||||
|
||||
sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.version.version", sender.getLocale(),
|
||||
GeyserConnector.NAME, GeyserConnector.VERSION, GeyserConnector.MINECRAFT_VERSION, bedrockVersions));
|
||||
GeyserConnector.NAME, GeyserConnector.VERSION, MinecraftProtocol.getJavaVersion(), bedrockVersions));
|
||||
|
||||
// Disable update checking in dev mode and for players in Geyser Standalone
|
||||
if (GeyserConnector.getInstance().isProductionEnvironment() && !(!sender.isConsole() && connector.getPlatformType() == PlatformType.STANDALONE)) {
|
||||
|
@ -27,7 +27,6 @@ package org.geysermc.connector.dump;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.github.steveice10.mc.protocol.MinecraftConstants;
|
||||
import com.google.common.hash.Hashing;
|
||||
import com.google.common.io.ByteSource;
|
||||
import com.google.common.io.Files;
|
||||
@ -39,7 +38,7 @@ import lombok.Getter;
|
||||
import org.geysermc.connector.GeyserConnector;
|
||||
import org.geysermc.connector.common.serializer.AsteriskSerializer;
|
||||
import org.geysermc.connector.configuration.GeyserConfiguration;
|
||||
import org.geysermc.connector.network.BedrockProtocol;
|
||||
import org.geysermc.connector.network.MinecraftProtocol;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.connector.utils.DockerCheck;
|
||||
import org.geysermc.connector.utils.FileUtils;
|
||||
@ -191,11 +190,11 @@ public class DumpInfo {
|
||||
private final int javaProtocol;
|
||||
|
||||
MCInfo() {
|
||||
this.bedrockVersions = BedrockProtocol.SUPPORTED_BEDROCK_CODECS.stream().map(BedrockPacketCodec::getMinecraftVersion).toList();
|
||||
this.bedrockProtocols = BedrockProtocol.SUPPORTED_BEDROCK_CODECS.stream().map(BedrockPacketCodec::getProtocolVersion).toList();
|
||||
this.defaultBedrockProtocol = BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion();
|
||||
this.javaVersion = MinecraftConstants.GAME_VERSION;
|
||||
this.javaProtocol = MinecraftConstants.PROTOCOL_VERSION;
|
||||
this.bedrockVersions = MinecraftProtocol.SUPPORTED_BEDROCK_CODECS.stream().map(BedrockPacketCodec::getMinecraftVersion).toList();
|
||||
this.bedrockProtocols = MinecraftProtocol.SUPPORTED_BEDROCK_CODECS.stream().map(BedrockPacketCodec::getProtocolVersion).toList();
|
||||
this.defaultBedrockProtocol = MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion();
|
||||
this.javaVersion = MinecraftProtocol.getJavaVersion();
|
||||
this.javaProtocol = MinecraftProtocol.getJavaProtocolVersion();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,13 +25,13 @@
|
||||
|
||||
package org.geysermc.connector.inventory;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.window.WindowType;
|
||||
import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType;
|
||||
|
||||
/**
|
||||
* Used to determine if rename packets should be sent.
|
||||
*/
|
||||
public class AnvilContainer extends Container {
|
||||
public AnvilContainer(String title, int id, int size, WindowType windowType, PlayerInventory playerInventory) {
|
||||
super(title, id, size, windowType, playerInventory);
|
||||
public AnvilContainer(String title, int id, int size, ContainerType containerType, PlayerInventory playerInventory) {
|
||||
super(title, id, size, containerType, playerInventory);
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
package org.geysermc.connector.inventory;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.window.WindowType;
|
||||
import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@ -35,7 +35,7 @@ public class BeaconContainer extends Container {
|
||||
private int primaryId;
|
||||
private int secondaryId;
|
||||
|
||||
public BeaconContainer(String title, int id, int size, WindowType windowType, PlayerInventory playerInventory) {
|
||||
super(title, id, size, windowType, playerInventory);
|
||||
public BeaconContainer(String title, int id, int size, ContainerType containerType, PlayerInventory playerInventory) {
|
||||
super(title, id, size, containerType, playerInventory);
|
||||
}
|
||||
}
|
||||
|
@ -25,10 +25,10 @@
|
||||
|
||||
package org.geysermc.connector.inventory;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.window.WindowType;
|
||||
import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType;
|
||||
|
||||
public class CartographyContainer extends Container {
|
||||
public CartographyContainer(String title, int id, int size, WindowType windowType, PlayerInventory playerInventory) {
|
||||
super(title, id, size, windowType, playerInventory);
|
||||
public CartographyContainer(String title, int id, int size, ContainerType containerType, PlayerInventory playerInventory) {
|
||||
super(title, id, size, containerType, playerInventory);
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
package org.geysermc.connector.inventory;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.window.WindowType;
|
||||
import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
@ -44,8 +44,8 @@ public class Container extends Inventory {
|
||||
*/
|
||||
private boolean isUsingRealBlock = false;
|
||||
|
||||
public Container(String title, int id, int size, WindowType windowType, PlayerInventory playerInventory) {
|
||||
super(title, id, size, windowType);
|
||||
public Container(String title, int id, int size, ContainerType containerType, PlayerInventory playerInventory) {
|
||||
super(title, id, size, containerType);
|
||||
this.playerInventory = playerInventory;
|
||||
this.containerSize = this.size + InventoryTranslator.PLAYER_INVENTORY_SIZE;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
package org.geysermc.connector.inventory;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.window.WindowType;
|
||||
import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.EnchantOptionData;
|
||||
import lombok.Getter;
|
||||
|
||||
@ -41,8 +41,8 @@ public class EnchantingContainer extends Container {
|
||||
@Getter
|
||||
private final GeyserEnchantOption[] geyserEnchantOptions;
|
||||
|
||||
public EnchantingContainer(String title, int id, int size, WindowType windowType, PlayerInventory playerInventory) {
|
||||
super(title, id, size, windowType, playerInventory);
|
||||
public EnchantingContainer(String title, int id, int size, ContainerType containerType, PlayerInventory playerInventory) {
|
||||
super(title, id, size, containerType, playerInventory);
|
||||
|
||||
enchantOptions = new EnchantOptionData[3];
|
||||
geyserEnchantOptions = new GeyserEnchantOption[3];
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
package org.geysermc.connector.inventory;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.window.WindowType;
|
||||
import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType;
|
||||
import lombok.Getter;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
|
||||
@ -38,8 +38,8 @@ public class Generic3X3Container extends Container {
|
||||
@Getter
|
||||
private boolean isDropper = false;
|
||||
|
||||
public Generic3X3Container(String title, int id, int size, WindowType windowType, PlayerInventory playerInventory) {
|
||||
super(title, id, size, windowType, playerInventory);
|
||||
public Generic3X3Container(String title, int id, int size, ContainerType containerType, PlayerInventory playerInventory) {
|
||||
super(title, id, size, containerType, playerInventory);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
package org.geysermc.connector.inventory;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.window.WindowType;
|
||||
import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType;
|
||||
import com.github.steveice10.opennbt.tag.builtin.ByteTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
||||
@ -58,7 +58,7 @@ public class Inventory {
|
||||
* Used for smooth transitions between two windows of the same type.
|
||||
*/
|
||||
@Getter
|
||||
protected final WindowType windowType;
|
||||
protected final ContainerType containerType;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ -81,15 +81,15 @@ public class Inventory {
|
||||
@Setter
|
||||
private boolean pending = false;
|
||||
|
||||
protected Inventory(int id, int size, WindowType windowType) {
|
||||
this("Inventory", id, size, windowType);
|
||||
protected Inventory(int id, int size, ContainerType containerType) {
|
||||
this("Inventory", id, size, containerType);
|
||||
}
|
||||
|
||||
protected Inventory(String title, int id, int size, WindowType windowType) {
|
||||
protected Inventory(String title, int id, int size, ContainerType containerType) {
|
||||
this.title = title;
|
||||
this.id = id;
|
||||
this.size = size;
|
||||
this.windowType = windowType;
|
||||
this.containerType = containerType;
|
||||
this.items = new GeyserItemStack[size];
|
||||
Arrays.fill(items, GeyserItemStack.EMPTY);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
package org.geysermc.connector.inventory;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.window.WindowType;
|
||||
import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType;
|
||||
import com.nukkitx.math.vector.Vector3i;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import lombok.Getter;
|
||||
@ -39,7 +39,7 @@ public class LecternContainer extends Container {
|
||||
@Getter @Setter
|
||||
private Vector3i position;
|
||||
|
||||
public LecternContainer(String title, int id, int size, WindowType windowType, PlayerInventory playerInventory) {
|
||||
super(title, id, size, windowType, playerInventory);
|
||||
public LecternContainer(String title, int id, int size, ContainerType containerType, PlayerInventory playerInventory) {
|
||||
super(title, id, size, containerType, playerInventory);
|
||||
}
|
||||
}
|
||||
|
@ -25,8 +25,8 @@
|
||||
|
||||
package org.geysermc.connector.inventory;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.window.VillagerTrade;
|
||||
import com.github.steveice10.mc.protocol.data.game.window.WindowType;
|
||||
import com.github.steveice10.mc.protocol.data.game.inventory.VillagerTrade;
|
||||
import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.geysermc.connector.entity.Entity;
|
||||
@ -37,7 +37,7 @@ public class MerchantContainer extends Container {
|
||||
private Entity villager;
|
||||
private VillagerTrade[] villagerTrades;
|
||||
|
||||
public MerchantContainer(String title, int id, int size, WindowType windowType, PlayerInventory playerInventory) {
|
||||
super(title, id, size, windowType, playerInventory);
|
||||
public MerchantContainer(String title, int id, int size, ContainerType containerType, PlayerInventory playerInventory) {
|
||||
super(title, id, size, containerType, playerInventory);
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
package org.geysermc.connector.inventory;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.window.WindowType;
|
||||
import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.Setter;
|
||||
@ -39,8 +39,8 @@ public class StonecutterContainer extends Container {
|
||||
@Setter
|
||||
private int stonecutterButton = -1;
|
||||
|
||||
public StonecutterContainer(String title, int id, int size, WindowType windowType, PlayerInventory playerInventory) {
|
||||
super(title, id, size, windowType, playerInventory);
|
||||
public StonecutterContainer(String title, int id, int size, ContainerType containerType, PlayerInventory playerInventory) {
|
||||
super(title, id, size, containerType, playerInventory);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -50,7 +50,7 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler {
|
||||
/*
|
||||
The following constants are all used to ensure the ping does not reach a length where it is unparsable by the Bedrock client
|
||||
*/
|
||||
private static final int MINECRAFT_VERSION_BYTES_LENGTH = BedrockProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion().getBytes(StandardCharsets.UTF_8).length;
|
||||
private static final int MINECRAFT_VERSION_BYTES_LENGTH = MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion().getBytes(StandardCharsets.UTF_8).length;
|
||||
private static final int BRAND_BYTES_LENGTH = GeyserConnector.NAME.getBytes(StandardCharsets.UTF_8).length;
|
||||
/**
|
||||
* The MOTD, sub-MOTD and Minecraft version ({@link #MINECRAFT_VERSION_BYTES_LENGTH}) combined cannot reach this length.
|
||||
@ -104,8 +104,8 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler {
|
||||
pong.setEdition("MCPE");
|
||||
pong.setGameType("Survival"); // Can only be Survival or Creative as of 1.16.210.59
|
||||
pong.setNintendoLimited(false);
|
||||
pong.setProtocolVersion(BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion());
|
||||
pong.setVersion(BedrockProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion()); // Required to not be empty as of 1.16.210.59. Can only contain . and numbers.
|
||||
pong.setProtocolVersion(MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion());
|
||||
pong.setVersion(MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion()); // Required to not be empty as of 1.16.210.59. Can only contain . and numbers.
|
||||
pong.setIpv4Port(config.getBedrock().getPort());
|
||||
|
||||
if (config.isPassthroughMotd() && pingInfo != null && pingInfo.getDescription() != null) {
|
||||
@ -170,7 +170,7 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler {
|
||||
bedrockServerSession.setCompressionLevel(connector.getConfig().getBedrock().getCompressionLevel());
|
||||
bedrockServerSession.setPacketHandler(new UpstreamPacketHandler(connector, new GeyserSession(connector, bedrockServerSession, eventLoopGroup.next())));
|
||||
// Set the packet codec to default just in case we need to send disconnect packets.
|
||||
bedrockServerSession.setPacketCodec(BedrockProtocol.DEFAULT_BEDROCK_CODEC);
|
||||
bedrockServerSession.setPacketCodec(MinecraftProtocol.DEFAULT_BEDROCK_CODEC);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,6 +25,8 @@
|
||||
|
||||
package org.geysermc.connector.network;
|
||||
|
||||
import com.github.steveice10.mc.protocol.codec.MinecraftCodec;
|
||||
import com.github.steveice10.mc.protocol.codec.PacketCodec;
|
||||
import com.nukkitx.protocol.bedrock.BedrockPacketCodec;
|
||||
import com.nukkitx.protocol.bedrock.v465.Bedrock_v465;
|
||||
import com.nukkitx.protocol.bedrock.v471.Bedrock_v471;
|
||||
@ -34,9 +36,9 @@ import java.util.List;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
/**
|
||||
* Contains information about the supported Bedrock protocols in Geyser.
|
||||
* Contains information about the supported protocols in Geyser.
|
||||
*/
|
||||
public class BedrockProtocol {
|
||||
public class MinecraftProtocol {
|
||||
/**
|
||||
* Default Bedrock codec that should act as a fallback. Should represent the latest available
|
||||
* release of the game that Geyser supports.
|
||||
@ -47,6 +49,12 @@ public class BedrockProtocol {
|
||||
*/
|
||||
public static final List<BedrockPacketCodec> SUPPORTED_BEDROCK_CODECS = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Java codec that is supported. We only ever support one version for
|
||||
* Java Edition.
|
||||
*/
|
||||
private static final PacketCodec DEFAULT_JAVA_CODEC = MinecraftCodec.CODEC;
|
||||
|
||||
static {
|
||||
SUPPORTED_BEDROCK_CODECS.add(Bedrock_v465.V465_CODEC);
|
||||
SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC);
|
||||
@ -66,6 +74,33 @@ public class BedrockProtocol {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the {@link PacketCodec} for Minecraft: Java Edition.
|
||||
*
|
||||
* @return the packet codec for Minecraft: Java Edition
|
||||
*/
|
||||
public static PacketCodec getJavaCodec() {
|
||||
return DEFAULT_JAVA_CODEC;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the supported Minecraft: Java Edition version name.
|
||||
*
|
||||
* @return the supported Minecraft: Java Edition version name
|
||||
*/
|
||||
public static String getJavaVersion() {
|
||||
return DEFAULT_JAVA_CODEC.getMinecraftVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the supported Minecraft: Java Edition protocol version.
|
||||
*
|
||||
* @return the supported Minecraft: Java Edition protocol version
|
||||
*/
|
||||
public static int getJavaProtocolVersion() {
|
||||
return DEFAULT_JAVA_CODEC.getProtocolVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a string showing all supported versions for this Geyser instance
|
||||
*/
|
@ -175,7 +175,7 @@ public class QueryPacketHandler {
|
||||
gameData.put("hostname", motd);
|
||||
gameData.put("gametype", "SMP");
|
||||
gameData.put("game_id", "MINECRAFT");
|
||||
gameData.put("version", GeyserConnector.NAME + " (" + GeyserConnector.GIT_VERSION + ") " + BedrockProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion());
|
||||
gameData.put("version", GeyserConnector.NAME + " (" + GeyserConnector.GIT_VERSION + ") " + MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion());
|
||||
gameData.put("plugins", "");
|
||||
gameData.put("map", map);
|
||||
gameData.put("numplayers", currentPlayerCount);
|
||||
|
@ -66,15 +66,15 @@ public class UpstreamPacketHandler extends LoggingPacketHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
BedrockPacketCodec packetCodec = BedrockProtocol.getBedrockCodec(loginPacket.getProtocolVersion());
|
||||
BedrockPacketCodec packetCodec = MinecraftProtocol.getBedrockCodec(loginPacket.getProtocolVersion());
|
||||
if (packetCodec == null) {
|
||||
String supportedVersions = BedrockProtocol.getAllSupportedVersions();
|
||||
if (loginPacket.getProtocolVersion() > BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) {
|
||||
String supportedVersions = MinecraftProtocol.getAllSupportedVersions();
|
||||
if (loginPacket.getProtocolVersion() > MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) {
|
||||
// Too early to determine session locale
|
||||
session.getConnector().getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.outdated.server", supportedVersions));
|
||||
session.disconnect(LanguageUtils.getLocaleStringLog("geyser.network.outdated.server", supportedVersions));
|
||||
return true;
|
||||
} else if (loginPacket.getProtocolVersion() < BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) {
|
||||
} else if (loginPacket.getProtocolVersion() < MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()) {
|
||||
session.getConnector().getLogger().info(LanguageUtils.getLocaleStringLog("geyser.network.outdated.client", supportedVersions));
|
||||
session.disconnect(LanguageUtils.getLocaleStringLog("geyser.network.outdated.client", supportedVersions));
|
||||
return true;
|
||||
|
@ -34,7 +34,7 @@ import com.github.steveice10.mc.auth.service.MojangAuthenticationService;
|
||||
import com.github.steveice10.mc.auth.service.MsaAuthenticationService;
|
||||
import com.github.steveice10.mc.protocol.MinecraftConstants;
|
||||
import com.github.steveice10.mc.protocol.MinecraftProtocol;
|
||||
import com.github.steveice10.mc.protocol.data.SubProtocol;
|
||||
import com.github.steveice10.mc.protocol.data.ProtocolState;
|
||||
import com.github.steveice10.mc.protocol.data.UnexpectedEncryptionException;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
|
||||
@ -1333,7 +1333,7 @@ public class GeyserSession implements CommandSender {
|
||||
}
|
||||
|
||||
private void sendDownstreamPacket0(Packet packet) {
|
||||
if (protocol.getSubProtocol().equals(SubProtocol.GAME) || packet.getClass() == ServerboundCustomQueryPacket.class) {
|
||||
if (protocol.getState().equals(ProtocolState.GAME) || packet.getClass() == ServerboundCustomQueryPacket.class) {
|
||||
downstream.send(packet);
|
||||
} else {
|
||||
connector.getLogger().debug("Tried to send downstream packet " + packet.getClass().getSimpleName() + " before connected to the server");
|
||||
|
@ -26,7 +26,7 @@
|
||||
package org.geysermc.connector.network.session.cache;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.advancement.Advancement;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundSeenAdvancementsPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSeenAdvancementsPacket;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
package org.geysermc.connector.network.session.cache;
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundEditBookPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundEditBookPacket;
|
||||
import lombok.Setter;
|
||||
import org.geysermc.connector.inventory.GeyserItemStack;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
|
@ -26,19 +26,19 @@
|
||||
package org.geysermc.connector.network.session.cache;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.chunk.Chunk;
|
||||
import com.github.steveice10.mc.protocol.data.game.chunk.Column;
|
||||
import com.github.steveice10.mc.protocol.data.game.chunk.ChunkSection;
|
||||
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.connector.network.translators.world.block.BlockStateValues;
|
||||
import org.geysermc.connector.network.translators.world.chunk.GeyserColumn;
|
||||
import org.geysermc.connector.network.translators.world.chunk.GeyserChunk;
|
||||
import org.geysermc.connector.utils.MathUtils;
|
||||
|
||||
public class ChunkCache {
|
||||
private final boolean cache;
|
||||
private final Long2ObjectMap<GeyserColumn> chunks;
|
||||
private final Long2ObjectMap<GeyserChunk> chunks;
|
||||
|
||||
@Setter
|
||||
private int minY;
|
||||
@ -57,20 +57,20 @@ public class ChunkCache {
|
||||
chunks = cache ? new Long2ObjectOpenHashMap<>() : null;
|
||||
}
|
||||
|
||||
public void addToCache(Column chunk) {
|
||||
public void addToCache(Chunk chunk) {
|
||||
if (!cache) {
|
||||
return;
|
||||
}
|
||||
|
||||
long chunkPosition = MathUtils.chunkPositionToLong(chunk.getX(), chunk.getZ());
|
||||
GeyserColumn geyserColumn = GeyserColumn.from(this, chunk);
|
||||
chunks.put(chunkPosition, geyserColumn);
|
||||
GeyserChunk geyserChunk = GeyserChunk.from(this, chunk);
|
||||
chunks.put(chunkPosition, geyserChunk);
|
||||
}
|
||||
|
||||
/**
|
||||
* Doesn't check for cache enabled, so don't use this without checking that first!
|
||||
*/
|
||||
private GeyserColumn getChunk(int chunkX, int chunkZ) {
|
||||
private GeyserChunk getChunk(int chunkX, int chunkZ) {
|
||||
long chunkPosition = MathUtils.chunkPositionToLong(chunkX, chunkZ);
|
||||
return chunks.getOrDefault(chunkPosition, null);
|
||||
}
|
||||
@ -80,31 +80,31 @@ public class ChunkCache {
|
||||
return;
|
||||
}
|
||||
|
||||
GeyserColumn column = this.getChunk(x >> 4, z >> 4);
|
||||
if (column == null) {
|
||||
GeyserChunk chunk = this.getChunk(x >> 4, z >> 4);
|
||||
if (chunk == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (y < minY || ((y - minY) >> 4) > column.getChunks().length - 1) {
|
||||
if (y < minY || ((y - minY) >> 4) > chunk.getSections().length - 1) {
|
||||
// Y likely goes above or below the height limit of this world
|
||||
return;
|
||||
}
|
||||
|
||||
Chunk chunk = column.getChunks()[(y - minY) >> 4];
|
||||
if (chunk == null) {
|
||||
ChunkSection section = chunk.getSections()[(y - minY) >> 4];
|
||||
if (section == null) {
|
||||
if (block != BlockStateValues.JAVA_AIR_ID) {
|
||||
// A previously empty chunk, which is no longer empty as a block has been added to it
|
||||
chunk = new Chunk();
|
||||
section = new ChunkSection();
|
||||
// Fixes the chunk assuming that all blocks is the `block` variable we are updating. /shrug
|
||||
chunk.getPalette().stateToId(BlockStateValues.JAVA_AIR_ID);
|
||||
column.getChunks()[(y - minY) >> 4] = chunk;
|
||||
section.getPalette().stateToId(BlockStateValues.JAVA_AIR_ID);
|
||||
chunk.getSections()[(y - minY) >> 4] = section;
|
||||
} else {
|
||||
// Nothing to update
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
chunk.set(x & 0xF, y & 0xF, z & 0xF, block);
|
||||
section.set(x & 0xF, y & 0xF, z & 0xF, block);
|
||||
}
|
||||
|
||||
public int getBlockAt(int x, int y, int z) {
|
||||
@ -112,17 +112,17 @@ public class ChunkCache {
|
||||
return BlockStateValues.JAVA_AIR_ID;
|
||||
}
|
||||
|
||||
GeyserColumn column = this.getChunk(x >> 4, z >> 4);
|
||||
GeyserChunk column = this.getChunk(x >> 4, z >> 4);
|
||||
if (column == null) {
|
||||
return BlockStateValues.JAVA_AIR_ID;
|
||||
}
|
||||
|
||||
if (y < minY || ((y - minY) >> 4) > column.getChunks().length - 1) {
|
||||
if (y < minY || ((y - minY) >> 4) > column.getSections().length - 1) {
|
||||
// Y likely goes above or below the height limit of this world
|
||||
return BlockStateValues.JAVA_AIR_ID;
|
||||
}
|
||||
|
||||
Chunk chunk = column.getChunks()[(y - minY) >> 4];
|
||||
ChunkSection chunk = column.getSections()[(y - minY) >> 4];
|
||||
if (chunk != null) {
|
||||
return chunk.get(x & 0xF, y & 0xF, z & 0xF);
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
package org.geysermc.connector.network.translators.bedrock;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundSetJigsawBlockPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetJigsawBlockPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundSignUpdatePacket;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket;
|
||||
|
@ -26,7 +26,7 @@
|
||||
package org.geysermc.connector.network.translators.bedrock;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundEditBookPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundEditBookPacket;
|
||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.ListTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.StringTag;
|
||||
|
@ -27,8 +27,8 @@ package org.geysermc.connector.network.translators.bedrock;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.block.CommandBlockMode;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundSetCommandMinecartPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundSetCommandBlockPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetCommandMinecartPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetCommandBlockPacket;
|
||||
import com.nukkitx.protocol.bedrock.packet.CommandBlockUpdatePacket;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.connector.network.translators.PacketTranslator;
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
package org.geysermc.connector.network.translators.bedrock;
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundContainerClosePacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClosePacket;
|
||||
import com.nukkitx.protocol.bedrock.packet.ContainerClosePacket;
|
||||
import org.geysermc.connector.inventory.Inventory;
|
||||
import org.geysermc.connector.inventory.MerchantContainer;
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
package org.geysermc.connector.network.translators.bedrock;
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundRenameItemPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundRenameItemPacket;
|
||||
import com.nukkitx.protocol.bedrock.packet.FilterTextPacket;
|
||||
import org.geysermc.connector.inventory.AnvilContainer;
|
||||
import org.geysermc.connector.inventory.CartographyContainer;
|
||||
|
@ -29,8 +29,8 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.block.BlockFace;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundUseItemOnPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundContainerButtonClickPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundContainerClosePacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerButtonClickPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClosePacket;
|
||||
import com.nukkitx.protocol.bedrock.packet.LecternUpdatePacket;
|
||||
import org.geysermc.connector.inventory.LecternContainer;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
package org.geysermc.connector.network.translators.bedrock;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.ClientRequest;
|
||||
import com.github.steveice10.mc.protocol.data.game.ClientCommand;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientCommandPacket;
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket;
|
||||
@ -68,7 +68,7 @@ public class BedrockRespawnTranslator extends PacketTranslator<RespawnPacket> {
|
||||
session.sendUpstreamPacket(movePlayerPacket);
|
||||
}
|
||||
|
||||
ServerboundClientCommandPacket javaRespawnPacket = new ServerboundClientCommandPacket(ClientRequest.RESPAWN);
|
||||
ServerboundClientCommandPacket javaRespawnPacket = new ServerboundClientCommandPacket(ClientCommand.RESPAWN);
|
||||
session.sendDownstreamPacket(javaRespawnPacket);
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.connector.network.translators.PacketTranslator;
|
||||
import org.geysermc.connector.network.translators.Translator;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.ClientRequest;
|
||||
import com.github.steveice10.mc.protocol.data.game.ClientCommand;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientCommandPacket;
|
||||
import com.nukkitx.protocol.bedrock.packet.ShowCreditsPacket;
|
||||
|
||||
@ -39,7 +39,7 @@ public class BedrockShowCreditsTranslator extends PacketTranslator<ShowCreditsPa
|
||||
@Override
|
||||
public void translate(GeyserSession session, ShowCreditsPacket packet) {
|
||||
if (packet.getStatus() == ShowCreditsPacket.Status.END_CREDITS) {
|
||||
ServerboundClientCommandPacket javaRespawnPacket = new ServerboundClientCommandPacket(ClientRequest.RESPAWN);
|
||||
ServerboundClientCommandPacket javaRespawnPacket = new ServerboundClientCommandPacket(ClientCommand.RESPAWN);
|
||||
session.sendDownstreamPacket(javaRespawnPacket);
|
||||
}
|
||||
}
|
||||
|
@ -25,8 +25,8 @@
|
||||
|
||||
package org.geysermc.connector.network.translators.bedrock.entity;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.window.VillagerTrade;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundSelectTradePacket;
|
||||
import com.github.steveice10.mc.protocol.data.game.inventory.VillagerTrade;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSelectTradePacket;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityData;
|
||||
import com.nukkitx.protocol.bedrock.packet.EntityEventPacket;
|
||||
import org.geysermc.connector.entity.Entity;
|
||||
|
@ -31,7 +31,7 @@ import com.github.steveice10.mc.protocol.data.game.recipe.Ingredient;
|
||||
import com.github.steveice10.mc.protocol.data.game.recipe.Recipe;
|
||||
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.window.WindowType;
|
||||
import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType;
|
||||
import com.github.steveice10.opennbt.tag.builtin.IntTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
@ -64,42 +64,42 @@ import java.util.*;
|
||||
public abstract class InventoryTranslator {
|
||||
|
||||
public static final InventoryTranslator PLAYER_INVENTORY_TRANSLATOR = new PlayerInventoryTranslator();
|
||||
public static final Map<WindowType, InventoryTranslator> INVENTORY_TRANSLATORS = new HashMap<>() {
|
||||
public static final Map<ContainerType, InventoryTranslator> INVENTORY_TRANSLATORS = new HashMap<>() {
|
||||
{
|
||||
/* Player Inventory */
|
||||
put(null, PLAYER_INVENTORY_TRANSLATOR);
|
||||
|
||||
/* Chest UIs */
|
||||
put(WindowType.GENERIC_9X1, new SingleChestInventoryTranslator(9));
|
||||
put(WindowType.GENERIC_9X2, new SingleChestInventoryTranslator(18));
|
||||
put(WindowType.GENERIC_9X3, new SingleChestInventoryTranslator(27));
|
||||
put(WindowType.GENERIC_9X4, new DoubleChestInventoryTranslator(36));
|
||||
put(WindowType.GENERIC_9X5, new DoubleChestInventoryTranslator(45));
|
||||
put(WindowType.GENERIC_9X6, new DoubleChestInventoryTranslator(54));
|
||||
put(ContainerType.GENERIC_9X1, new SingleChestInventoryTranslator(9));
|
||||
put(ContainerType.GENERIC_9X2, new SingleChestInventoryTranslator(18));
|
||||
put(ContainerType.GENERIC_9X3, new SingleChestInventoryTranslator(27));
|
||||
put(ContainerType.GENERIC_9X4, new DoubleChestInventoryTranslator(36));
|
||||
put(ContainerType.GENERIC_9X5, new DoubleChestInventoryTranslator(45));
|
||||
put(ContainerType.GENERIC_9X6, new DoubleChestInventoryTranslator(54));
|
||||
|
||||
/* Furnaces */
|
||||
put(WindowType.FURNACE, new FurnaceInventoryTranslator());
|
||||
put(WindowType.BLAST_FURNACE, new BlastFurnaceInventoryTranslator());
|
||||
put(WindowType.SMOKER, new SmokerInventoryTranslator());
|
||||
put(ContainerType.FURNACE, new FurnaceInventoryTranslator());
|
||||
put(ContainerType.BLAST_FURNACE, new BlastFurnaceInventoryTranslator());
|
||||
put(ContainerType.SMOKER, new SmokerInventoryTranslator());
|
||||
|
||||
/* Specific Inventories */
|
||||
put(WindowType.ANVIL, new AnvilInventoryTranslator());
|
||||
put(WindowType.BEACON, new BeaconInventoryTranslator());
|
||||
put(WindowType.BREWING_STAND, new BrewingInventoryTranslator());
|
||||
put(WindowType.CARTOGRAPHY, new CartographyInventoryTranslator());
|
||||
put(WindowType.CRAFTING, new CraftingInventoryTranslator());
|
||||
put(WindowType.ENCHANTMENT, new EnchantingInventoryTranslator());
|
||||
put(WindowType.HOPPER, new HopperInventoryTranslator());
|
||||
put(WindowType.GENERIC_3X3, new Generic3X3InventoryTranslator());
|
||||
put(WindowType.GRINDSTONE, new GrindstoneInventoryTranslator());
|
||||
put(WindowType.LOOM, new LoomInventoryTranslator());
|
||||
put(WindowType.MERCHANT, new MerchantInventoryTranslator());
|
||||
put(WindowType.SHULKER_BOX, new ShulkerInventoryTranslator());
|
||||
put(WindowType.SMITHING, new SmithingInventoryTranslator());
|
||||
put(WindowType.STONECUTTER, new StonecutterInventoryTranslator());
|
||||
put(ContainerType.ANVIL, new AnvilInventoryTranslator());
|
||||
put(ContainerType.BEACON, new BeaconInventoryTranslator());
|
||||
put(ContainerType.BREWING_STAND, new BrewingInventoryTranslator());
|
||||
put(ContainerType.CARTOGRAPHY, new CartographyInventoryTranslator());
|
||||
put(ContainerType.CRAFTING, new CraftingInventoryTranslator());
|
||||
put(ContainerType.ENCHANTMENT, new EnchantingInventoryTranslator());
|
||||
put(ContainerType.HOPPER, new HopperInventoryTranslator());
|
||||
put(ContainerType.GENERIC_3X3, new Generic3X3InventoryTranslator());
|
||||
put(ContainerType.GRINDSTONE, new GrindstoneInventoryTranslator());
|
||||
put(ContainerType.LOOM, new LoomInventoryTranslator());
|
||||
put(ContainerType.MERCHANT, new MerchantInventoryTranslator());
|
||||
put(ContainerType.SHULKER_BOX, new ShulkerInventoryTranslator());
|
||||
put(ContainerType.SMITHING, new SmithingInventoryTranslator());
|
||||
put(ContainerType.STONECUTTER, new StonecutterInventoryTranslator());
|
||||
|
||||
/* Lectern */
|
||||
put(WindowType.LECTERN, new LecternInventoryTranslator());
|
||||
put(ContainerType.LECTERN, new LecternInventoryTranslator());
|
||||
}
|
||||
};
|
||||
|
||||
@ -118,7 +118,7 @@ public abstract class InventoryTranslator {
|
||||
public abstract int javaSlotToBedrock(int javaSlot);
|
||||
public abstract BedrockContainerSlot javaSlotToBedrockContainer(int javaSlot);
|
||||
public abstract SlotType getSlotType(int javaSlot);
|
||||
public abstract Inventory createInventory(String name, int windowId, WindowType windowType, PlayerInventory playerInventory);
|
||||
public abstract Inventory createInventory(String name, int windowId, ContainerType containerType, PlayerInventory playerInventory);
|
||||
|
||||
/**
|
||||
* Should be overwritten in cases where specific inventories should reject an item being in a specific spot.
|
||||
|
@ -25,21 +25,23 @@
|
||||
|
||||
package org.geysermc.connector.network.translators.inventory.click;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.window.*;
|
||||
import com.github.steveice10.mc.protocol.data.game.inventory.ClickItemAction;
|
||||
import com.github.steveice10.mc.protocol.data.game.inventory.ContainerActionType;
|
||||
import com.github.steveice10.mc.protocol.data.game.inventory.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
@AllArgsConstructor
|
||||
public enum Click {
|
||||
LEFT(WindowAction.CLICK_ITEM, ClickItemParam.LEFT_CLICK),
|
||||
RIGHT(WindowAction.CLICK_ITEM, ClickItemParam.RIGHT_CLICK),
|
||||
LEFT_SHIFT(WindowAction.SHIFT_CLICK_ITEM, ShiftClickItemParam.LEFT_CLICK),
|
||||
DROP_ONE(WindowAction.DROP_ITEM, DropItemParam.DROP_FROM_SELECTED),
|
||||
DROP_ALL(WindowAction.DROP_ITEM, DropItemParam.DROP_SELECTED_STACK),
|
||||
LEFT_OUTSIDE(WindowAction.CLICK_ITEM, ClickItemParam.LEFT_CLICK),
|
||||
RIGHT_OUTSIDE(WindowAction.CLICK_ITEM, ClickItemParam.RIGHT_CLICK);
|
||||
LEFT(ContainerActionType.CLICK_ITEM, ClickItemAction.LEFT_CLICK),
|
||||
RIGHT(ContainerActionType.CLICK_ITEM, ClickItemAction.RIGHT_CLICK),
|
||||
LEFT_SHIFT(ContainerActionType.SHIFT_CLICK_ITEM, ShiftClickItemAction.LEFT_CLICK),
|
||||
DROP_ONE(ContainerActionType.DROP_ITEM, DropItemAction.DROP_FROM_SELECTED),
|
||||
DROP_ALL(ContainerActionType.DROP_ITEM, DropItemAction.DROP_SELECTED_STACK),
|
||||
LEFT_OUTSIDE(ContainerActionType.CLICK_ITEM, ClickItemAction.LEFT_CLICK),
|
||||
RIGHT_OUTSIDE(ContainerActionType.CLICK_ITEM, ClickItemAction.RIGHT_CLICK);
|
||||
|
||||
public static final int OUTSIDE_SLOT = -999;
|
||||
|
||||
public final WindowAction windowAction;
|
||||
public final WindowActionParam actionParam;
|
||||
public final ContainerActionType actionType;
|
||||
public final ContainerAction action;
|
||||
}
|
||||
|
@ -26,8 +26,8 @@
|
||||
package org.geysermc.connector.network.translators.inventory.click;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
|
||||
import com.github.steveice10.mc.protocol.data.game.window.WindowAction;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundContainerClickPacket;
|
||||
import com.github.steveice10.mc.protocol.data.game.inventory.ContainerActionType;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClickPacket;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
||||
@ -111,7 +111,7 @@ public class ClickPlan {
|
||||
ItemStack clickedItemStack;
|
||||
if (!planIter.hasNext() && refresh) {
|
||||
clickedItemStack = InventoryUtils.REFRESH_ITEM;
|
||||
} else if (action.click.windowAction == WindowAction.DROP_ITEM || action.slot == Click.OUTSIDE_SLOT) {
|
||||
} else if (action.click.actionType == ContainerActionType.DROP_ITEM || action.slot == Click.OUTSIDE_SLOT) {
|
||||
clickedItemStack = null;
|
||||
} else {
|
||||
clickedItemStack = getItem(action.slot).getItemStack();
|
||||
@ -126,8 +126,8 @@ public class ClickPlan {
|
||||
inventory.getId(),
|
||||
inventory.getStateId(),
|
||||
action.slot,
|
||||
action.click.windowAction,
|
||||
action.click.actionParam,
|
||||
action.click.actionType,
|
||||
action.click.action,
|
||||
clickedItemStack,
|
||||
affectedSlots
|
||||
);
|
||||
|
@ -25,9 +25,8 @@
|
||||
|
||||
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.inventory.ContainerType;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.ContainerType;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData;
|
||||
import org.geysermc.connector.inventory.AnvilContainer;
|
||||
import org.geysermc.connector.inventory.Inventory;
|
||||
@ -37,7 +36,7 @@ import org.geysermc.connector.network.translators.inventory.updater.UIInventoryU
|
||||
|
||||
public class AnvilInventoryTranslator extends AbstractBlockInventoryTranslator {
|
||||
public AnvilInventoryTranslator() {
|
||||
super(3, "minecraft:anvil[facing=north]", ContainerType.ANVIL, UIInventoryUpdater.INSTANCE,
|
||||
super(3, "minecraft:anvil[facing=north]", com.nukkitx.protocol.bedrock.data.inventory.ContainerType.ANVIL, UIInventoryUpdater.INSTANCE,
|
||||
"minecraft:chipped_anvil", "minecraft:damaged_anvil");
|
||||
}
|
||||
|
||||
@ -72,7 +71,7 @@ public class AnvilInventoryTranslator extends AbstractBlockInventoryTranslator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory createInventory(String name, int windowId, WindowType windowType, PlayerInventory playerInventory) {
|
||||
return new AnvilContainer(name, windowId, this.size, windowType, playerInventory);
|
||||
public Inventory createInventory(String name, int windowId, ContainerType containerType, PlayerInventory playerInventory) {
|
||||
return new AnvilContainer(name, windowId, this.size, containerType, playerInventory);
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
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.inventory.ContainerType;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData;
|
||||
import org.geysermc.connector.inventory.Container;
|
||||
@ -95,7 +95,7 @@ public abstract class BaseInventoryTranslator extends InventoryTranslator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory createInventory(String name, int windowId, WindowType windowType, PlayerInventory playerInventory) {
|
||||
return new Container(name, windowId, this.size, windowType, playerInventory);
|
||||
public Inventory createInventory(String name, int windowId, ContainerType containerType, PlayerInventory playerInventory) {
|
||||
return new Container(name, windowId, this.size, containerType, playerInventory);
|
||||
}
|
||||
}
|
||||
|
@ -25,13 +25,12 @@
|
||||
|
||||
package org.geysermc.connector.network.translators.inventory.translators;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.window.WindowType;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundSetBeaconPacket;
|
||||
import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetBeaconPacket;
|
||||
import com.nukkitx.math.vector.Vector3i;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
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.stackrequestactions.BeaconPaymentStackRequestActionData;
|
||||
@ -53,7 +52,7 @@ import java.util.Collections;
|
||||
|
||||
public class BeaconInventoryTranslator extends AbstractBlockInventoryTranslator {
|
||||
public BeaconInventoryTranslator() {
|
||||
super(1, new BlockInventoryHolder("minecraft:beacon", ContainerType.BEACON) {
|
||||
super(1, new BlockInventoryHolder("minecraft:beacon", com.nukkitx.protocol.bedrock.data.inventory.ContainerType.BEACON) {
|
||||
@Override
|
||||
protected boolean checkInteractionPosition(GeyserSession session) {
|
||||
// Since we can't fall back to a virtual inventory, let's make opening one easier
|
||||
@ -144,7 +143,7 @@ public class BeaconInventoryTranslator extends AbstractBlockInventoryTranslator
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory createInventory(String name, int windowId, WindowType windowType, PlayerInventory playerInventory) {
|
||||
return new BeaconContainer(name, windowId, this.size, windowType, playerInventory);
|
||||
public Inventory createInventory(String name, int windowId, ContainerType containerType, PlayerInventory playerInventory) {
|
||||
return new BeaconContainer(name, windowId, this.size, containerType, playerInventory);
|
||||
}
|
||||
}
|
||||
|
@ -25,9 +25,8 @@
|
||||
|
||||
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.inventory.ContainerType;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.ContainerType;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.StackRequestSlotInfoData;
|
||||
import org.geysermc.connector.inventory.CartographyContainer;
|
||||
import org.geysermc.connector.inventory.GeyserItemStack;
|
||||
@ -39,7 +38,7 @@ import org.geysermc.connector.network.translators.inventory.updater.UIInventoryU
|
||||
|
||||
public class CartographyInventoryTranslator extends AbstractBlockInventoryTranslator {
|
||||
public CartographyInventoryTranslator() {
|
||||
super(3, "minecraft:cartography_table", ContainerType.CARTOGRAPHY, UIInventoryUpdater.INSTANCE);
|
||||
super(3, "minecraft:cartography_table", com.nukkitx.protocol.bedrock.data.inventory.ContainerType.CARTOGRAPHY, UIInventoryUpdater.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -88,7 +87,7 @@ public class CartographyInventoryTranslator extends AbstractBlockInventoryTransl
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory createInventory(String name, int windowId, WindowType windowType, PlayerInventory playerInventory) {
|
||||
return new CartographyContainer(name, windowId, this.size, windowType, playerInventory);
|
||||
public Inventory createInventory(String name, int windowId, ContainerType containerType, PlayerInventory playerInventory) {
|
||||
return new CartographyContainer(name, windowId, this.size, containerType, playerInventory);
|
||||
}
|
||||
}
|
||||
|
@ -25,8 +25,8 @@
|
||||
|
||||
package org.geysermc.connector.network.translators.inventory.translators;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.window.WindowType;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundContainerButtonClickPacket;
|
||||
import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerButtonClickPacket;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.*;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.CraftRecipeStackRequestActionData;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData;
|
||||
@ -47,7 +47,7 @@ import java.util.Collections;
|
||||
|
||||
public class EnchantingInventoryTranslator extends AbstractBlockInventoryTranslator {
|
||||
public EnchantingInventoryTranslator() {
|
||||
super(2, "minecraft:enchanting_table", ContainerType.ENCHANTMENT, UIInventoryUpdater.INSTANCE);
|
||||
super(2, "minecraft:enchanting_table", com.nukkitx.protocol.bedrock.data.inventory.ContainerType.ENCHANTMENT, UIInventoryUpdater.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -167,7 +167,7 @@ public class EnchantingInventoryTranslator extends AbstractBlockInventoryTransla
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory createInventory(String name, int windowId, WindowType windowType, PlayerInventory playerInventory) {
|
||||
return new EnchantingContainer(name, windowId, this.size, windowType, playerInventory);
|
||||
public Inventory createInventory(String name, int windowId, ContainerType containerType, PlayerInventory playerInventory) {
|
||||
return new EnchantingContainer(name, windowId, this.size, containerType, playerInventory);
|
||||
}
|
||||
}
|
||||
|
@ -25,9 +25,8 @@
|
||||
|
||||
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.inventory.ContainerType;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.ContainerType;
|
||||
import com.nukkitx.protocol.bedrock.packet.ContainerOpenPacket;
|
||||
import org.geysermc.connector.inventory.Generic3X3Container;
|
||||
import org.geysermc.connector.inventory.Inventory;
|
||||
@ -41,13 +40,13 @@ import org.geysermc.connector.network.translators.inventory.updater.ContainerInv
|
||||
*/
|
||||
public class Generic3X3InventoryTranslator extends AbstractBlockInventoryTranslator {
|
||||
public Generic3X3InventoryTranslator() {
|
||||
super(9, "minecraft:dispenser[facing=north,triggered=false]", ContainerType.DISPENSER, ContainerInventoryUpdater.INSTANCE,
|
||||
super(9, "minecraft:dispenser[facing=north,triggered=false]", com.nukkitx.protocol.bedrock.data.inventory.ContainerType.DISPENSER, ContainerInventoryUpdater.INSTANCE,
|
||||
"minecraft:dropper");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory createInventory(String name, int windowId, WindowType windowType, PlayerInventory playerInventory) {
|
||||
return new Generic3X3Container(name, windowId, this.size, windowType, playerInventory);
|
||||
public Inventory createInventory(String name, int windowId, ContainerType containerType, PlayerInventory playerInventory) {
|
||||
return new Generic3X3Container(name, windowId, this.size, containerType, playerInventory);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -55,7 +54,7 @@ public class Generic3X3InventoryTranslator extends AbstractBlockInventoryTransla
|
||||
ContainerOpenPacket containerOpenPacket = new ContainerOpenPacket();
|
||||
containerOpenPacket.setId((byte) inventory.getId());
|
||||
// Required for opening the real block - otherwise, if the container type is incorrect, it refuses to open
|
||||
containerOpenPacket.setType(((Generic3X3Container) inventory).isDropper() ? ContainerType.DROPPER : ContainerType.DISPENSER);
|
||||
containerOpenPacket.setType(((Generic3X3Container) inventory).isDropper() ? com.nukkitx.protocol.bedrock.data.inventory.ContainerType.DROPPER : com.nukkitx.protocol.bedrock.data.inventory.ContainerType.DISPENSER);
|
||||
containerOpenPacket.setBlockPosition(inventory.getHolderPosition());
|
||||
containerOpenPacket.setUniqueEntityId(inventory.getHolderId());
|
||||
session.sendUpstreamPacket(containerOpenPacket);
|
||||
|
@ -25,9 +25,9 @@
|
||||
|
||||
package org.geysermc.connector.network.translators.inventory.translators;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.window.WindowType;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundContainerButtonClickPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundContainerClosePacket;
|
||||
import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerButtonClickPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClosePacket;
|
||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.ListTag;
|
||||
import com.nukkitx.math.vector.Vector3i;
|
||||
@ -158,8 +158,8 @@ public class LecternInventoryTranslator extends BaseInventoryTranslator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory createInventory(String name, int windowId, WindowType windowType, PlayerInventory playerInventory) {
|
||||
return new LecternContainer(name, windowId, this.size, windowType, playerInventory);
|
||||
public Inventory createInventory(String name, int windowId, ContainerType containerType, PlayerInventory playerInventory) {
|
||||
return new LecternContainer(name, windowId, this.size, containerType, playerInventory);
|
||||
}
|
||||
|
||||
public static NbtMapBuilder getBaseLecternTag(int x, int y, int z, int totalPages) {
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
package org.geysermc.connector.network.translators.inventory.translators;
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundContainerButtonClickPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerButtonClickPacket;
|
||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.ListTag;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
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.inventory.ContainerType;
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityData;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityDataMap;
|
||||
@ -149,7 +149,7 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory createInventory(String name, int windowId, WindowType windowType, PlayerInventory playerInventory) {
|
||||
return new MerchantContainer(name, windowId, this.size, windowType, playerInventory);
|
||||
public Inventory createInventory(String name, int windowId, ContainerType containerType, PlayerInventory playerInventory) {
|
||||
return new MerchantContainer(name, windowId, this.size, containerType, playerInventory);
|
||||
}
|
||||
}
|
||||
|
@ -27,8 +27,8 @@ package org.geysermc.connector.network.translators.inventory.translators;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
|
||||
import com.github.steveice10.mc.protocol.data.game.window.WindowType;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundSetCreativeModeSlotPacket;
|
||||
import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetCreativeModeSlotPacket;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.*;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.stackrequestactions.*;
|
||||
import com.nukkitx.protocol.bedrock.packet.InventoryContentPacket;
|
||||
@ -465,7 +465,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory createInventory(String name, int windowId, WindowType windowType, PlayerInventory playerInventory) {
|
||||
public Inventory createInventory(String name, int windowId, ContainerType containerType, PlayerInventory playerInventory) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
@ -26,10 +26,9 @@
|
||||
package org.geysermc.connector.network.translators.inventory.translators;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
|
||||
import com.github.steveice10.mc.protocol.data.game.window.WindowType;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundContainerButtonClickPacket;
|
||||
import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerButtonClickPacket;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
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.stackrequestactions.CraftResultsDeprecatedStackRequestActionData;
|
||||
@ -49,7 +48,7 @@ import org.geysermc.connector.network.translators.item.ItemTranslator;
|
||||
|
||||
public class StonecutterInventoryTranslator extends AbstractBlockInventoryTranslator {
|
||||
public StonecutterInventoryTranslator() {
|
||||
super(2, "minecraft:stonecutter[facing=north]", ContainerType.STONECUTTER, UIInventoryUpdater.INSTANCE);
|
||||
super(2, "minecraft:stonecutter[facing=north]", com.nukkitx.protocol.bedrock.data.inventory.ContainerType.STONECUTTER, UIInventoryUpdater.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -131,7 +130,7 @@ public class StonecutterInventoryTranslator extends AbstractBlockInventoryTransl
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory createInventory(String name, int windowId, WindowType windowType, PlayerInventory playerInventory) {
|
||||
return new StonecutterContainer(name, windowId, this.size, windowType, playerInventory);
|
||||
public Inventory createInventory(String name, int windowId, ContainerType containerType, PlayerInventory playerInventory) {
|
||||
return new StonecutterContainer(name, windowId, this.size, containerType, playerInventory);
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import com.nukkitx.nbt.NbtType;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
||||
import org.geysermc.connector.network.BedrockProtocol;
|
||||
import org.geysermc.connector.network.MinecraftProtocol;
|
||||
import org.geysermc.connector.network.translators.ItemRemapper;
|
||||
import org.geysermc.connector.network.translators.item.ItemTranslator;
|
||||
import org.geysermc.connector.registry.Registries;
|
||||
@ -81,7 +81,7 @@ public class BannerTranslator extends ItemTranslator {
|
||||
}
|
||||
|
||||
public BannerTranslator() {
|
||||
appliedItems = Registries.ITEMS.forVersion(BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion())
|
||||
appliedItems = Registries.ITEMS.forVersion(MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion())
|
||||
.getItems()
|
||||
.values()
|
||||
.stream()
|
||||
|
@ -28,7 +28,7 @@ package org.geysermc.connector.network.translators.item.translators;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
|
||||
import com.github.steveice10.opennbt.tag.builtin.*;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
||||
import org.geysermc.connector.network.BedrockProtocol;
|
||||
import org.geysermc.connector.network.MinecraftProtocol;
|
||||
import org.geysermc.connector.network.translators.ItemRemapper;
|
||||
import org.geysermc.connector.network.translators.item.ItemTranslator;
|
||||
import org.geysermc.connector.registry.Registries;
|
||||
@ -44,7 +44,7 @@ public class CompassTranslator extends ItemTranslator {
|
||||
private final List<ItemMapping> appliedItems;
|
||||
|
||||
public CompassTranslator() {
|
||||
appliedItems = Registries.ITEMS.forVersion(BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion())
|
||||
appliedItems = Registries.ITEMS.forVersion(MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion())
|
||||
.getItems()
|
||||
.values()
|
||||
.stream()
|
||||
|
@ -30,7 +30,7 @@ import com.github.steveice10.opennbt.tag.builtin.StringTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
||||
import org.geysermc.connector.GeyserConnector;
|
||||
import org.geysermc.connector.network.BedrockProtocol;
|
||||
import org.geysermc.connector.network.MinecraftProtocol;
|
||||
import org.geysermc.connector.network.translators.item.ItemTranslator;
|
||||
import org.geysermc.connector.network.translators.ItemRemapper;
|
||||
import org.geysermc.connector.network.translators.item.Potion;
|
||||
@ -47,7 +47,7 @@ public class PotionTranslator extends ItemTranslator {
|
||||
private final List<ItemMapping> appliedItems;
|
||||
|
||||
public PotionTranslator() {
|
||||
appliedItems = Registries.ITEMS.forVersion(BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion())
|
||||
appliedItems = Registries.ITEMS.forVersion(MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion())
|
||||
.getItems()
|
||||
.values()
|
||||
.stream()
|
||||
|
@ -30,7 +30,7 @@ import com.github.steveice10.opennbt.tag.builtin.StringTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
||||
import org.geysermc.connector.GeyserConnector;
|
||||
import org.geysermc.connector.network.BedrockProtocol;
|
||||
import org.geysermc.connector.network.MinecraftProtocol;
|
||||
import org.geysermc.connector.network.translators.ItemRemapper;
|
||||
import org.geysermc.connector.network.translators.item.ItemTranslator;
|
||||
import org.geysermc.connector.network.translators.item.TippedArrowPotion;
|
||||
@ -46,12 +46,12 @@ public class TippedArrowTranslator extends ItemTranslator {
|
||||
|
||||
private final List<ItemMapping> appliedItems;
|
||||
|
||||
private static final int TIPPED_ARROW_JAVA_ID = Registries.ITEMS.forVersion(BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion())
|
||||
private static final int TIPPED_ARROW_JAVA_ID = Registries.ITEMS.forVersion(MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion())
|
||||
.getMapping("minecraft:tipped_arrow")
|
||||
.getJavaId();
|
||||
|
||||
public TippedArrowTranslator() {
|
||||
appliedItems = Registries.ITEMS.forVersion(BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion())
|
||||
appliedItems = Registries.ITEMS.forVersion(MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion())
|
||||
.getItems()
|
||||
.values()
|
||||
.stream()
|
||||
|
@ -56,7 +56,7 @@ public class JavaAnimateTranslator extends PacketTranslator<ClientboundAnimatePa
|
||||
case SWING_ARM:
|
||||
animatePacket.setAction(AnimatePacket.Action.SWING_ARM);
|
||||
break;
|
||||
case SWING_OFFHAND:
|
||||
case EAT_FOOD:
|
||||
// Use the OptionalPack to trigger the animation
|
||||
AnimateEntityPacket offHandPacket = new AnimateEntityPacket();
|
||||
offHandPacket.setAnimation("animation.player.attack.rotations.offhand");
|
||||
|
@ -23,9 +23,9 @@
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.connector.network.translators.java.window;
|
||||
package org.geysermc.connector.network.translators.java.inventory;
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.window.ClientboundContainerClosePacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundContainerClosePacket;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.connector.network.translators.PacketTranslator;
|
||||
import org.geysermc.connector.network.translators.Translator;
|
||||
@ -38,6 +38,6 @@ public class JavaContainerCloseTranslator extends PacketTranslator<ClientboundCo
|
||||
public void translate(GeyserSession session, ClientboundContainerClosePacket packet) {
|
||||
// Sometimes the server can request a window close of ID 0... when the window isn't even open
|
||||
// Don't confirm in this instance
|
||||
InventoryUtils.closeInventory(session, packet.getWindowId(), (session.getOpenInventory() != null && session.getOpenInventory().getId() == packet.getWindowId()));
|
||||
InventoryUtils.closeInventory(session, packet.getContainerId(), (session.getOpenInventory() != null && session.getOpenInventory().getId() == packet.getContainerId()));
|
||||
}
|
||||
}
|
@ -23,9 +23,9 @@
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.connector.network.translators.java.window;
|
||||
package org.geysermc.connector.network.translators.java.inventory;
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.window.ClientboundContainerSetContentPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundContainerSetContentPacket;
|
||||
import org.geysermc.connector.inventory.GeyserItemStack;
|
||||
import org.geysermc.connector.inventory.Inventory;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
@ -39,7 +39,7 @@ public class JavaContainerSetContentTranslator extends PacketTranslator<Clientbo
|
||||
|
||||
@Override
|
||||
public void translate(GeyserSession session, ClientboundContainerSetContentPacket packet) {
|
||||
Inventory inventory = InventoryUtils.getInventory(session, packet.getWindowId());
|
||||
Inventory inventory = InventoryUtils.getInventory(session, packet.getContainerId());
|
||||
if (inventory == null)
|
||||
return;
|
||||
|
@ -23,9 +23,9 @@
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.connector.network.translators.java.window;
|
||||
package org.geysermc.connector.network.translators.java.inventory;
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.window.ClientboundContainerSetDataPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundContainerSetDataPacket;
|
||||
import org.geysermc.connector.inventory.Inventory;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.connector.network.translators.PacketTranslator;
|
||||
@ -38,7 +38,7 @@ public class JavaContainerSetDataTranslator extends PacketTranslator<Clientbound
|
||||
|
||||
@Override
|
||||
public void translate(GeyserSession session, ClientboundContainerSetDataPacket packet) {
|
||||
Inventory inventory = InventoryUtils.getInventory(session, packet.getWindowId());
|
||||
Inventory inventory = InventoryUtils.getInventory(session, packet.getContainerId());
|
||||
if (inventory == null)
|
||||
return;
|
||||
|
@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.connector.network.translators.java.window;
|
||||
package org.geysermc.connector.network.translators.java.inventory;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
|
||||
import com.github.steveice10.mc.protocol.data.game.recipe.Ingredient;
|
||||
@ -31,7 +31,7 @@ import com.github.steveice10.mc.protocol.data.game.recipe.Recipe;
|
||||
import com.github.steveice10.mc.protocol.data.game.recipe.RecipeType;
|
||||
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.packet.ingame.clientbound.window.ClientboundContainerSetSlotPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundContainerSetSlotPacket;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.ContainerId;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.CraftingData;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
||||
@ -59,7 +59,7 @@ public class JavaContainerSetSlotTranslator extends PacketTranslator<Clientbound
|
||||
|
||||
@Override
|
||||
public void translate(GeyserSession session, ClientboundContainerSetSlotPacket packet) {
|
||||
if (packet.getWindowId() == 255) { //cursor
|
||||
if (packet.getContainerId() == 255) { //cursor
|
||||
GeyserItemStack newItem = GeyserItemStack.from(packet.getItem());
|
||||
session.getPlayerInventory().setCursor(newItem, session);
|
||||
InventoryUtils.updateCursor(session);
|
||||
@ -67,7 +67,7 @@ public class JavaContainerSetSlotTranslator extends PacketTranslator<Clientbound
|
||||
}
|
||||
|
||||
//TODO: support window id -2, should update player inventory
|
||||
Inventory inventory = InventoryUtils.getInventory(session, packet.getWindowId());
|
||||
Inventory inventory = InventoryUtils.getInventory(session, packet.getContainerId());
|
||||
if (inventory == null)
|
||||
return;
|
||||
|
||||
@ -81,7 +81,7 @@ public class JavaContainerSetSlotTranslator extends PacketTranslator<Clientbound
|
||||
session.setCraftingGridFuture(session.scheduleInEventLoop(() -> updateCraftingGrid(session, packet, inventory, translator), 150, TimeUnit.MILLISECONDS));
|
||||
|
||||
GeyserItemStack newItem = GeyserItemStack.from(packet.getItem());
|
||||
if (packet.getWindowId() == 0 && !(translator instanceof PlayerInventoryTranslator)) {
|
||||
if (packet.getContainerId() == 0 && !(translator instanceof PlayerInventoryTranslator)) {
|
||||
// In rare cases, the window ID can still be 0 but Java treats it as valid
|
||||
session.getPlayerInventory().setItem(packet.getSlot(), newItem, session);
|
||||
InventoryTranslator.PLAYER_INVENTORY_TRANSLATOR.updateSlot(session, session.getPlayerInventory(), packet.getSlot());
|
@ -23,9 +23,9 @@
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.connector.network.translators.java.window;
|
||||
package org.geysermc.connector.network.translators.java.inventory;
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.window.ClientboundHorseScreenOpenPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundHorseScreenOpenPacket;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import com.nukkitx.nbt.NbtType;
|
||||
@ -105,7 +105,7 @@ public class JavaHorseScreenOpenTranslator extends PacketTranslator<ClientboundH
|
||||
}
|
||||
|
||||
UpdateEquipPacket updateEquipPacket = new UpdateEquipPacket();
|
||||
updateEquipPacket.setWindowId((short) packet.getWindowId());
|
||||
updateEquipPacket.setWindowId((short) packet.getContainerId());
|
||||
updateEquipPacket.setWindowType((short) ContainerType.HORSE.getId());
|
||||
updateEquipPacket.setUniqueEntityId(entity.getGeyserId());
|
||||
|
||||
@ -132,6 +132,6 @@ public class JavaHorseScreenOpenTranslator extends PacketTranslator<ClientboundH
|
||||
session.sendUpstreamPacket(updateEquipPacket);
|
||||
|
||||
session.setInventoryTranslator(inventoryTranslator);
|
||||
InventoryUtils.openInventory(session, new Container(entity.getMetadata().getString(EntityData.NAMETAG), packet.getWindowId(), packet.getNumberOfSlots(), null, session.getPlayerInventory()));
|
||||
InventoryUtils.openInventory(session, new Container(entity.getMetadata().getString(EntityData.NAMETAG), packet.getContainerId(), packet.getNumberOfSlots(), null, session.getPlayerInventory()));
|
||||
}
|
||||
}
|
@ -23,11 +23,11 @@
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.connector.network.translators.java.window;
|
||||
package org.geysermc.connector.network.translators.java.inventory;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
|
||||
import com.github.steveice10.mc.protocol.data.game.window.VillagerTrade;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.window.ClientboundMerchantOffersPacket;
|
||||
import com.github.steveice10.mc.protocol.data.game.inventory.VillagerTrade;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundMerchantOffersPacket;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import com.nukkitx.nbt.NbtType;
|
||||
@ -53,7 +53,7 @@ public class JavaMerchantOffersTranslator extends PacketTranslator<ClientboundMe
|
||||
@Override
|
||||
public void translate(GeyserSession session, ClientboundMerchantOffersPacket packet) {
|
||||
Inventory openInventory = session.getOpenInventory();
|
||||
if (!(openInventory instanceof MerchantContainer merchantInventory && openInventory.getId() == packet.getWindowId())) {
|
||||
if (!(openInventory instanceof MerchantContainer merchantInventory && openInventory.getId() == packet.getContainerId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ public class JavaMerchantOffersTranslator extends PacketTranslator<ClientboundMe
|
||||
// Construct the packet that opens the trading window
|
||||
UpdateTradePacket updateTradePacket = new UpdateTradePacket();
|
||||
updateTradePacket.setTradeTier(packet.getVillagerLevel() - 1);
|
||||
updateTradePacket.setContainerId((short) packet.getWindowId());
|
||||
updateTradePacket.setContainerId((short) packet.getContainerId());
|
||||
updateTradePacket.setContainerType(ContainerType.TRADE);
|
||||
updateTradePacket.setDisplayName(openInventory.getTitle());
|
||||
updateTradePacket.setSize(0);
|
@ -23,10 +23,10 @@
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.connector.network.translators.java.window;
|
||||
package org.geysermc.connector.network.translators.java.inventory;
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.window.ClientboundOpenScreenPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundContainerClosePacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.inventory.ClientboundOpenScreenPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClosePacket;
|
||||
import org.geysermc.connector.inventory.Inventory;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.connector.network.translators.PacketTranslator;
|
||||
@ -41,7 +41,7 @@ public class JavaOpenScreenTranslator extends PacketTranslator<ClientboundOpenSc
|
||||
|
||||
@Override
|
||||
public void translate(GeyserSession session, ClientboundOpenScreenPacket packet) {
|
||||
if (packet.getWindowId() == 0) {
|
||||
if (packet.getContainerId() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ public class JavaOpenScreenTranslator extends PacketTranslator<ClientboundOpenSc
|
||||
if (openInventory != null) {
|
||||
InventoryUtils.closeInventory(session, openInventory.getId(), true);
|
||||
}
|
||||
ServerboundContainerClosePacket closeWindowPacket = new ServerboundContainerClosePacket(packet.getWindowId());
|
||||
ServerboundContainerClosePacket closeWindowPacket = new ServerboundContainerClosePacket(packet.getContainerId());
|
||||
session.sendDownstreamPacket(closeWindowPacket);
|
||||
return;
|
||||
}
|
||||
@ -60,13 +60,13 @@ public class JavaOpenScreenTranslator extends PacketTranslator<ClientboundOpenSc
|
||||
String name = MessageTranslator.convertMessageLenient(packet.getName(), session.getLocale());
|
||||
name = LocaleUtils.getLocaleString(name, session.getLocale());
|
||||
|
||||
Inventory newInventory = newTranslator.createInventory(name, packet.getWindowId(), packet.getType(), session.getPlayerInventory());
|
||||
Inventory newInventory = newTranslator.createInventory(name, packet.getContainerId(), packet.getType(), session.getPlayerInventory());
|
||||
if (openInventory != null) {
|
||||
// If the window type is the same, don't close.
|
||||
// In rare cases, inventories can do funny things where it keeps the same window type up but change the contents.
|
||||
if (openInventory.getWindowType() != packet.getType()) {
|
||||
if (openInventory.getContainerType() != packet.getType()) {
|
||||
// Sometimes the server can double-open an inventory with the same ID - don't confirm in that instance.
|
||||
InventoryUtils.closeInventory(session, openInventory.getId(), openInventory.getId() != packet.getWindowId());
|
||||
InventoryUtils.closeInventory(session, openInventory.getId(), openInventory.getId() != packet.getContainerId());
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
package org.geysermc.connector.network.translators.java.level;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.block.UpdatedTileType;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundBlockEntityDataPacket;
|
||||
import com.nukkitx.math.vector.Vector3i;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
@ -68,7 +68,7 @@ public class JavaBlockEntityDataTranslator extends PacketTranslator<ClientboundB
|
||||
}
|
||||
|
||||
// If block entity is command block, OP permission level is appropriate, player is in creative mode and the NBT is not empty
|
||||
if (packet.getType() == UpdatedTileType.COMMAND_BLOCK && session.getOpPermissionLevel() >= 2 &&
|
||||
if (packet.getType() == BlockEntityType.COMMAND_BLOCK && session.getOpPermissionLevel() >= 2 &&
|
||||
session.getGameMode() == GameMode.CREATIVE && packet.getNbt().size() > 5) {
|
||||
ContainerOpenPacket openPacket = new ContainerOpenPacket();
|
||||
openPacket.setBlockPosition(Vector3i.from(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ()));
|
||||
|
@ -43,10 +43,10 @@ public class JavaBlockUpdateTranslator extends PacketTranslator<ClientboundBlock
|
||||
|
||||
@Override
|
||||
public void translate(GeyserSession session, ClientboundBlockUpdatePacket packet) {
|
||||
Position pos = packet.getRecord().getPosition();
|
||||
Position pos = packet.getEntry().getPosition();
|
||||
boolean updatePlacement = session.getConnector().getPlatformType() != PlatformType.SPIGOT && // Spigot simply listens for the block place event
|
||||
session.getConnector().getWorldManager().getBlockAt(session, pos) != packet.getRecord().getBlock();
|
||||
ChunkUtils.updateBlock(session, packet.getRecord().getBlock(), pos);
|
||||
session.getConnector().getWorldManager().getBlockAt(session, pos) != packet.getEntry().getBlock();
|
||||
ChunkUtils.updateBlock(session, packet.getEntry().getBlock(), pos);
|
||||
if (updatePlacement) {
|
||||
this.checkPlace(session, packet);
|
||||
}
|
||||
@ -58,16 +58,16 @@ public class JavaBlockUpdateTranslator extends PacketTranslator<ClientboundBlock
|
||||
if (lastPlacePos == null) {
|
||||
return false;
|
||||
}
|
||||
if ((lastPlacePos.getX() != packet.getRecord().getPosition().getX()
|
||||
|| lastPlacePos.getY() != packet.getRecord().getPosition().getY()
|
||||
|| lastPlacePos.getZ() != packet.getRecord().getPosition().getZ())) {
|
||||
if ((lastPlacePos.getX() != packet.getEntry().getPosition().getX()
|
||||
|| lastPlacePos.getY() != packet.getEntry().getPosition().getY()
|
||||
|| lastPlacePos.getZ() != packet.getEntry().getPosition().getZ())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// We need to check if the identifier is the same, else a packet with the sound of what the
|
||||
// player has in their hand is played, despite if the block is being placed or not
|
||||
boolean contains = false;
|
||||
String identifier = BlockRegistries.JAVA_BLOCKS.get(packet.getRecord().getBlock()).getItemIdentifier();
|
||||
String identifier = BlockRegistries.JAVA_BLOCKS.get(packet.getEntry().getBlock()).getItemIdentifier();
|
||||
if (identifier.equals(session.getLastBlockPlacedId())) {
|
||||
contains = true;
|
||||
}
|
||||
@ -83,7 +83,7 @@ public class JavaBlockUpdateTranslator extends PacketTranslator<ClientboundBlock
|
||||
placeBlockSoundPacket.setSound(SoundEvent.PLACE);
|
||||
placeBlockSoundPacket.setPosition(lastPlacePos.toFloat());
|
||||
placeBlockSoundPacket.setBabySound(false);
|
||||
placeBlockSoundPacket.setExtraData(session.getBlockMappings().getBedrockBlockId(packet.getRecord().getBlock()));
|
||||
placeBlockSoundPacket.setExtraData(session.getBlockMappings().getBedrockBlockId(packet.getEntry().getBlock()));
|
||||
placeBlockSoundPacket.setIdentifier(":");
|
||||
session.sendUpstreamPacket(placeBlockSoundPacket);
|
||||
session.setLastBlockPlacePosition(null);
|
||||
@ -96,12 +96,12 @@ public class JavaBlockUpdateTranslator extends PacketTranslator<ClientboundBlock
|
||||
if (lastInteractPos == null || !session.isInteracting()) {
|
||||
return;
|
||||
}
|
||||
if ((lastInteractPos.getX() != packet.getRecord().getPosition().getX()
|
||||
|| lastInteractPos.getY() != packet.getRecord().getPosition().getY()
|
||||
|| lastInteractPos.getZ() != packet.getRecord().getPosition().getZ())) {
|
||||
if ((lastInteractPos.getX() != packet.getEntry().getPosition().getX()
|
||||
|| lastInteractPos.getY() != packet.getEntry().getPosition().getY()
|
||||
|| lastInteractPos.getZ() != packet.getEntry().getPosition().getZ())) {
|
||||
return;
|
||||
}
|
||||
String identifier = BlockRegistries.JAVA_IDENTIFIERS.get().get(packet.getRecord().getBlock());
|
||||
String identifier = BlockRegistries.JAVA_IDENTIFIERS.get().get(packet.getEntry().getBlock());
|
||||
session.setInteracting(false);
|
||||
BlockSoundInteractionHandler.handleBlockInteraction(session, lastInteractPos.toFloat(), identifier);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
package org.geysermc.connector.network.translators.java.level;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.level.block.ExplodedBlockRecord;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundExplodePacket;
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.math.vector.Vector3i;
|
||||
@ -45,8 +45,8 @@ public class JavaExplodeTranslator extends PacketTranslator<ClientboundExplodePa
|
||||
|
||||
@Override
|
||||
public void translate(GeyserSession session, ClientboundExplodePacket packet) {
|
||||
for (ExplodedBlockRecord record : packet.getExploded()) {
|
||||
Vector3i pos = Vector3i.from(packet.getX() + record.getX(), packet.getY() + record.getY(), packet.getZ() + record.getZ());
|
||||
for (Position position : packet.getExploded()) {
|
||||
Vector3i pos = Vector3i.from(packet.getX() + position.getX(), packet.getY() + position.getY(), packet.getZ() + position.getZ());
|
||||
ChunkUtils.updateBlock(session, BlockStateValues.JAVA_AIR_ID, pos);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
package org.geysermc.connector.network.translators.java.level;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.ClientRequest;
|
||||
import com.github.steveice10.mc.protocol.data.game.ClientCommand;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.notify.EnterCreditsValue;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.notify.RainStrengthValue;
|
||||
@ -126,7 +126,7 @@ public class JavaGameEventTranslator extends PacketTranslator<ClientboundGameEve
|
||||
case ENTER_CREDITS:
|
||||
switch ((EnterCreditsValue) packet.getValue()) {
|
||||
case SEEN_BEFORE -> {
|
||||
ServerboundClientCommandPacket javaRespawnPacket = new ServerboundClientCommandPacket(ClientRequest.RESPAWN);
|
||||
ServerboundClientCommandPacket javaRespawnPacket = new ServerboundClientCommandPacket(ClientCommand.RESPAWN);
|
||||
session.sendDownstreamPacket(javaRespawnPacket);
|
||||
}
|
||||
case FIRST_TIME -> {
|
||||
|
@ -25,8 +25,8 @@
|
||||
|
||||
package org.geysermc.connector.network.translators.java.level;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.chunk.Column;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelChunkPacket;
|
||||
import com.github.steveice10.mc.protocol.data.game.chunk.Chunk;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelChunkWithLightPacket;
|
||||
import com.nukkitx.nbt.NBTOutputStream;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtUtils;
|
||||
@ -35,12 +35,11 @@ import com.nukkitx.protocol.bedrock.packet.LevelChunkPacket;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.ByteBufAllocator;
|
||||
import io.netty.buffer.ByteBufOutputStream;
|
||||
import org.geysermc.connector.GeyserConnector;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.connector.network.translators.PacketTranslator;
|
||||
import org.geysermc.connector.network.translators.Translator;
|
||||
import org.geysermc.connector.network.translators.world.BiomeTranslator;
|
||||
import org.geysermc.connector.network.translators.world.chunk.ChunkSection;
|
||||
import org.geysermc.connector.network.translators.world.chunk.GeyserChunkSection;
|
||||
import org.geysermc.connector.utils.ChunkUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -48,23 +47,23 @@ import java.io.IOException;
|
||||
import static org.geysermc.connector.utils.ChunkUtils.MINIMUM_ACCEPTED_HEIGHT;
|
||||
import static org.geysermc.connector.utils.ChunkUtils.MINIMUM_ACCEPTED_HEIGHT_OVERWORLD;
|
||||
|
||||
@Translator(packet = ClientboundLevelChunkPacket.class)
|
||||
public class JavaLevelChunkTranslator extends PacketTranslator<ClientboundLevelChunkPacket> {
|
||||
@Translator(packet = ClientboundLevelChunkWithLightPacket.class)
|
||||
public class JavaLevelChunkWithLightTranslator extends PacketTranslator<ClientboundLevelChunkWithLightPacket> {
|
||||
|
||||
@Override
|
||||
public void translate(GeyserSession session, ClientboundLevelChunkPacket packet) {
|
||||
public void translate(GeyserSession session, ClientboundLevelChunkWithLightPacket packet) {
|
||||
if (session.isSpawned()) {
|
||||
ChunkUtils.updateChunkPosition(session, session.getPlayerEntity().getPosition().toInt());
|
||||
}
|
||||
|
||||
session.getChunkCache().addToCache(packet.getColumn());
|
||||
Column column = packet.getColumn();
|
||||
session.getChunkCache().addToCache(packet.getChunk());
|
||||
Chunk chunk = packet.getChunk();
|
||||
|
||||
// Ensure that, if the player is using lower world heights, the position is not offset
|
||||
int yOffset = session.getChunkCache().getChunkMinY();
|
||||
|
||||
ChunkUtils.ChunkData chunkData = ChunkUtils.translateToBedrock(session, column, yOffset);
|
||||
ChunkSection[] sections = chunkData.sections();
|
||||
ChunkUtils.ChunkData chunkData = ChunkUtils.translateToBedrock(session, chunk, yOffset);
|
||||
GeyserChunkSection[] sections = chunkData.sections();
|
||||
|
||||
// Find highest section
|
||||
int sectionCount = sections.length - 1;
|
||||
@ -76,7 +75,7 @@ public class JavaLevelChunkTranslator extends PacketTranslator<ClientboundLevelC
|
||||
// Estimate chunk size
|
||||
int size = 0;
|
||||
for (int i = 0; i < sectionCount; i++) {
|
||||
ChunkSection section = sections[i];
|
||||
GeyserChunkSection section = sections[i];
|
||||
size += (section != null ? section : session.getBlockMappings().getEmptyChunkSection()).estimateNetworkSize();
|
||||
}
|
||||
size += ChunkUtils.EMPTY_CHUNK_DATA.length; // Consists only of biome data
|
||||
@ -89,7 +88,7 @@ public class JavaLevelChunkTranslator extends PacketTranslator<ClientboundLevelC
|
||||
byte[] payload;
|
||||
try {
|
||||
for (int i = 0; i < sectionCount; i++) {
|
||||
ChunkSection section = sections[i];
|
||||
GeyserChunkSection section = sections[i];
|
||||
(section != null ? section : session.getBlockMappings().getEmptyChunkSection()).writeToNetwork(byteBuf);
|
||||
}
|
||||
|
||||
@ -103,7 +102,7 @@ public class JavaLevelChunkTranslator extends PacketTranslator<ClientboundLevelC
|
||||
byteBuf.writeBytes(ChunkUtils.EMPTY_BIOME_DATA);
|
||||
continue;
|
||||
}
|
||||
BiomeTranslator.toNewBedrockBiome(session, column.getBiomeData(), i + (dimensionOffset - yOffset)).writeToNetwork(byteBuf);
|
||||
BiomeTranslator.toNewBedrockBiome(session, chunk.getBiomeData(), i + (dimensionOffset - yOffset)).writeToNetwork(byteBuf);
|
||||
}
|
||||
|
||||
// As of 1.17.10, Bedrock hardcodes to always read 32 biome sections
|
||||
@ -133,8 +132,8 @@ public class JavaLevelChunkTranslator extends PacketTranslator<ClientboundLevelC
|
||||
LevelChunkPacket levelChunkPacket = new LevelChunkPacket();
|
||||
levelChunkPacket.setSubChunksLength(sectionCount);
|
||||
levelChunkPacket.setCachingEnabled(false);
|
||||
levelChunkPacket.setChunkX(column.getX());
|
||||
levelChunkPacket.setChunkZ(column.getZ());
|
||||
levelChunkPacket.setChunkX(chunk.getX());
|
||||
levelChunkPacket.setChunkZ(chunk.getZ());
|
||||
levelChunkPacket.setData(payload);
|
||||
session.sendUpstreamPacket(levelChunkPacket);
|
||||
}
|
@ -25,7 +25,14 @@
|
||||
|
||||
package org.geysermc.connector.network.translators.java.level;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.level.effect.*;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.event.BonemealGrowEventData;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.event.BreakBlockEventData;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.event.BreakPotionEventData;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.event.ComposterEventData;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.event.DragonFireballEventData;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.event.ParticleEvent;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.event.RecordEventData;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.event.SmokeEventData;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelEventPacket;
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.protocol.bedrock.data.LevelEventType;
|
||||
@ -38,7 +45,7 @@ import org.geysermc.connector.GeyserConnector;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.connector.network.translators.PacketTranslator;
|
||||
import org.geysermc.connector.network.translators.Translator;
|
||||
import org.geysermc.connector.network.translators.effect.Effect;
|
||||
import org.geysermc.connector.network.translators.world.event.LevelEventTransformer;
|
||||
import org.geysermc.connector.registry.Registries;
|
||||
import org.geysermc.connector.utils.LocaleUtils;
|
||||
|
||||
@ -50,10 +57,10 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
|
||||
|
||||
@Override
|
||||
public void translate(GeyserSession session, ClientboundLevelEventPacket packet) {
|
||||
// Separate case since each RecordEffectData in Java is an individual track in Bedrock
|
||||
if (packet.getEffect() == SoundEffect.RECORD) {
|
||||
RecordEffectData recordEffectData = (RecordEffectData) packet.getData();
|
||||
SoundEvent soundEvent = Registries.RECORDS.getOrDefault(recordEffectData.getRecordId(), SoundEvent.STOP_RECORD);
|
||||
// Separate case since each RecordEventData in Java is an individual track in Bedrock
|
||||
if (packet.getEvent() == com.github.steveice10.mc.protocol.data.game.level.event.SoundEvent.RECORD) {
|
||||
RecordEventData recordEventData = (RecordEventData) packet.getData();
|
||||
SoundEvent soundEvent = Registries.RECORDS.getOrDefault(recordEventData.getRecordId(), SoundEvent.STOP_RECORD);
|
||||
Vector3f pos = Vector3f.from(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ()).add(0.5f, 0.5f, 0.5f);
|
||||
|
||||
LevelSoundEventPacket levelSoundEvent = new LevelSoundEventPacket();
|
||||
@ -81,26 +88,26 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
|
||||
return;
|
||||
}
|
||||
|
||||
if (packet.getEffect() instanceof SoundEffect soundEffect) {
|
||||
Effect geyserEffect = Registries.SOUND_EFFECTS.get(soundEffect);
|
||||
if (geyserEffect != null) {
|
||||
geyserEffect.handleEffectPacket(session, packet);
|
||||
if (packet.getEvent() instanceof com.github.steveice10.mc.protocol.data.game.level.event.SoundEvent soundEvent) {
|
||||
LevelEventTransformer transformer = Registries.SOUND_EVENTS.get(soundEvent);
|
||||
if (transformer != null) {
|
||||
transformer.handleLevelEvent(session, packet);
|
||||
return;
|
||||
}
|
||||
GeyserConnector.getInstance().getLogger().debug("Unhandled sound effect: " + soundEffect.name());
|
||||
} else if (packet.getEffect() instanceof ParticleEffect particleEffect) {
|
||||
GeyserConnector.getInstance().getLogger().debug("Unhandled sound event: " + soundEvent.name());
|
||||
} else if (packet.getEvent() instanceof ParticleEvent particleEvent) {
|
||||
Vector3f pos = Vector3f.from(packet.getPosition().getX(), packet.getPosition().getY(), packet.getPosition().getZ()).add(0.5f, 0.5f, 0.5f);
|
||||
|
||||
LevelEventPacket effectPacket = new LevelEventPacket();
|
||||
effectPacket.setPosition(pos);
|
||||
effectPacket.setData(0);
|
||||
switch (particleEffect) {
|
||||
switch (particleEvent) {
|
||||
case COMPOSTER -> {
|
||||
effectPacket.setType(LevelEventType.PARTICLE_CROP_GROWTH);
|
||||
|
||||
ComposterEffectData composterEffectData = (ComposterEffectData) packet.getData();
|
||||
ComposterEventData composterEventData = (ComposterEventData) packet.getData();
|
||||
LevelSoundEventPacket soundEventPacket = new LevelSoundEventPacket();
|
||||
switch (composterEffectData) {
|
||||
switch (composterEventData) {
|
||||
case FILL -> soundEventPacket.setSound(SoundEvent.COMPOSTER_FILL);
|
||||
case FILL_SUCCESS -> soundEventPacket.setSound(SoundEvent.COMPOSTER_FILL_LAYER);
|
||||
}
|
||||
@ -153,9 +160,9 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
|
||||
case SMOKE -> {
|
||||
effectPacket.setType(LevelEventType.PARTICLE_SHOOT);
|
||||
|
||||
SmokeEffectData smokeEffectData = (SmokeEffectData) packet.getData();
|
||||
SmokeEventData smokeEventData = (SmokeEventData) packet.getData();
|
||||
int data = 0;
|
||||
switch (smokeEffectData) {
|
||||
switch (smokeEventData) {
|
||||
case DOWN -> {
|
||||
data = 4;
|
||||
pos = pos.add(0, -0.9f, 0);
|
||||
@ -189,14 +196,14 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
|
||||
case BREAK_BLOCK -> {
|
||||
effectPacket.setType(LevelEventType.PARTICLE_DESTROY_BLOCK);
|
||||
|
||||
BreakBlockEffectData breakBlockEffectData = (BreakBlockEffectData) packet.getData();
|
||||
effectPacket.setData(session.getBlockMappings().getBedrockBlockId(breakBlockEffectData.getBlockState()));
|
||||
BreakBlockEventData breakBlockEventData = (BreakBlockEventData) packet.getData();
|
||||
effectPacket.setData(session.getBlockMappings().getBedrockBlockId(breakBlockEventData.getBlockState()));
|
||||
}
|
||||
case BREAK_SPLASH_POTION -> {
|
||||
effectPacket.setType(LevelEventType.PARTICLE_POTION_SPLASH);
|
||||
effectPacket.setPosition(pos.add(0, -0.5f, 0));
|
||||
|
||||
BreakPotionEffectData splashPotionData = (BreakPotionEffectData) packet.getData();
|
||||
BreakPotionEventData splashPotionData = (BreakPotionEventData) packet.getData();
|
||||
effectPacket.setData(splashPotionData.getPotionId());
|
||||
|
||||
LevelSoundEventPacket soundEventPacket = new LevelSoundEventPacket();
|
||||
@ -211,17 +218,17 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
|
||||
case BREAK_EYE_OF_ENDER -> effectPacket.setType(LevelEventType.PARTICLE_EYE_OF_ENDER_DEATH);
|
||||
case MOB_SPAWN -> effectPacket.setType(LevelEventType.PARTICLE_MOB_BLOCK_SPAWN); // TODO: Check, but I don't think I really verified this ever went into effect on Java
|
||||
case BONEMEAL_GROW_WITH_SOUND, BONEMEAL_GROW -> {
|
||||
effectPacket.setType((particleEffect == ParticleEffect.BONEMEAL_GROW
|
||||
effectPacket.setType((particleEvent == ParticleEvent.BONEMEAL_GROW
|
||||
&& session.getUpstream().getProtocolVersion() >= Bedrock_v465.V465_CODEC.getProtocolVersion()) ? LevelEventType.PARTICLE_TURTLE_EGG : LevelEventType.PARTICLE_CROP_GROWTH);
|
||||
|
||||
BonemealGrowEffectData growEffectData = (BonemealGrowEffectData) packet.getData();
|
||||
effectPacket.setData(growEffectData.getParticleCount());
|
||||
BonemealGrowEventData growEventData = (BonemealGrowEventData) packet.getData();
|
||||
effectPacket.setData(growEventData.getParticleCount());
|
||||
}
|
||||
case ENDERDRAGON_FIREBALL_EXPLODE -> {
|
||||
effectPacket.setType(LevelEventType.PARTICLE_EYE_OF_ENDER_DEATH); // TODO
|
||||
|
||||
DragonFireballEffectData fireballEffectData = (DragonFireballEffectData) packet.getData();
|
||||
if (fireballEffectData == DragonFireballEffectData.HAS_SOUND) {
|
||||
DragonFireballEventData fireballEventData = (DragonFireballEventData) packet.getData();
|
||||
if (fireballEventData == DragonFireballEventData.HAS_SOUND) {
|
||||
LevelSoundEventPacket soundEventPacket = new LevelSoundEventPacket();
|
||||
soundEventPacket.setSound(SoundEvent.EXPLODE);
|
||||
soundEventPacket.setPosition(pos);
|
||||
@ -252,24 +259,13 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
|
||||
soundEventPacket.setRelativeVolumeDisabled(false);
|
||||
session.sendUpstreamPacket(soundEventPacket);
|
||||
}
|
||||
case DRIPSTONE_DRIP -> {
|
||||
effectPacket.setType(LevelEventType.PARTICLE_DRIPSTONE_DRIP);
|
||||
}
|
||||
case ELECTRIC_SPARK -> {
|
||||
// Matches with a Bedrock server but doesn't seem to match up with Java
|
||||
effectPacket.setType(LevelEventType.PARTICLE_ELECTRIC_SPARK);
|
||||
}
|
||||
case WAX_ON -> {
|
||||
effectPacket.setType(LevelEventType.PARTICLE_WAX_ON);
|
||||
}
|
||||
case WAX_OFF -> {
|
||||
effectPacket.setType(LevelEventType.PARTICLE_WAX_OFF);
|
||||
}
|
||||
case SCRAPE -> {
|
||||
effectPacket.setType(LevelEventType.PARTICLE_SCRAPE);
|
||||
}
|
||||
case DRIPSTONE_DRIP -> effectPacket.setType(LevelEventType.PARTICLE_DRIPSTONE_DRIP);
|
||||
case ELECTRIC_SPARK -> effectPacket.setType(LevelEventType.PARTICLE_ELECTRIC_SPARK); // Matches with a Bedrock server but doesn't seem to match up with Java
|
||||
case WAX_ON -> effectPacket.setType(LevelEventType.PARTICLE_WAX_ON);
|
||||
case WAX_OFF -> effectPacket.setType(LevelEventType.PARTICLE_WAX_OFF);
|
||||
case SCRAPE -> effectPacket.setType(LevelEventType.PARTICLE_SCRAPE);
|
||||
default -> {
|
||||
GeyserConnector.getInstance().getLogger().debug("Unhandled particle effect: " + particleEffect.name());
|
||||
GeyserConnector.getInstance().getLogger().debug("Unhandled particle event: " + particleEvent.name());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
package org.geysermc.connector.network.translators.java.level;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.level.block.BlockChangeRecord;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.block.BlockChangeEntry;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundSectionBlocksUpdatePacket;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.connector.network.translators.PacketTranslator;
|
||||
@ -37,8 +37,8 @@ public class JavaSectionBlocksUpdateTranslator extends PacketTranslator<Clientbo
|
||||
|
||||
@Override
|
||||
public void translate(GeyserSession session, ClientboundSectionBlocksUpdatePacket packet) {
|
||||
for (BlockChangeRecord record : packet.getRecords()) {
|
||||
ChunkUtils.updateBlock(session, record.getBlock(), record.getPosition());
|
||||
for (BlockChangeEntry entry : packet.getEntries()) {
|
||||
ChunkUtils.updateBlock(session, entry.getBlock(), entry.getPosition());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import com.github.steveice10.opennbt.tag.builtin.*;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntMap;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.connector.network.translators.world.chunk.BlockStorage;
|
||||
import org.geysermc.connector.network.translators.world.chunk.ChunkSection;
|
||||
import org.geysermc.connector.network.translators.world.chunk.GeyserChunkSection;
|
||||
import org.geysermc.connector.registry.Registries;
|
||||
|
||||
import java.util.Arrays;
|
||||
@ -119,7 +119,7 @@ public class BiomeTranslator {
|
||||
for (int blockX = x << 2; blockX < (x << 2) + 4; blockX++) {
|
||||
for (int blockZ = z << 2; blockZ < (z << 2) + 4; blockZ++) {
|
||||
for (int blockY = y << 2; blockY < (y << 2) + 4; blockY++) {
|
||||
storage.getBitArray().set(ChunkSection.blockPosition(blockX, blockY, blockZ), idx);
|
||||
storage.getBitArray().set(GeyserChunkSection.blockPosition(blockX, blockY, blockZ), idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.ListTag;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import org.geysermc.connector.network.BedrockProtocol;
|
||||
import org.geysermc.connector.network.MinecraftProtocol;
|
||||
import org.geysermc.connector.registry.Registries;
|
||||
import org.geysermc.connector.registry.type.ItemMapping;
|
||||
|
||||
@ -47,7 +47,7 @@ public class CampfireBlockEntityTranslator extends BlockEntityTranslator {
|
||||
|
||||
protected NbtMap getItem(CompoundTag tag) {
|
||||
// TODO: Version independent mappings
|
||||
ItemMapping mapping = Registries.ITEMS.forVersion(BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()).getMapping((String) tag.get("id").getValue());
|
||||
ItemMapping mapping = Registries.ITEMS.forVersion(MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()).getMapping((String) tag.get("id").getValue());
|
||||
NbtMapBuilder tagBuilder = NbtMap.builder()
|
||||
.putString("Name", mapping.getBedrockIdentifier())
|
||||
.putByte("Count", (byte) tag.get("Count").getValue())
|
||||
|
@ -37,11 +37,11 @@ public class EmptyChunkProvider {
|
||||
@Getter
|
||||
private final byte[] emptyLevelChunkData;
|
||||
@Getter
|
||||
private final ChunkSection emptySection;
|
||||
private final GeyserChunkSection emptySection;
|
||||
|
||||
public EmptyChunkProvider(int airId) {
|
||||
BlockStorage emptyStorage = new BlockStorage(airId);
|
||||
emptySection = new ChunkSection(new BlockStorage[]{emptyStorage});
|
||||
emptySection = new GeyserChunkSection(new BlockStorage[]{emptyStorage});
|
||||
|
||||
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
|
||||
outputStream.write(new byte[258]); // Biomes + Border Size + Extra Data Size
|
||||
|
@ -26,32 +26,32 @@
|
||||
package org.geysermc.connector.network.translators.world.chunk;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.chunk.Chunk;
|
||||
import com.github.steveice10.mc.protocol.data.game.chunk.Column;
|
||||
import com.github.steveice10.mc.protocol.data.game.chunk.ChunkSection;
|
||||
import lombok.Getter;
|
||||
import org.geysermc.connector.network.session.cache.ChunkCache;
|
||||
|
||||
/**
|
||||
* Acts as a lightweight version of {@link Column} that doesn't store
|
||||
* Acts as a lightweight version of {@link Chunk} that doesn't store
|
||||
* biomes or heightmaps.
|
||||
*/
|
||||
public class GeyserColumn {
|
||||
public class GeyserChunk {
|
||||
@Getter
|
||||
private final Chunk[] chunks;
|
||||
private final ChunkSection[] sections;
|
||||
|
||||
private GeyserColumn(Chunk[] chunks) {
|
||||
this.chunks = chunks;
|
||||
private GeyserChunk(ChunkSection[] sections) {
|
||||
this.sections = sections;
|
||||
}
|
||||
|
||||
public static GeyserColumn from(ChunkCache chunkCache, Column column) {
|
||||
public static GeyserChunk from(ChunkCache chunkCache, Chunk chunk) {
|
||||
int chunkHeightY = chunkCache.getChunkHeightY();
|
||||
Chunk[] chunks;
|
||||
if (chunkHeightY < column.getChunks().length) {
|
||||
chunks = new Chunk[chunkHeightY];
|
||||
ChunkSection[] sections;
|
||||
if (chunkHeightY < chunk.getSections().length) {
|
||||
sections = new ChunkSection[chunkHeightY];
|
||||
// TODO addresses https://github.com/Steveice10/MCProtocolLib/pull/598#issuecomment-862782392
|
||||
System.arraycopy(column.getChunks(), 0, chunks, 0, chunks.length);
|
||||
System.arraycopy(chunk.getSections(), 0, sections, 0, sections.length);
|
||||
} else {
|
||||
chunks = column.getChunks();
|
||||
sections = chunk.getSections();
|
||||
}
|
||||
return new GeyserColumn(chunks);
|
||||
return new GeyserChunk(sections);
|
||||
}
|
||||
}
|
@ -28,17 +28,17 @@ package org.geysermc.connector.network.translators.world.chunk;
|
||||
import com.nukkitx.network.util.Preconditions;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class ChunkSection {
|
||||
public class GeyserChunkSection {
|
||||
|
||||
private static final int CHUNK_SECTION_VERSION = 8;
|
||||
|
||||
private final BlockStorage[] storage;
|
||||
|
||||
public ChunkSection(int airBlockId) {
|
||||
public GeyserChunkSection(int airBlockId) {
|
||||
this(new BlockStorage[]{new BlockStorage(airBlockId), new BlockStorage(airBlockId)});
|
||||
}
|
||||
|
||||
public ChunkSection(BlockStorage[] storage) {
|
||||
public GeyserChunkSection(BlockStorage[] storage) {
|
||||
this.storage = storage;
|
||||
}
|
||||
|
||||
@ -83,12 +83,12 @@ public class ChunkSection {
|
||||
return true;
|
||||
}
|
||||
|
||||
public ChunkSection copy() {
|
||||
public GeyserChunkSection copy() {
|
||||
BlockStorage[] storage = new BlockStorage[this.storage.length];
|
||||
for (int i = 0; i < storage.length; i++) {
|
||||
storage[i] = this.storage[i].copy();
|
||||
}
|
||||
return new ChunkSection(storage);
|
||||
return new GeyserChunkSection(storage);
|
||||
}
|
||||
|
||||
public static int blockPosition(int x, int y, int z) {
|
@ -23,20 +23,20 @@
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.connector.network.translators.effect;
|
||||
package org.geysermc.connector.network.translators.world.event;
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelEventPacket;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
|
||||
/**
|
||||
* Represents an effect capable of translating itself into bedrock
|
||||
* Represents an event capable of translating itself into bedrock
|
||||
*/
|
||||
public interface Effect {
|
||||
public interface LevelEventTransformer {
|
||||
/**
|
||||
* Translates the given {@link ClientboundLevelEventPacket} into bedrock and sends it upstream.
|
||||
*
|
||||
* @param session GeyserSession
|
||||
* @param packet the effect packet to handle
|
||||
*/
|
||||
void handleEffectPacket(GeyserSession session, ClientboundLevelEventPacket packet);
|
||||
void handleLevelEvent(GeyserSession session, ClientboundLevelEventPacket packet);
|
||||
}
|
@ -23,52 +23,20 @@
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.connector.network.translators.effect;
|
||||
package org.geysermc.connector.network.translators.world.event;
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelEventPacket;
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.protocol.bedrock.packet.PlaySoundPacket;
|
||||
import lombok.Value;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
@Value
|
||||
public class PlaySoundEffect implements Effect {
|
||||
/**
|
||||
* Bedrock playsound identifier
|
||||
*/
|
||||
String name;
|
||||
|
||||
/**
|
||||
* Volume of the sound
|
||||
*/
|
||||
float volume;
|
||||
|
||||
/**
|
||||
* If true, the initial value used for random pitch is the difference between two random floats.
|
||||
* If false, it is a single random float
|
||||
*/
|
||||
boolean pitchSub;
|
||||
|
||||
/**
|
||||
* Multiplier for random pitch value
|
||||
*/
|
||||
float pitchMul;
|
||||
|
||||
/**
|
||||
* Constant addition to random pitch value after multiplier
|
||||
*/
|
||||
float pitchAdd;
|
||||
|
||||
/**
|
||||
* True if the sound is meant to be played in 3d space
|
||||
*/
|
||||
boolean relative;
|
||||
|
||||
public record PlaySoundEventTransformer(String name, float volume, boolean pitchSub, float pitchMul,
|
||||
float pitchAdd, boolean relative) implements LevelEventTransformer {
|
||||
@Override
|
||||
public void handleEffectPacket(GeyserSession session, ClientboundLevelEventPacket packet) {
|
||||
public void handleLevelEvent(GeyserSession session, ClientboundLevelEventPacket packet) {
|
||||
Random rand = ThreadLocalRandom.current();
|
||||
PlaySoundPacket playSoundPacket = new PlaySoundPacket();
|
||||
playSoundPacket.setSound(name);
|
@ -23,34 +23,18 @@
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.connector.network.translators.effect;
|
||||
package org.geysermc.connector.network.translators.world.event;
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelEventPacket;
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.protocol.bedrock.data.SoundEvent;
|
||||
import com.nukkitx.protocol.bedrock.packet.LevelSoundEventPacket;
|
||||
import lombok.Value;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
|
||||
@Value
|
||||
public class SoundEventEffect implements Effect {
|
||||
/**
|
||||
* Bedrock sound event
|
||||
*/
|
||||
SoundEvent soundEvent;
|
||||
|
||||
/**
|
||||
* Entity identifier. Usually an empty string
|
||||
*/
|
||||
String identifier;
|
||||
|
||||
/**
|
||||
* Extra data. Usually -1
|
||||
*/
|
||||
int extraData;
|
||||
|
||||
public record SoundEventEventTransformer(SoundEvent soundEvent,
|
||||
String identifier, int extraData) implements LevelEventTransformer {
|
||||
@Override
|
||||
public void handleEffectPacket(GeyserSession session, ClientboundLevelEventPacket packet) {
|
||||
public void handleLevelEvent(GeyserSession session, ClientboundLevelEventPacket packet) {
|
||||
LevelSoundEventPacket levelSoundEvent = new LevelSoundEventPacket();
|
||||
levelSoundEvent.setSound(soundEvent);
|
||||
levelSoundEvent.setIdentifier(identifier);
|
@ -23,29 +23,18 @@
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.connector.network.translators.effect;
|
||||
package org.geysermc.connector.network.translators.world.event;
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelEventPacket;
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.protocol.bedrock.data.LevelEventType;
|
||||
import com.nukkitx.protocol.bedrock.packet.LevelEventPacket;
|
||||
import lombok.Value;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
|
||||
@Value
|
||||
public class SoundLevelEffect implements Effect {
|
||||
/**
|
||||
* Bedrock level event type
|
||||
*/
|
||||
LevelEventType levelEventType;
|
||||
|
||||
/**
|
||||
* Event data. Usually 0
|
||||
*/
|
||||
int data;
|
||||
|
||||
public record SoundLevelEventTransformer(LevelEventType levelEventType,
|
||||
int data) implements LevelEventTransformer {
|
||||
@Override
|
||||
public void handleEffectPacket(GeyserSession session, ClientboundLevelEventPacket packet) {
|
||||
public void handleLevelEvent(GeyserSession session, ClientboundLevelEventPacket packet) {
|
||||
LevelEventPacket eventPacket = new LevelEventPacket();
|
||||
eventPacket.setType(levelEventType);
|
||||
eventPacket.setData(data);
|
@ -27,10 +27,10 @@ package org.geysermc.connector.ping;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParseException;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.github.steveice10.mc.protocol.MinecraftConstants;
|
||||
import com.nukkitx.nbt.util.VarInts;
|
||||
import org.geysermc.connector.common.ping.GeyserPingInfo;
|
||||
import org.geysermc.connector.GeyserConnector;
|
||||
import org.geysermc.connector.network.MinecraftProtocol;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
@ -84,7 +84,7 @@ public class GeyserLegacyPingPassthrough implements IGeyserPingPassthrough, Runn
|
||||
ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream();
|
||||
DataOutputStream handshake = new DataOutputStream(byteArrayStream);
|
||||
handshake.write(0x0);
|
||||
VarInts.writeUnsignedInt(handshake, MinecraftConstants.PROTOCOL_VERSION);
|
||||
VarInts.writeUnsignedInt(handshake, MinecraftProtocol.getJavaProtocolVersion());
|
||||
VarInts.writeUnsignedInt(handshake, address.length());
|
||||
handshake.writeBytes(address);
|
||||
handshake.writeShort(port);
|
||||
|
@ -25,12 +25,11 @@
|
||||
|
||||
package org.geysermc.connector.registry;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.level.event.SoundEvent;
|
||||
import com.github.steveice10.mc.protocol.data.game.recipe.Recipe;
|
||||
import com.github.steveice10.mc.protocol.data.game.recipe.RecipeType;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.effect.SoundEffect;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.particle.ParticleType;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.protocol.bedrock.data.SoundEvent;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.CraftingData;
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.PotionMixData;
|
||||
import it.unimi.dsi.fastutil.Pair;
|
||||
@ -38,7 +37,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
import org.geysermc.connector.network.translators.collision.translators.BlockCollision;
|
||||
import org.geysermc.connector.network.translators.effect.Effect;
|
||||
import org.geysermc.connector.network.translators.world.event.LevelEventTransformer;
|
||||
import org.geysermc.connector.network.translators.sound.SoundHandler;
|
||||
import org.geysermc.connector.network.translators.sound.SoundInteractionHandler;
|
||||
import org.geysermc.connector.network.translators.world.block.entity.BlockEntityTranslator;
|
||||
@ -110,10 +109,10 @@ public class Registries {
|
||||
public static final VersionedRegistry<Int2ObjectMap<Recipe>> RECIPES = VersionedRegistry.create(RegistryLoaders.empty(Int2ObjectOpenHashMap::new));
|
||||
|
||||
/**
|
||||
* A mapped registry holding the available records, with the ID of the record being the key, and the {@link SoundEvent}
|
||||
* A mapped registry holding the available records, with the ID of the record being the key, and the {@link com.nukkitx.protocol.bedrock.data.SoundEvent}
|
||||
* as the value.
|
||||
*/
|
||||
public static final SimpleMappedRegistry<Integer, SoundEvent> RECORDS = SimpleMappedRegistry.create(RegistryLoaders.empty(Int2ObjectOpenHashMap::new));
|
||||
public static final SimpleMappedRegistry<Integer, com.nukkitx.protocol.bedrock.data.SoundEvent> RECORDS = SimpleMappedRegistry.create(RegistryLoaders.empty(Int2ObjectOpenHashMap::new));
|
||||
|
||||
/**
|
||||
* A mapped registry holding sound identifiers to their corresponding {@link SoundMapping}.
|
||||
@ -121,9 +120,9 @@ public class Registries {
|
||||
public static final SimpleMappedRegistry<String, SoundMapping> SOUNDS = SimpleMappedRegistry.create("mappings/sounds.json", SoundRegistryLoader::new);
|
||||
|
||||
/**
|
||||
* A mapped registry holding {@link SoundEffect}s to their corresponding {@link Effect}.
|
||||
* A mapped registry holding {@link SoundEvent}s to their corresponding {@link LevelEventTransformer}.
|
||||
*/
|
||||
public static final SimpleMappedRegistry<SoundEffect, Effect> SOUND_EFFECTS = SimpleMappedRegistry.create("mappings/effects.json", SoundEffectsRegistryLoader::new);
|
||||
public static final SimpleMappedRegistry<SoundEvent, LevelEventTransformer> SOUND_EVENTS = SimpleMappedRegistry.create("mappings/effects.json", SoundEventsRegistryLoader::new);
|
||||
|
||||
/**
|
||||
* A mapped registry holding {@link SoundHandler}s to their corresponding {@link SoundInteractionHandler}.
|
||||
|
@ -26,7 +26,7 @@
|
||||
package org.geysermc.connector.registry.loader;
|
||||
|
||||
import com.nukkitx.protocol.bedrock.data.inventory.PotionMixData;
|
||||
import org.geysermc.connector.network.BedrockProtocol;
|
||||
import org.geysermc.connector.network.MinecraftProtocol;
|
||||
import org.geysermc.connector.registry.Registries;
|
||||
import org.geysermc.connector.registry.type.ItemMapping;
|
||||
import org.geysermc.connector.network.translators.item.Potion;
|
||||
@ -103,7 +103,7 @@ public class PotionMixRegistryLoader implements RegistryLoader<Object, Set<Potio
|
||||
}
|
||||
|
||||
private static ItemMapping getNonNull(String javaIdentifier) {
|
||||
ItemMapping itemMapping = Registries.ITEMS.forVersion(BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()).getMapping(javaIdentifier);
|
||||
ItemMapping itemMapping = Registries.ITEMS.forVersion(MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()).getMapping(javaIdentifier);
|
||||
if (itemMapping == null)
|
||||
throw new NullPointerException("No item entry exists for java identifier: " + javaIdentifier);
|
||||
|
||||
|
@ -26,15 +26,14 @@
|
||||
package org.geysermc.connector.registry.loader;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.effect.SoundEffect;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.event.SoundEvent;
|
||||
import com.nukkitx.protocol.bedrock.data.LevelEventType;
|
||||
import com.nukkitx.protocol.bedrock.data.SoundEvent;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
import org.geysermc.connector.GeyserConnector;
|
||||
import org.geysermc.connector.network.translators.effect.Effect;
|
||||
import org.geysermc.connector.network.translators.effect.PlaySoundEffect;
|
||||
import org.geysermc.connector.network.translators.effect.SoundEventEffect;
|
||||
import org.geysermc.connector.network.translators.effect.SoundLevelEffect;
|
||||
import org.geysermc.connector.network.translators.world.event.LevelEventTransformer;
|
||||
import org.geysermc.connector.network.translators.world.event.PlaySoundEventTransformer;
|
||||
import org.geysermc.connector.network.translators.world.event.SoundEventEventTransformer;
|
||||
import org.geysermc.connector.network.translators.world.event.SoundLevelEventTransformer;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
@ -42,48 +41,48 @@ import java.util.Map;
|
||||
/**
|
||||
* Loads sound effects from the given resource path.
|
||||
*/
|
||||
public class SoundEffectsRegistryLoader extends EffectRegistryLoader<Map<SoundEffect, Effect>> {
|
||||
public class SoundEventsRegistryLoader extends EffectRegistryLoader<Map<SoundEvent, LevelEventTransformer>> {
|
||||
|
||||
@Override
|
||||
public Map<SoundEffect, Effect> load(String input) {
|
||||
public Map<SoundEvent, LevelEventTransformer> load(String input) {
|
||||
this.loadFile(input);
|
||||
|
||||
Iterator<Map.Entry<String, JsonNode>> effectsIterator = this.get(input).fields();
|
||||
Map<SoundEffect, Effect> soundEffects = new Object2ObjectOpenHashMap<>();
|
||||
Map<SoundEvent, LevelEventTransformer> soundEffects = new Object2ObjectOpenHashMap<>();
|
||||
while (effectsIterator.hasNext()) {
|
||||
Map.Entry<String, JsonNode> entry = effectsIterator.next();
|
||||
JsonNode node = entry.getValue();
|
||||
try {
|
||||
String type = node.get("type").asText();
|
||||
SoundEffect javaEffect = null;
|
||||
Effect effect = null;
|
||||
SoundEvent javaEffect = null;
|
||||
LevelEventTransformer transformer = null;
|
||||
switch (type) {
|
||||
case "soundLevel" -> {
|
||||
javaEffect = SoundEffect.valueOf(entry.getKey());
|
||||
javaEffect = SoundEvent.valueOf(entry.getKey());
|
||||
LevelEventType levelEventType = LevelEventType.valueOf(node.get("name").asText());
|
||||
int data = node.has("data") ? node.get("data").intValue() : 0;
|
||||
effect = new SoundLevelEffect(levelEventType, data);
|
||||
transformer = new SoundLevelEventTransformer(levelEventType, data);
|
||||
}
|
||||
case "soundEvent" -> {
|
||||
javaEffect = SoundEffect.valueOf(entry.getKey());
|
||||
SoundEvent soundEvent = SoundEvent.valueOf(node.get("name").asText());
|
||||
javaEffect = SoundEvent.valueOf(entry.getKey());
|
||||
com.nukkitx.protocol.bedrock.data.SoundEvent soundEvent = com.nukkitx.protocol.bedrock.data.SoundEvent.valueOf(node.get("name").asText());
|
||||
String identifier = node.has("identifier") ? node.get("identifier").asText() : "";
|
||||
int extraData = node.has("extraData") ? node.get("extraData").intValue() : -1;
|
||||
effect = new SoundEventEffect(soundEvent, identifier, extraData);
|
||||
transformer = new SoundEventEventTransformer(soundEvent, identifier, extraData);
|
||||
}
|
||||
case "playSound" -> {
|
||||
javaEffect = SoundEffect.valueOf(entry.getKey());
|
||||
javaEffect = SoundEvent.valueOf(entry.getKey());
|
||||
String name = node.get("name").asText();
|
||||
float volume = node.has("volume") ? node.get("volume").floatValue() : 1.0f;
|
||||
boolean pitchSub = node.has("pitch_sub") && node.get("pitch_sub").booleanValue();
|
||||
float pitchMul = node.has("pitch_mul") ? node.get("pitch_mul").floatValue() : 1.0f;
|
||||
float pitchAdd = node.has("pitch_add") ? node.get("pitch_add").floatValue() : 0.0f;
|
||||
boolean relative = !node.has("relative") || node.get("relative").booleanValue();
|
||||
effect = new PlaySoundEffect(name, volume, pitchSub, pitchMul, pitchAdd, relative);
|
||||
transformer = new PlaySoundEventTransformer(name, volume, pitchSub, pitchMul, pitchAdd, relative);
|
||||
}
|
||||
}
|
||||
if (javaEffect != null) {
|
||||
soundEffects.put(javaEffect, effect);
|
||||
soundEffects.put(javaEffect, transformer);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
GeyserConnector.getInstance().getLogger().warning("Failed to map sound effect " + entry.getKey() + " : " + e.toString());
|
@ -39,7 +39,7 @@ import it.unimi.dsi.fastutil.objects.ObjectIntPair;
|
||||
import org.geysermc.connector.GeyserConnector;
|
||||
import org.geysermc.connector.network.translators.world.block.BlockStateValues;
|
||||
import org.geysermc.connector.network.translators.world.chunk.BlockStorage;
|
||||
import org.geysermc.connector.network.translators.world.chunk.ChunkSection;
|
||||
import org.geysermc.connector.network.translators.world.chunk.GeyserChunkSection;
|
||||
import org.geysermc.connector.registry.BlockRegistries;
|
||||
import org.geysermc.connector.registry.type.BlockMapping;
|
||||
import org.geysermc.connector.registry.type.BlockMappings;
|
||||
@ -200,7 +200,7 @@ public class BlockRegistryPopulator {
|
||||
builder.bedrockBlockStates(blocksTag);
|
||||
|
||||
BlockRegistries.BLOCKS.register(palette.getKey().valueInt(), builder.blockStateVersion(stateVersion)
|
||||
.emptyChunkSection(new ChunkSection(new BlockStorage[]{new BlockStorage(airRuntimeId)}))
|
||||
.emptyChunkSection(new GeyserChunkSection(new BlockStorage[]{new BlockStorage(airRuntimeId)}))
|
||||
.javaToBedrockBlocks(javaToBedrockBlocks)
|
||||
.javaIdentifierToBedrockTag(javaIdentifierToBedrockTag)
|
||||
.itemFrames(itemFrames)
|
||||
|
@ -31,7 +31,7 @@ import it.unimi.dsi.fastutil.ints.IntSet;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
import lombok.Builder;
|
||||
import lombok.Value;
|
||||
import org.geysermc.connector.network.translators.world.chunk.ChunkSection;
|
||||
import org.geysermc.connector.network.translators.world.chunk.GeyserChunkSection;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@ -44,7 +44,7 @@ public class BlockMappings {
|
||||
|
||||
int blockStateVersion;
|
||||
|
||||
ChunkSection emptyChunkSection;
|
||||
GeyserChunkSection emptyChunkSection;
|
||||
|
||||
int[] javaToBedrockBlocks;
|
||||
|
||||
|
@ -28,7 +28,7 @@ package org.geysermc.connector.registry.type;
|
||||
import lombok.Builder;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Value;
|
||||
import org.geysermc.connector.network.BedrockProtocol;
|
||||
import org.geysermc.connector.network.MinecraftProtocol;
|
||||
import org.geysermc.connector.registry.BlockRegistries;
|
||||
|
||||
@Value
|
||||
@ -36,7 +36,7 @@ import org.geysermc.connector.registry.BlockRegistries;
|
||||
@EqualsAndHashCode
|
||||
public class ItemMapping {
|
||||
public static final ItemMapping AIR = new ItemMapping("minecraft:air", "minecraft:air", 0, 0, 0,
|
||||
BlockRegistries.BLOCKS.forVersion(BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()).getBedrockAirId(),
|
||||
BlockRegistries.BLOCKS.forVersion(MinecraftProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion()).getBedrockAirId(),
|
||||
64, null, null, null);
|
||||
|
||||
String javaIdentifier;
|
||||
|
@ -27,7 +27,7 @@ package org.geysermc.connector.utils;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.chunk.BitStorage;
|
||||
import com.github.steveice10.mc.protocol.data.game.chunk.Chunk;
|
||||
import com.github.steveice10.mc.protocol.data.game.chunk.Column;
|
||||
import com.github.steveice10.mc.protocol.data.game.chunk.ChunkSection;
|
||||
import com.github.steveice10.mc.protocol.data.game.chunk.palette.GlobalPalette;
|
||||
import com.github.steveice10.mc.protocol.data.game.chunk.palette.Palette;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position;
|
||||
@ -52,7 +52,7 @@ import org.geysermc.connector.network.translators.world.block.entity.BedrockOnly
|
||||
import org.geysermc.connector.network.translators.world.block.entity.BlockEntityTranslator;
|
||||
import org.geysermc.connector.network.translators.world.block.entity.SkullBlockEntityTranslator;
|
||||
import org.geysermc.connector.network.translators.world.chunk.BlockStorage;
|
||||
import org.geysermc.connector.network.translators.world.chunk.ChunkSection;
|
||||
import org.geysermc.connector.network.translators.world.chunk.GeyserChunkSection;
|
||||
import org.geysermc.connector.network.translators.world.chunk.bitarray.BitArray;
|
||||
import org.geysermc.connector.network.translators.world.chunk.bitarray.BitArrayVersion;
|
||||
import org.geysermc.connector.registry.BlockRegistries;
|
||||
@ -110,9 +110,9 @@ public class ChunkUtils {
|
||||
return (yzx >> 8) | (yzx & 0x0F0) | ((yzx & 0x00F) << 8);
|
||||
}
|
||||
|
||||
public static ChunkData translateToBedrock(GeyserSession session, Column column, int yOffset) {
|
||||
Chunk[] javaSections = column.getChunks();
|
||||
ChunkSection[] sections = new ChunkSection[javaSections.length - yOffset];
|
||||
public static ChunkData translateToBedrock(GeyserSession session, Chunk chunk, int yOffset) {
|
||||
ChunkSection[] javaSections = chunk.getSections();
|
||||
GeyserChunkSection[] sections = new GeyserChunkSection[javaSections.length - yOffset];
|
||||
|
||||
// Temporarily stores compound tags of Bedrock-only block entities
|
||||
List<NbtMap> bedrockOnlyBlockEntities = new ArrayList<>();
|
||||
@ -130,7 +130,7 @@ public class ChunkUtils {
|
||||
continue;
|
||||
}
|
||||
|
||||
Chunk javaSection = javaSections[sectionY];
|
||||
ChunkSection javaSection = javaSections[sectionY];
|
||||
|
||||
// No need to encode an empty section...
|
||||
if (javaSection == null || javaSection.isEmpty()) {
|
||||
@ -142,7 +142,7 @@ public class ChunkUtils {
|
||||
|
||||
if (javaPalette instanceof GlobalPalette) {
|
||||
// As this is the global palette, simply iterate through the whole chunk section once
|
||||
ChunkSection section = new ChunkSection(session.getBlockMappings().getBedrockAirId());
|
||||
GeyserChunkSection section = new GeyserChunkSection(session.getBlockMappings().getBedrockAirId());
|
||||
for (int yzx = 0; yzx < BlockStorage.SIZE; yzx++) {
|
||||
int javaId = javaData.get(yzx);
|
||||
int bedrockId = session.getBlockMappings().getBedrockBlockId(javaId);
|
||||
@ -156,7 +156,7 @@ public class ChunkUtils {
|
||||
// Check if block is piston or flower to see if we'll need to create additional block entities, as they're only block entities in Bedrock
|
||||
if (BlockStateValues.getFlowerPotValues().containsKey(javaId) || BlockStateValues.getPistonValues().containsKey(javaId)) {
|
||||
bedrockOnlyBlockEntities.add(BedrockOnlyBlockEntity.getTag(session,
|
||||
Vector3i.from((column.getX() << 4) + (yzx & 0xF), ((sectionY + yOffset) << 4) + ((yzx >> 8) & 0xF), (column.getZ() << 4) + ((yzx >> 4) & 0xF)),
|
||||
Vector3i.from((chunk.getX() << 4) + (yzx & 0xF), ((sectionY + yOffset) << 4) + ((yzx >> 8) & 0xF), (chunk.getZ() << 4) + ((yzx >> 4) & 0xF)),
|
||||
javaId
|
||||
));
|
||||
}
|
||||
@ -192,7 +192,7 @@ public class ChunkUtils {
|
||||
int paletteId = javaData.get(yzx);
|
||||
if (pistonOrFlowerPaletteIds.get(paletteId)) {
|
||||
bedrockOnlyBlockEntities.add(BedrockOnlyBlockEntity.getTag(session,
|
||||
Vector3i.from((column.getX() << 4) + (yzx & 0xF), ((sectionY + yOffset) << 4) + ((yzx >> 8) & 0xF), (column.getZ() << 4) + ((yzx >> 4) & 0xF)),
|
||||
Vector3i.from((chunk.getX() << 4) + (yzx & 0xF), ((sectionY + yOffset) << 4) + ((yzx >> 8) & 0xF), (chunk.getZ() << 4) + ((yzx >> 4) & 0xF)),
|
||||
javaPalette.idToState(paletteId)
|
||||
));
|
||||
}
|
||||
@ -234,10 +234,10 @@ public class ChunkUtils {
|
||||
layers = new BlockStorage[]{ layer0, new BlockStorage(BitArrayVersion.V1.createArray(BlockStorage.SIZE, layer1Data), layer1Palette) };
|
||||
}
|
||||
|
||||
sections[bedrockSectionY] = new ChunkSection(layers);
|
||||
sections[bedrockSectionY] = new GeyserChunkSection(layers);
|
||||
}
|
||||
|
||||
CompoundTag[] blockEntities = column.getTileEntities();
|
||||
CompoundTag[] blockEntities = chunk.getBlockEntities();
|
||||
NbtMap[] bedrockBlockEntities = new NbtMap[blockEntities.length + bedrockOnlyBlockEntities.size()];
|
||||
int i = 0;
|
||||
while (i < blockEntities.length) {
|
||||
@ -269,7 +269,7 @@ public class ChunkUtils {
|
||||
|
||||
// Get Java blockstate ID from block entity position
|
||||
int blockState = 0;
|
||||
Chunk section = column.getChunks()[(y >> 4) - yOffset];
|
||||
ChunkSection section = chunk.getSections()[(y >> 4) - yOffset];
|
||||
if (section != null) {
|
||||
blockState = section.get(x & 0xF, y & 0xF, z & 0xF);
|
||||
}
|
||||
@ -453,6 +453,6 @@ public class ChunkUtils {
|
||||
session.getWorldBorder().setWorldCoordinateScale(coordinateScale);
|
||||
}
|
||||
|
||||
public record ChunkData(ChunkSection[] sections, NbtMap[] blockEntities) {
|
||||
public record ChunkData(GeyserChunkSection[] sections, NbtMap[] blockEntities) {
|
||||
}
|
||||
}
|
||||
|
@ -27,8 +27,8 @@ package org.geysermc.connector.utils;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundPickItemPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.window.ServerboundSetCreativeModeSlotPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundPickItemPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetCreativeModeSlotPacket;
|
||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
|
@ -28,9 +28,9 @@ package org.geysermc.connector.utils;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.github.steveice10.mc.protocol.MinecraftConstants;
|
||||
import lombok.Getter;
|
||||
import org.geysermc.connector.GeyserConnector;
|
||||
import org.geysermc.connector.network.MinecraftProtocol;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
@ -69,7 +69,7 @@ public class LocaleUtils {
|
||||
// Get the url for the latest version of the games manifest
|
||||
String latestInfoURL = "";
|
||||
for (Version version : versionManifest.getVersions()) {
|
||||
if (version.getId().equals(MinecraftConstants.GAME_VERSION)) {
|
||||
if (version.getId().equals(MinecraftProtocol.getJavaVersion())) {
|
||||
latestInfoURL = version.getUrl();
|
||||
break;
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren