mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-12-27 15:00:28 +01:00
Update inventory translators
This commit is contained in:
parent
84248fa902
commit
a988fbf290
89 changed files with 314 additions and 305 deletions
|
@ -26,9 +26,6 @@
|
|||
package org.geysermc.geyser.platform.fabric.world;
|
||||
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import com.nukkitx.nbt.NbtType;
|
||||
import me.lucko.fabric.api.permissions.v0.Permissions;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
|
@ -39,6 +36,8 @@ import net.minecraft.world.item.WritableBookItem;
|
|||
import net.minecraft.world.item.WrittenBookItem;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.LecternBlockEntity;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.geyser.level.GeyserWorldManager;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.translator.inventory.LecternInventoryTranslator;
|
||||
|
|
|
@ -26,9 +26,6 @@
|
|||
package org.geysermc.geyser.platform.spigot.world.manager;
|
||||
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import com.nukkitx.nbt.NbtType;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
|
@ -37,6 +34,9 @@ import org.bukkit.entity.Player;
|
|||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BookMeta;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtType;
|
||||
import org.geysermc.geyser.level.GameRule;
|
||||
import org.geysermc.geyser.level.WorldManager;
|
||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
||||
|
|
|
@ -31,9 +31,9 @@ import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
|||
import com.github.steveice10.opennbt.tag.builtin.ListTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
||||
import org.cloudburstmc.math.vector.Vector3f;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import com.nukkitx.nbt.NbtType;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.SetEntityMotionPacket;
|
||||
import org.geysermc.floodgate.util.DeviceOs;
|
||||
|
|
|
@ -33,8 +33,8 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
|
|||
import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType;
|
||||
import org.cloudburstmc.math.vector.Vector3f;
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.protocol.bedrock.data.defintions.BlockDefinition;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.BlockEntityDataPacket;
|
||||
|
|
|
@ -27,8 +27,8 @@ package org.geysermc.geyser.entity.type.living.animal.horse;
|
|||
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata;
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.protocol.bedrock.data.entity.EntityData;
|
||||
import org.cloudburstmc.math.vector.Vector3f;
|
||||
import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.registry.type.ItemMapping;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
|
@ -46,7 +46,7 @@ public class CamelEntity extends AbstractHorseEntity {
|
|||
@Override
|
||||
protected void initializeMetadata() {
|
||||
super.initializeMetadata();
|
||||
this.dirtyMetadata.put(EntityData.VARIANT, 2); // Closest llama colour to camel
|
||||
this.dirtyMetadata.put(EntityDataTypes.VARIANT, 2); // Closest llama colour to camel
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,7 +28,6 @@ package org.geysermc.geyser.entity.type.living.monster;
|
|||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.OptionalIntMetadataType;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata;
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata;
|
||||
import org.cloudburstmc.math.vector.Vector3f;
|
||||
import org.cloudburstmc.protocol.bedrock.data.SoundEvent;
|
||||
import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
|
||||
|
@ -51,10 +50,10 @@ public class EndermanEntity extends MonsterEntity {
|
|||
if (entityMetadata.getValue().isPresent()) {
|
||||
bedrockBlockId = session.getBlockMappings().getBedrockBlockId(entityMetadata.getValue().getAsInt());
|
||||
} else {
|
||||
bedrockBlockId = session.getBlockMappings().getBedrockAirId();
|
||||
bedrockBlockId = session.getBlockMappings().getBedrockAir().getRuntimeId();
|
||||
}
|
||||
|
||||
dirtyMetadata.put(EntityData.BLOCK, bedrockBlockId);
|
||||
dirtyMetadata.put(EntityDataTypes.BLOCK, bedrockBlockId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -47,7 +47,6 @@ import javax.annotation.Nullable;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* The entity class specifically for a {@link GeyserSession}'s player.
|
||||
|
@ -125,8 +124,8 @@ public class SessionPlayerEntity extends PlayerEntity {
|
|||
* See https://github.com/GeyserMC/Geyser/issues/3370
|
||||
*/
|
||||
public void updateBoundingBox() {
|
||||
dirtyMetadata.put(EntityData.BOUNDING_BOX_HEIGHT, getBoundingBoxHeight());
|
||||
dirtyMetadata.put(EntityData.BOUNDING_BOX_WIDTH, getBoundingBoxWidth());
|
||||
dirtyMetadata.put(EntityDataTypes.HEIGHT, getBoundingBoxHeight());
|
||||
dirtyMetadata.put(EntityDataTypes.WIDTH, getBoundingBoxWidth());
|
||||
updateBedrockMetadata();
|
||||
}
|
||||
|
||||
|
|
|
@ -27,9 +27,9 @@ package org.geysermc.geyser.inventory;
|
|||
|
||||
import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType;
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
|
||||
public class LecternContainer extends Container {
|
||||
@Getter @Setter
|
||||
|
|
|
@ -27,7 +27,7 @@ package org.geysermc.geyser.inventory.holder;
|
|||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.BlockEntityDataPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.ContainerClosePacket;
|
||||
|
|
|
@ -31,8 +31,8 @@ import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
|||
import com.github.steveice10.opennbt.tag.builtin.ListTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.StringTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerId;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket;
|
||||
|
|
|
@ -25,8 +25,10 @@
|
|||
|
||||
package org.geysermc.geyser.item.components;
|
||||
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtType;
|
||||
|
||||
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
package org.geysermc.geyser.item.components;
|
||||
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
|
|
@ -25,10 +25,10 @@
|
|||
|
||||
package org.geysermc.geyser.level;
|
||||
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.ChunkCache;
|
||||
|
|
|
@ -28,7 +28,7 @@ package org.geysermc.geyser.level;
|
|||
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
|
||||
import com.github.steveice10.mc.protocol.data.game.setting.Difficulty;
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
|
|
@ -28,12 +28,11 @@ package org.geysermc.geyser.network;
|
|||
import com.github.steveice10.mc.protocol.codec.MinecraftCodec;
|
||||
import com.github.steveice10.mc.protocol.codec.PacketCodec;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodec;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v527.Bedrock_v527;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v534.Bedrock_v534;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v544.Bedrock_v544;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v545.Bedrock_v545;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v554.Bedrock_v554;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v557.Bedrock_v557;
|
||||
import org.cloudburstmc.protocol.bedrock.codec.v560.Bedrock_v560;
|
||||
import org.cloudburstmc.protocol.bedrock.netty.codec.packet.BedrockPacketCodec;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
|
||||
|
@ -98,7 +97,7 @@ public final class GameProtocol {
|
|||
}
|
||||
|
||||
public static boolean supports1_19_50(GeyserSession session) {
|
||||
return session.getUpstream().getProtocolVersion() >= Bedrock_v560.V560_CODEC.getProtocolVersion();
|
||||
return session.getUpstream().getProtocolVersion() >= Bedrock_v560.CODEC.getProtocolVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -53,7 +53,7 @@ public final class LocalSession extends TcpSession {
|
|||
private final String clientIp;
|
||||
private final PacketCodecHelper codecHelper;
|
||||
|
||||
public LocalSession(String host, int port, SocketAddress targetAddress, String clientIp, PacketProtocol protocol, MinecraftCodecHelper codecHelper) {
|
||||
public LocalSession(String host, int port, SocketAddress targetAddress, String clientIp, PacketProtocol protocol, PacketCodecHelper codecHelper) {
|
||||
super(host, port, protocol);
|
||||
this.targetAddress = targetAddress;
|
||||
this.clientIp = clientIp;
|
||||
|
|
|
@ -27,7 +27,7 @@ package org.geysermc.geyser.ping;
|
|||
|
||||
import com.fasterxml.jackson.core.JsonParseException;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.nukkitx.nbt.util.VarInts;
|
||||
import org.cloudburstmc.nbt.util.VarInts;
|
||||
import io.netty.handler.codec.haproxy.HAProxyCommand;
|
||||
import io.netty.handler.codec.haproxy.HAProxyProxiedProtocol;
|
||||
import io.netty.util.NetUtil;
|
||||
|
|
|
@ -31,15 +31,15 @@ import com.github.steveice10.mc.protocol.data.game.level.event.LevelEvent;
|
|||
import com.github.steveice10.mc.protocol.data.game.level.particle.ParticleType;
|
||||
import com.github.steveice10.mc.protocol.data.game.recipe.RecipeType;
|
||||
import com.github.steveice10.packetlib.packet.Packet;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.CraftingData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.PotionMixData;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import it.unimi.dsi.fastutil.Pair;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.crafting.CraftingData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.crafting.PotionMixData;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.BedrockPacket;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.inventory.item.Enchantment.JavaEnchantment;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
package org.geysermc.geyser.registry;
|
||||
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.geysermc.geyser.registry.loader.RegistryLoader;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
|
||||
package org.geysermc.geyser.registry.loader;
|
||||
|
||||
import com.nukkitx.nbt.NBTInputStream;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtUtils;
|
||||
import org.cloudburstmc.nbt.NBTInputStream;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtUtils;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
|
||||
/**
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
package org.geysermc.geyser.registry.loader;
|
||||
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.PotionMixData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.crafting.PotionMixData;
|
||||
import org.geysermc.geyser.inventory.item.Potion;
|
||||
import org.geysermc.geyser.network.GameProtocol;
|
||||
import org.geysermc.geyser.registry.Registries;
|
||||
|
|
|
@ -28,11 +28,11 @@ package org.geysermc.geyser.registry.populator;
|
|||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.nukkitx.nbt.NBTInputStream;
|
||||
import com.nukkitx.nbt.NbtList;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import com.nukkitx.nbt.NbtType;
|
||||
import org.cloudburstmc.nbt.NBTInputStream;
|
||||
import org.cloudburstmc.nbt.NbtList;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtType;
|
||||
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
||||
import it.unimi.dsi.fastutil.ints.IntSet;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
package org.geysermc.geyser.registry.populator;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtUtils;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtUtils;
|
||||
import org.cloudburstmc.protocol.bedrock.data.defintions.ItemDefinition;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
|
||||
import org.geysermc.geyser.GeyserBootstrap;
|
||||
|
|
|
@ -26,9 +26,9 @@
|
|||
package org.geysermc.geyser.registry.populator;
|
||||
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import com.nukkitx.nbt.NbtType;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtType;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.cloudburstmc.protocol.bedrock.data.defintions.ItemDefinition;
|
||||
|
|
|
@ -28,9 +28,9 @@ package org.geysermc.geyser.registry.populator;
|
|||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.collect.MultimapBuilder;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import com.nukkitx.nbt.NbtType;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtType;
|
||||
import it.unimi.dsi.fastutil.Pair;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
|
|
|
@ -29,13 +29,13 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||
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;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtUtils;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.CraftingData;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtUtils;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.crafting.CraftingData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.descriptor.ItemDescriptorWithCount;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.inventory.recipe.GeyserRecipe;
|
||||
|
|
|
@ -25,14 +25,11 @@
|
|||
|
||||
package org.geysermc.geyser.registry.type;
|
||||
|
||||
import com.nukkitx.nbt.NbtList;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import it.unimi.dsi.fastutil.ints.IntSet;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
import lombok.Builder;
|
||||
import lombok.Value;
|
||||
import org.cloudburstmc.nbt.NbtList;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.protocol.bedrock.data.defintions.BlockDefinition;
|
||||
import org.cloudburstmc.protocol.bedrock.data.defintions.ItemDefinition;
|
||||
import org.cloudburstmc.protocol.common.DefinitionRegistry;
|
||||
|
||||
import java.util.Map;
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
package org.geysermc.geyser.session;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.github.steveice10.mc.auth.data.GameProfile;
|
||||
import com.github.steveice10.mc.auth.exception.request.InvalidCredentialsException;
|
||||
import com.github.steveice10.mc.auth.exception.request.RequestException;
|
||||
|
@ -67,7 +66,6 @@ import com.github.steveice10.packetlib.packet.Packet;
|
|||
import com.github.steveice10.packetlib.tcp.TcpClientSession;
|
||||
import com.github.steveice10.packetlib.tcp.TcpSession;
|
||||
import com.nimbusds.jwt.SignedJWT;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.EventLoop;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntMap;
|
||||
|
@ -93,10 +91,10 @@ import org.cloudburstmc.math.vector.Vector2i;
|
|||
import org.cloudburstmc.math.vector.Vector3d;
|
||||
import org.cloudburstmc.math.vector.Vector3f;
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.protocol.bedrock.BedrockServerSession;
|
||||
import org.cloudburstmc.protocol.bedrock.data.Ability;
|
||||
import org.cloudburstmc.protocol.bedrock.data.AbilityLayer;
|
||||
import org.cloudburstmc.protocol.bedrock.data.AdventureSetting;
|
||||
import org.cloudburstmc.protocol.bedrock.data.AttributeData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.AuthoritativeMovementMode;
|
||||
import org.cloudburstmc.protocol.bedrock.data.ChatRestrictionLevel;
|
||||
|
@ -174,6 +172,7 @@ import java.nio.charset.StandardCharsets;
|
|||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.BitSet;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
package org.geysermc.geyser.text;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.BuiltinChatType;
|
||||
import com.github.steveice10.mc.protocol.data.game.chat.BuiltinChatType;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.TextPacket;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
|
||||
|
|
|
@ -27,12 +27,12 @@ package org.geysermc.geyser.translator.inventory;
|
|||
|
||||
import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackRequest;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackResponse;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.CraftRecipeOptionalStackRequestActionData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequest;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.CraftRecipeOptionalAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.ItemStackRequestAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.ItemStackRequestActionType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponse;
|
||||
import org.geysermc.geyser.inventory.AnvilContainer;
|
||||
import org.geysermc.geyser.inventory.BedrockContainerSlot;
|
||||
import org.geysermc.geyser.inventory.Inventory;
|
||||
|
@ -49,14 +49,14 @@ public class AnvilInventoryTranslator extends AbstractBlockInventoryTranslator {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldHandleRequestFirst(StackRequestActionData action, Inventory inventory) {
|
||||
return action.getType() == StackRequestActionType.CRAFT_RECIPE_OPTIONAL;
|
||||
protected boolean shouldHandleRequestFirst(ItemStackRequestAction action, Inventory inventory) {
|
||||
return action.getType() == ItemStackRequestActionType.CRAFT_RECIPE_OPTIONAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemStackResponse translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) {
|
||||
// Guarded by shouldHandleRequestFirst check
|
||||
CraftRecipeOptionalStackRequestActionData data = (CraftRecipeOptionalStackRequestActionData) request.getActions()[0];
|
||||
CraftRecipeOptionalAction data = (CraftRecipeOptionalAction) request.getActions()[0];
|
||||
AnvilContainer container = (AnvilContainer) inventory;
|
||||
|
||||
if (request.getFilterStrings().length != 0) {
|
||||
|
@ -71,7 +71,7 @@ public class AnvilInventoryTranslator extends AbstractBlockInventoryTranslator {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) {
|
||||
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
|
||||
return switch (slotInfoData.getContainer()) {
|
||||
case ANVIL_INPUT -> 0;
|
||||
case ANVIL_MATERIAL -> 1;
|
||||
|
|
|
@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.inventory;
|
|||
|
||||
import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData;
|
||||
import org.geysermc.geyser.inventory.BedrockContainerSlot;
|
||||
import org.geysermc.geyser.inventory.Container;
|
||||
import org.geysermc.geyser.inventory.Inventory;
|
||||
|
@ -46,7 +46,7 @@ public abstract class BaseInventoryTranslator extends InventoryTranslator {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) {
|
||||
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
|
||||
int slotnum = slotInfoData.getSlot();
|
||||
switch (slotInfoData.getContainer()) {
|
||||
case HOTBAR_AND_INVENTORY:
|
||||
|
|
|
@ -27,17 +27,17 @@ package org.geysermc.geyser.translator.inventory;
|
|||
|
||||
import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetBeaconPacket;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import it.unimi.dsi.fastutil.ints.IntSets;
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackRequest;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackResponse;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.BeaconPaymentStackRequestActionData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequest;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.BeaconPaymentAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.ItemStackRequestAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.ItemStackRequestActionType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponse;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.BlockEntityDataPacket;
|
||||
import org.geysermc.geyser.inventory.BeaconContainer;
|
||||
import org.geysermc.geyser.inventory.BedrockContainerSlot;
|
||||
|
@ -105,14 +105,14 @@ public class BeaconInventoryTranslator extends AbstractBlockInventoryTranslator
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldHandleRequestFirst(StackRequestActionData action, Inventory inventory) {
|
||||
return action.getType() == StackRequestActionType.BEACON_PAYMENT;
|
||||
protected boolean shouldHandleRequestFirst(ItemStackRequestAction action, Inventory inventory) {
|
||||
return action.getType() == ItemStackRequestActionType.BEACON_PAYMENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStackResponse translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) {
|
||||
// Input a beacon payment
|
||||
BeaconPaymentStackRequestActionData beaconPayment = (BeaconPaymentStackRequestActionData) request.getActions()[0];
|
||||
BeaconPaymentAction beaconPayment = (BeaconPaymentAction) request.getActions()[0];
|
||||
ServerboundSetBeaconPacket packet = new ServerboundSetBeaconPacket(toJava(beaconPayment.getPrimaryEffect()), toJava(beaconPayment.getSecondaryEffect()));
|
||||
session.sendDownstreamPacket(packet);
|
||||
return acceptRequest(request, makeContainerEntries(session, inventory, IntSets.emptySet()));
|
||||
|
@ -123,7 +123,7 @@ public class BeaconInventoryTranslator extends AbstractBlockInventoryTranslator
|
|||
}
|
||||
|
||||
@Override
|
||||
public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) {
|
||||
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
|
||||
if (slotInfoData.getContainer() == ContainerSlotType.BEACON_PAYMENT) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.inventory;
|
|||
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.ContainerSetDataPacket;
|
||||
import org.geysermc.geyser.inventory.BedrockContainerSlot;
|
||||
import org.geysermc.geyser.inventory.Inventory;
|
||||
|
@ -68,7 +68,7 @@ public class BrewingInventoryTranslator extends AbstractBlockInventoryTranslator
|
|||
}
|
||||
|
||||
@Override
|
||||
public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) {
|
||||
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
|
||||
if (slotInfoData.getContainer() == ContainerSlotType.BREWING_INPUT) {
|
||||
// Ingredient
|
||||
return 3;
|
||||
|
|
|
@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.inventory;
|
|||
|
||||
import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData;
|
||||
import org.geysermc.geyser.inventory.*;
|
||||
import org.geysermc.geyser.inventory.updater.UIInventoryUpdater;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
|
@ -53,7 +53,7 @@ public class CartographyInventoryTranslator extends AbstractBlockInventoryTransl
|
|||
}
|
||||
|
||||
@Override
|
||||
public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) {
|
||||
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
|
||||
return switch (slotInfoData.getContainer()) {
|
||||
case CARTOGRAPHY_INPUT -> 0;
|
||||
case CARTOGRAPHY_ADDITIONAL -> 1;
|
||||
|
|
|
@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.inventory;
|
|||
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData;
|
||||
import org.geysermc.geyser.inventory.BedrockContainerSlot;
|
||||
import org.geysermc.geyser.inventory.SlotType;
|
||||
import org.geysermc.geyser.inventory.updater.UIInventoryUpdater;
|
||||
|
@ -62,7 +62,7 @@ public class CraftingInventoryTranslator extends AbstractBlockInventoryTranslato
|
|||
}
|
||||
|
||||
@Override
|
||||
public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) {
|
||||
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
|
||||
if (slotInfoData.getContainer() == ContainerSlotType.CRAFTING_INPUT) {
|
||||
// Java goes from 1 - 9, left to right then up to down
|
||||
// Bedrock is the same, but it starts from 32.
|
||||
|
|
|
@ -30,12 +30,12 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.Ser
|
|||
import it.unimi.dsi.fastutil.ints.IntSets;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.EnchantOptionData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackRequest;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackResponse;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.CraftRecipeStackRequestActionData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequest;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.ItemStackRequestAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.ItemStackRequestActionType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.RecipeItemStackRequestAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponse;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.PlayerEnchantOptionsPacket;
|
||||
import org.geysermc.geyser.inventory.BedrockContainerSlot;
|
||||
import org.geysermc.geyser.inventory.EnchantingContainer;
|
||||
|
@ -107,14 +107,14 @@ public class EnchantingInventoryTranslator extends AbstractBlockInventoryTransla
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldHandleRequestFirst(StackRequestActionData action, Inventory inventory) {
|
||||
return action.getType() == StackRequestActionType.CRAFT_RECIPE;
|
||||
protected boolean shouldHandleRequestFirst(ItemStackRequestAction action, Inventory inventory) {
|
||||
return action.getType() == ItemStackRequestActionType.CRAFT_RECIPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStackResponse translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) {
|
||||
// Client has requested an item to be enchanted
|
||||
CraftRecipeStackRequestActionData craftRecipeData = (CraftRecipeStackRequestActionData) request.getActions()[0];
|
||||
RecipeItemStackRequestAction craftRecipeData = (RecipeItemStackRequestAction) request.getActions()[0];
|
||||
EnchantingContainer enchantingInventory = (EnchantingContainer) inventory;
|
||||
int javaSlot = -1;
|
||||
for (int i = 0; i < enchantingInventory.getEnchantOptions().length; i++) {
|
||||
|
@ -137,7 +137,7 @@ public class EnchantingInventoryTranslator extends AbstractBlockInventoryTransla
|
|||
}
|
||||
|
||||
@Override
|
||||
public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) {
|
||||
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
|
||||
if (slotInfoData.getContainer() == ContainerSlotType.ENCHANTING_INPUT) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.inventory;
|
|||
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData;
|
||||
import org.geysermc.geyser.inventory.BedrockContainerSlot;
|
||||
import org.geysermc.geyser.inventory.updater.UIInventoryUpdater;
|
||||
|
||||
|
@ -37,7 +37,7 @@ public class GrindstoneInventoryTranslator extends AbstractBlockInventoryTransla
|
|||
}
|
||||
|
||||
@Override
|
||||
public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) {
|
||||
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
|
||||
return switch (slotInfoData.getContainer()) {
|
||||
case GRINDSTONE_INPUT -> 0;
|
||||
case GRINDSTONE_ADDITIONAL -> 1;
|
||||
|
|
|
@ -30,14 +30,20 @@ import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType;
|
|||
import com.github.steveice10.mc.protocol.data.game.recipe.Ingredient;
|
||||
import com.github.steveice10.opennbt.tag.builtin.IntTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerEntry;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemEntry;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackRequest;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackResponse;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ResponseStatus;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.*;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequest;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.AutoCraftRecipeAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.ConsumeAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.CraftResultsDeprecatedAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.DropAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.ItemStackRequestAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.SwapAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.TransferItemStackRequestAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponse;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponseContainer;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponseSlot;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponseStatus;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.ItemStackResponsePacket;
|
||||
import it.unimi.dsi.fastutil.ints.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
@ -111,7 +117,7 @@ public abstract class InventoryTranslator {
|
|||
public abstract void updateProperty(GeyserSession session, Inventory inventory, int key, int value);
|
||||
public abstract void updateInventory(GeyserSession session, Inventory inventory);
|
||||
public abstract void updateSlot(GeyserSession session, Inventory inventory, int slot);
|
||||
public abstract int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData);
|
||||
public abstract int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData);
|
||||
public abstract int javaSlotToBedrock(int javaSlot);
|
||||
public abstract BedrockContainerSlot javaSlotToBedrockContainer(int javaSlot);
|
||||
public abstract SlotType getSlotType(int javaSlot);
|
||||
|
@ -141,12 +147,12 @@ public abstract class InventoryTranslator {
|
|||
* Should be overrided if this request matches a certain criteria and shouldn't be treated normally.
|
||||
* E.G. anvil renaming or enchanting
|
||||
*/
|
||||
protected boolean shouldHandleRequestFirst(StackRequestActionData action, Inventory inventory) {
|
||||
protected boolean shouldHandleRequestFirst(ItemStackRequestAction action, Inventory inventory) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* If {@link #shouldHandleRequestFirst(StackRequestActionData, Inventory)} returns true, this will be called
|
||||
* If {@link #shouldHandleRequestFirst(ItemStackRequestAction, Inventory)} returns true, this will be called
|
||||
*/
|
||||
protected ItemStackResponse translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) {
|
||||
return rejectRequest(request);
|
||||
|
@ -158,7 +164,7 @@ public abstract class InventoryTranslator {
|
|||
for (ItemStackRequest request : requests) {
|
||||
ItemStackResponse response;
|
||||
if (request.getActions().length > 0) {
|
||||
StackRequestActionData firstAction = request.getActions()[0];
|
||||
ItemStackRequestAction firstAction = request.getActions()[0];
|
||||
if (shouldHandleRequestFirst(firstAction, inventory)) {
|
||||
// Some special request that shouldn't be processed normally
|
||||
response = translateSpecialRequest(session, inventory, request);
|
||||
|
@ -176,7 +182,7 @@ public abstract class InventoryTranslator {
|
|||
response = rejectRequest(request);
|
||||
}
|
||||
|
||||
if (response.getResult() != ResponseStatus.OK) {
|
||||
if (response.getResult() != ItemStackResponseStatus.OK) {
|
||||
// Sync our copy of the inventory with Bedrock's to prevent desyncs
|
||||
refresh = true;
|
||||
}
|
||||
|
@ -197,12 +203,12 @@ public abstract class InventoryTranslator {
|
|||
public ItemStackResponse translateRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) {
|
||||
ClickPlan plan = new ClickPlan(session, this, inventory);
|
||||
IntSet affectedSlots = new IntOpenHashSet();
|
||||
for (StackRequestActionData action : request.getActions()) {
|
||||
for (ItemStackRequestAction action : request.getActions()) {
|
||||
GeyserItemStack cursor = session.getPlayerInventory().getCursor();
|
||||
switch (action.getType()) {
|
||||
case TAKE:
|
||||
case PLACE: {
|
||||
TransferStackRequestActionData transferAction = (TransferStackRequestActionData) action;
|
||||
TransferItemStackRequestAction transferAction = (TransferItemStackRequestAction) action;
|
||||
if (!(checkNetId(session, inventory, transferAction.getSource()) && checkNetId(session, inventory, transferAction.getDestination()))) {
|
||||
if (session.getGeyser().getConfig().isDebugMode()) {
|
||||
session.getGeyser().getLogger().error("DEBUG: About to reject TAKE/PLACE request made by " + session.bedrockUsername());
|
||||
|
@ -290,9 +296,9 @@ public abstract class InventoryTranslator {
|
|||
break;
|
||||
}
|
||||
case SWAP: {
|
||||
SwapStackRequestActionData swapAction = (SwapStackRequestActionData) action;
|
||||
StackRequestSlotInfoData source = swapAction.getSource();
|
||||
StackRequestSlotInfoData destination = swapAction.getDestination();
|
||||
SwapAction swapAction = (SwapAction) action;
|
||||
ItemStackRequestSlotData source = swapAction.getSource();
|
||||
ItemStackRequestSlotData destination = swapAction.getDestination();
|
||||
|
||||
if (!(checkNetId(session, inventory, source) && checkNetId(session, inventory, destination))) {
|
||||
if (session.getGeyser().getConfig().isDebugMode()) {
|
||||
|
@ -352,7 +358,7 @@ public abstract class InventoryTranslator {
|
|||
break;
|
||||
}
|
||||
case DROP: {
|
||||
DropStackRequestActionData dropAction = (DropStackRequestActionData) action;
|
||||
DropAction dropAction = (DropAction) action;
|
||||
if (!checkNetId(session, inventory, dropAction.getSource()))
|
||||
return rejectRequest(request);
|
||||
|
||||
|
@ -381,7 +387,7 @@ public abstract class InventoryTranslator {
|
|||
case CONSUME: { // Tends to be called for UI inventories
|
||||
if (inventory instanceof CartographyContainer) {
|
||||
// TODO add this for more inventories? Only seems to glitch out the cartography table, though.
|
||||
ConsumeStackRequestActionData consumeData = (ConsumeStackRequestActionData) action;
|
||||
ConsumeAction consumeData = (ConsumeAction) action;
|
||||
|
||||
int sourceSlot = bedrockSlotToJava(consumeData.getSource());
|
||||
if ((sourceSlot == 0 && inventory.getItem(1).isEmpty()) || (sourceSlot == 1 && inventory.getItem(0).isEmpty())) {
|
||||
|
@ -436,7 +442,7 @@ public abstract class InventoryTranslator {
|
|||
ClickPlan plan = new ClickPlan(session, this, inventory);
|
||||
// Track all the crafting table slots to report back the contents of the slots after crafting
|
||||
IntSet affectedSlots = new IntOpenHashSet();
|
||||
for (StackRequestActionData action : request.getActions()) {
|
||||
for (ItemStackRequestAction action : request.getActions()) {
|
||||
switch (action.getType()) {
|
||||
case CRAFT_RECIPE: {
|
||||
if (craftState != CraftState.START) {
|
||||
|
@ -446,7 +452,7 @@ public abstract class InventoryTranslator {
|
|||
break;
|
||||
}
|
||||
case CRAFT_RESULTS_DEPRECATED: {
|
||||
CraftResultsDeprecatedStackRequestActionData deprecatedCraftAction = (CraftResultsDeprecatedStackRequestActionData) action;
|
||||
CraftResultsDeprecatedAction deprecatedCraftAction = (CraftResultsDeprecatedAction) action;
|
||||
if (craftState != CraftState.RECIPE_ID) {
|
||||
return rejectRequest(request);
|
||||
}
|
||||
|
@ -467,12 +473,12 @@ public abstract class InventoryTranslator {
|
|||
return rejectRequest(request);
|
||||
}
|
||||
craftState = CraftState.INGREDIENTS;
|
||||
affectedSlots.add(bedrockSlotToJava(((ConsumeStackRequestActionData) action).getSource()));
|
||||
affectedSlots.add(bedrockSlotToJava(((ConsumeAction) action).getSource()));
|
||||
break;
|
||||
}
|
||||
case TAKE:
|
||||
case PLACE: {
|
||||
TransferStackRequestActionData transferAction = (TransferStackRequestActionData) action;
|
||||
TransferItemStackRequestAction transferAction = (TransferItemStackRequestAction) action;
|
||||
if (craftState != CraftState.INGREDIENTS && craftState != CraftState.TRANSFER) {
|
||||
return rejectRequest(request);
|
||||
}
|
||||
|
@ -556,10 +562,10 @@ public abstract class InventoryTranslator {
|
|||
|
||||
ClickPlan plan = new ClickPlan(session, this, inventory);
|
||||
requestLoop:
|
||||
for (StackRequestActionData action : request.getActions()) {
|
||||
for (ItemStackRequestAction action : request.getActions()) {
|
||||
switch (action.getType()) {
|
||||
case CRAFT_RECIPE_AUTO: {
|
||||
AutoCraftRecipeStackRequestActionData autoCraftAction = (AutoCraftRecipeStackRequestActionData) action;
|
||||
AutoCraftRecipeAction autoCraftAction = (AutoCraftRecipeAction) action;
|
||||
// TODO autoCraftAction#getTimesCrafted 1.17.10 ???
|
||||
if (craftState != CraftState.START) {
|
||||
return rejectRequest(request);
|
||||
|
@ -601,7 +607,7 @@ public abstract class InventoryTranslator {
|
|||
break;
|
||||
}
|
||||
case CRAFT_RESULTS_DEPRECATED: {
|
||||
CraftResultsDeprecatedStackRequestActionData deprecatedCraftAction = (CraftResultsDeprecatedStackRequestActionData) action;
|
||||
CraftResultsDeprecatedAction deprecatedCraftAction = (CraftResultsDeprecatedAction) action;
|
||||
if (craftState != CraftState.RECIPE_ID) {
|
||||
return rejectRequest(request);
|
||||
}
|
||||
|
@ -618,7 +624,7 @@ public abstract class InventoryTranslator {
|
|||
break;
|
||||
}
|
||||
case CONSUME: {
|
||||
ConsumeStackRequestActionData consumeAction = (ConsumeStackRequestActionData) action;
|
||||
ConsumeAction consumeAction = (ConsumeAction) action;
|
||||
if (craftState != CraftState.DEPRECATED && craftState != CraftState.INGREDIENTS) {
|
||||
return rejectRequest(request);
|
||||
}
|
||||
|
@ -647,7 +653,7 @@ public abstract class InventoryTranslator {
|
|||
}
|
||||
case TAKE:
|
||||
case PLACE: {
|
||||
TransferStackRequestActionData transferAction = (TransferStackRequestActionData) action;
|
||||
TransferItemStackRequestAction transferAction = (TransferItemStackRequestAction) action;
|
||||
if (craftState != CraftState.INGREDIENTS && craftState != CraftState.TRANSFER) {
|
||||
return rejectRequest(request);
|
||||
}
|
||||
|
@ -754,8 +760,8 @@ public abstract class InventoryTranslator {
|
|||
}
|
||||
}
|
||||
|
||||
protected static ItemStackResponse acceptRequest(ItemStackRequest request, List<ContainerEntry> containerEntries) {
|
||||
return new ItemStackResponse(ResponseStatus.OK, request.getRequestId(), containerEntries);
|
||||
protected static ItemStackResponse acceptRequest(ItemStackRequest request, List<ItemStackResponseContainer> containerEntries) {
|
||||
return new ItemStackResponse(ItemStackResponseStatus.OK, request.getRequestId(), containerEntries);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -775,20 +781,20 @@ public abstract class InventoryTranslator {
|
|||
if (throwError && GeyserImpl.getInstance().getConfig().isDebugMode()) {
|
||||
new Throwable("DEBUGGING: ItemStackRequest rejected " + request.toString()).printStackTrace();
|
||||
}
|
||||
return new ItemStackResponse(ResponseStatus.ERROR, request.getRequestId(), Collections.emptyList());
|
||||
return new ItemStackResponse(ItemStackResponseStatus.ERROR, request.getRequestId(), Collections.emptyList());
|
||||
}
|
||||
|
||||
/**
|
||||
* Print out the contents of an ItemStackRequest, should the net ID check fail.
|
||||
*/
|
||||
protected void dumpStackRequestDetails(GeyserSession session, Inventory inventory, StackRequestSlotInfoData source, StackRequestSlotInfoData destination) {
|
||||
protected void dumpStackRequestDetails(GeyserSession session, Inventory inventory, ItemStackRequestSlotData source, ItemStackRequestSlotData destination) {
|
||||
session.getGeyser().getLogger().error("Source: " + source.toString() + " Result: " + checkNetId(session, inventory, source));
|
||||
session.getGeyser().getLogger().error("Destination: " + destination.toString() + " Result: " + checkNetId(session, inventory, destination));
|
||||
session.getGeyser().getLogger().error("Geyser's record of source slot: " + inventory.getItem(bedrockSlotToJava(source)));
|
||||
session.getGeyser().getLogger().error("Geyser's record of destination slot: " + inventory.getItem(bedrockSlotToJava(destination)));
|
||||
}
|
||||
|
||||
public boolean checkNetId(GeyserSession session, Inventory inventory, StackRequestSlotInfoData slotInfoData) {
|
||||
public boolean checkNetId(GeyserSession session, Inventory inventory, ItemStackRequestSlotData slotInfoData) {
|
||||
int netId = slotInfoData.getStackNetworkId();
|
||||
// "In my testing, sometimes the client thinks the netId of an item in the crafting grid is 1, even though we never said it was.
|
||||
// I think it only happens when we manually set the grid but that was my quick fix"
|
||||
|
@ -846,30 +852,30 @@ public abstract class InventoryTranslator {
|
|||
return -1;
|
||||
}
|
||||
|
||||
protected final List<ContainerEntry> makeContainerEntries(GeyserSession session, Inventory inventory, IntSet affectedSlots) {
|
||||
Map<ContainerSlotType, List<ItemEntry>> containerMap = new HashMap<>();
|
||||
protected final List<ItemStackResponseContainer> makeContainerEntries(GeyserSession session, Inventory inventory, IntSet affectedSlots) {
|
||||
Map<ContainerSlotType, List<ItemStackResponseSlot>> containerMap = new HashMap<>();
|
||||
// Manually call iterator to prevent Integer boxing
|
||||
IntIterator it = affectedSlots.iterator();
|
||||
while (it.hasNext()) {
|
||||
int slot = it.nextInt();
|
||||
BedrockContainerSlot bedrockSlot = javaSlotToBedrockContainer(slot);
|
||||
List<ItemEntry> list = containerMap.computeIfAbsent(bedrockSlot.container(), k -> new ArrayList<>());
|
||||
List<ItemStackResponseSlot> list = containerMap.computeIfAbsent(bedrockSlot.container(), k -> new ArrayList<>());
|
||||
list.add(makeItemEntry(session, bedrockSlot.slot(), inventory.getItem(slot)));
|
||||
}
|
||||
|
||||
List<ContainerEntry> containerEntries = new ArrayList<>();
|
||||
for (Map.Entry<ContainerSlotType, List<ItemEntry>> entry : containerMap.entrySet()) {
|
||||
containerEntries.add(new ContainerEntry(entry.getKey(), entry.getValue()));
|
||||
List<ItemStackResponseContainer> containerEntries = new ArrayList<>();
|
||||
for (Map.Entry<ContainerSlotType, List<ItemStackResponseSlot>> entry : containerMap.entrySet()) {
|
||||
containerEntries.add(new ItemStackResponseContainer(entry.getKey(), entry.getValue()));
|
||||
}
|
||||
|
||||
ItemEntry cursorEntry = makeItemEntry(session, 0, session.getPlayerInventory().getCursor());
|
||||
containerEntries.add(new ContainerEntry(ContainerSlotType.CURSOR, Collections.singletonList(cursorEntry)));
|
||||
ItemStackResponseSlot cursorEntry = makeItemEntry(session, 0, session.getPlayerInventory().getCursor());
|
||||
containerEntries.add(new ItemStackResponseContainer(ContainerSlotType.CURSOR, Collections.singletonList(cursorEntry)));
|
||||
|
||||
return containerEntries;
|
||||
}
|
||||
|
||||
private static ItemEntry makeItemEntry(GeyserSession session, int bedrockSlot, GeyserItemStack itemStack) {
|
||||
ItemEntry itemEntry;
|
||||
private static ItemStackResponseSlot makeItemEntry(GeyserSession session, int bedrockSlot, GeyserItemStack itemStack) {
|
||||
ItemStackResponseSlot itemEntry;
|
||||
if (!itemStack.isEmpty()) {
|
||||
// As of 1.16.210: Bedrock needs confirmation on what the current item durability is.
|
||||
// If 0 is sent, then Bedrock thinks the item is not damaged
|
||||
|
@ -881,14 +887,14 @@ public abstract class InventoryTranslator {
|
|||
}
|
||||
}
|
||||
|
||||
itemEntry = new ItemEntry((byte) bedrockSlot, (byte) bedrockSlot, (byte) itemStack.getAmount(), itemStack.getNetId(), "", durability);
|
||||
itemEntry = new ItemStackResponseSlot((byte) bedrockSlot, (byte) bedrockSlot, (byte) itemStack.getAmount(), itemStack.getNetId(), "", durability);
|
||||
} else {
|
||||
itemEntry = new ItemEntry((byte) bedrockSlot, (byte) bedrockSlot, (byte) 0, 0, "", 0);
|
||||
itemEntry = new ItemStackResponseSlot((byte) bedrockSlot, (byte) bedrockSlot, (byte) 0, 0, "", 0);
|
||||
}
|
||||
return itemEntry;
|
||||
}
|
||||
|
||||
protected static boolean isCursor(StackRequestSlotInfoData slotInfoData) {
|
||||
protected static boolean isCursor(ItemStackRequestSlotData slotInfoData) {
|
||||
return slotInfoData.getContainer() == ContainerSlotType.CURSOR;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,9 +31,9 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.Ser
|
|||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.ListTag;
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import com.nukkitx.nbt.NbtType;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
|
||||
import org.geysermc.geyser.inventory.GeyserItemStack;
|
||||
import org.geysermc.geyser.inventory.Inventory;
|
||||
|
|
|
@ -28,19 +28,19 @@ package org.geysermc.geyser.translator.inventory;
|
|||
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;
|
||||
import com.nukkitx.nbt.NbtType;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtType;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackRequest;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackResponse;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.CraftLoomStackRequestActionData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.CraftResultsDeprecatedStackRequestActionData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequest;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.CraftLoomAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.CraftResultsDeprecatedAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.ItemStackRequestAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.ItemStackRequestActionType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponse;
|
||||
import org.geysermc.geyser.inventory.BedrockContainerSlot;
|
||||
import org.geysermc.geyser.inventory.GeyserItemStack;
|
||||
import org.geysermc.geyser.inventory.Inventory;
|
||||
|
@ -117,19 +117,19 @@ public class LoomInventoryTranslator extends AbstractBlockInventoryTranslator {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldHandleRequestFirst(StackRequestActionData action, Inventory inventory) {
|
||||
protected boolean shouldHandleRequestFirst(ItemStackRequestAction action, Inventory inventory) {
|
||||
// If the LOOM_MATERIAL slot is not empty, we are crafting a pattern that does not come from an item
|
||||
return action.getType() == StackRequestActionType.CRAFT_LOOM && inventory.getItem(2).isEmpty();
|
||||
return action.getType() == ItemStackRequestActionType.CRAFT_LOOM && inventory.getItem(2).isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStackResponse translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) {
|
||||
StackRequestActionData headerData = request.getActions()[0];
|
||||
StackRequestActionData data = request.getActions()[1];
|
||||
if (!(headerData instanceof CraftLoomStackRequestActionData)) {
|
||||
ItemStackRequestAction headerData = request.getActions()[0];
|
||||
ItemStackRequestAction data = request.getActions()[1];
|
||||
if (!(headerData instanceof CraftLoomAction)) {
|
||||
return rejectRequest(request);
|
||||
}
|
||||
if (!(data instanceof CraftResultsDeprecatedStackRequestActionData craftData)) {
|
||||
if (!(data instanceof CraftResultsDeprecatedAction craftData)) {
|
||||
return rejectRequest(request);
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ public class LoomInventoryTranslator extends AbstractBlockInventoryTranslator {
|
|||
List<NbtMap> newBlockEntityTag = craftData.getResultItems()[0].getTag().getList("Patterns", NbtType.COMPOUND);
|
||||
// Get the pattern that the Bedrock client requests - the last pattern in the Patterns list
|
||||
NbtMap pattern = newBlockEntityTag.get(newBlockEntityTag.size() - 1);
|
||||
String bedrockPattern = ((CraftLoomStackRequestActionData) headerData).getPatternId();
|
||||
String bedrockPattern = ((CraftLoomAction) headerData).getPatternId();
|
||||
|
||||
// Get the Java index of this pattern
|
||||
int index = PATTERN_TO_INDEX.getOrDefault(bedrockPattern, -1);
|
||||
|
@ -181,7 +181,7 @@ public class LoomInventoryTranslator extends AbstractBlockInventoryTranslator {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) {
|
||||
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
|
||||
return switch (slotInfoData.getContainer()) {
|
||||
case LOOM_INPUT -> 0;
|
||||
case LOOM_DYE -> 1;
|
||||
|
|
|
@ -31,11 +31,11 @@ import org.cloudburstmc.math.vector.Vector3f;
|
|||
import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
|
||||
import org.cloudburstmc.protocol.bedrock.data.entity.EntityLinkData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackRequest;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackResponse;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.AutoCraftRecipeStackRequestActionData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.CraftRecipeStackRequestActionData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequest;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.AutoCraftRecipeAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.CraftRecipeAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponse;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.SetEntityLinkPacket;
|
||||
import org.geysermc.geyser.entity.EntityDefinitions;
|
||||
import org.geysermc.geyser.entity.type.Entity;
|
||||
|
@ -80,7 +80,7 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) {
|
||||
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
|
||||
return switch (slotInfoData.getContainer()) {
|
||||
case TRADE2_INGREDIENT1 -> 0;
|
||||
case TRADE2_INGREDIENT2 -> 1;
|
||||
|
@ -144,7 +144,7 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator {
|
|||
// Behavior as of 1.18.10.
|
||||
// We set the net ID to the trade index + 1. This doesn't appear to cause issues and means we don't have to
|
||||
// store a map of net ID to trade index on our end.
|
||||
int tradeChoice = ((CraftRecipeStackRequestActionData) request.getActions()[0]).getRecipeNetworkId() - 1;
|
||||
int tradeChoice = ((CraftRecipeAction) request.getActions()[0]).getRecipeNetworkId() - 1;
|
||||
return handleTrade(session, inventory, request, tradeChoice);
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ public class MerchantInventoryTranslator extends BaseInventoryTranslator {
|
|||
// 1.18.10 update - seems impossible to call without consoles/controller input
|
||||
// We set the net ID to the trade index + 1. This doesn't appear to cause issues and means we don't have to
|
||||
// store a map of net ID to trade index on our end.
|
||||
int tradeChoice = ((AutoCraftRecipeStackRequestActionData) request.getActions()[0]).getRecipeNetworkId() - 1;
|
||||
int tradeChoice = ((AutoCraftRecipeAction) request.getActions()[0]).getRecipeNetworkId() - 1;
|
||||
return handleTrade(session, inventory, request, tradeChoice);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,15 +36,15 @@ import it.unimi.dsi.fastutil.ints.IntSet;
|
|||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerId;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackRequest;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackResponse;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.CraftCreativeStackRequestActionData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.DestroyStackRequestActionData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.DropStackRequestActionData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.SwapStackRequestActionData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.TransferStackRequestActionData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequest;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.CraftCreativeAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.DestroyAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.DropAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.ItemStackRequestAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.SwapAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.TransferItemStackRequestAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponse;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.InventoryContentPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket;
|
||||
import org.geysermc.geyser.inventory.BedrockContainerSlot;
|
||||
|
@ -174,7 +174,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) {
|
||||
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
|
||||
int slotnum = slotInfoData.getSlot();
|
||||
switch (slotInfoData.getContainer()) {
|
||||
case HOTBAR_AND_INVENTORY:
|
||||
|
@ -246,10 +246,10 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
|
|||
|
||||
PlayerInventory playerInv = session.getPlayerInventory();
|
||||
IntSet affectedSlots = new IntOpenHashSet();
|
||||
for (StackRequestActionData action : request.getActions()) {
|
||||
for (ItemStackRequestAction action : request.getActions()) {
|
||||
switch (action.getType()) {
|
||||
case TAKE, PLACE -> {
|
||||
TransferStackRequestActionData transferAction = (TransferStackRequestActionData) action;
|
||||
TransferItemStackRequestAction transferAction = (TransferItemStackRequestAction) action;
|
||||
if (!(checkNetId(session, inventory, transferAction.getSource()) && checkNetId(session, inventory, transferAction.getDestination()))) {
|
||||
return rejectRequest(request);
|
||||
}
|
||||
|
@ -296,7 +296,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
|
|||
}
|
||||
}
|
||||
case SWAP -> {
|
||||
SwapStackRequestActionData swapAction = (SwapStackRequestActionData) action;
|
||||
SwapAction swapAction = (SwapAction) action;
|
||||
if (!(checkNetId(session, inventory, swapAction.getSource()) && checkNetId(session, inventory, swapAction.getDestination()))) {
|
||||
return rejectRequest(request);
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
|
|||
}
|
||||
}
|
||||
case DROP -> {
|
||||
DropStackRequestActionData dropAction = (DropStackRequestActionData) action;
|
||||
DropAction dropAction = (DropAction) action;
|
||||
if (!checkNetId(session, inventory, dropAction.getSource())) {
|
||||
return rejectRequest(request);
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
|
|||
}
|
||||
case DESTROY -> {
|
||||
// Only called when a creative client wants to destroy an item... I think - Camotoy
|
||||
DestroyStackRequestActionData destroyAction = (DestroyStackRequestActionData) action;
|
||||
DestroyAction destroyAction = (DestroyAction) action;
|
||||
if (!checkNetId(session, inventory, destroyAction.getSource())) {
|
||||
return rejectRequest(request);
|
||||
}
|
||||
|
@ -403,10 +403,10 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
|
|||
ItemStack javaCreativeItem = null;
|
||||
IntSet affectedSlots = new IntOpenHashSet();
|
||||
CraftState craftState = CraftState.START;
|
||||
for (StackRequestActionData action : request.getActions()) {
|
||||
for (ItemStackRequestAction action : request.getActions()) {
|
||||
switch (action.getType()) {
|
||||
case CRAFT_CREATIVE: {
|
||||
CraftCreativeStackRequestActionData creativeAction = (CraftCreativeStackRequestActionData) action;
|
||||
CraftCreativeAction creativeAction = (CraftCreativeAction) action;
|
||||
if (craftState != CraftState.START) {
|
||||
return rejectRequest(request);
|
||||
}
|
||||
|
@ -430,7 +430,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
|
|||
break;
|
||||
}
|
||||
case DESTROY: {
|
||||
DestroyStackRequestActionData destroyAction = (DestroyStackRequestActionData) action;
|
||||
DestroyAction destroyAction = (DestroyAction) action;
|
||||
if (craftState != CraftState.DEPRECATED) {
|
||||
return rejectRequest(request);
|
||||
}
|
||||
|
@ -442,7 +442,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
|
|||
}
|
||||
case TAKE:
|
||||
case PLACE: {
|
||||
TransferStackRequestActionData transferAction = (TransferStackRequestActionData) action;
|
||||
TransferItemStackRequestAction transferAction = (TransferItemStackRequestAction) action;
|
||||
if (!(craftState == CraftState.DEPRECATED || craftState == CraftState.TRANSFER)) {
|
||||
return rejectRequest(request);
|
||||
}
|
||||
|
@ -480,7 +480,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
|
|||
return rejectRequest(request);
|
||||
}
|
||||
|
||||
DropStackRequestActionData dropAction = (DropStackRequestActionData) action;
|
||||
DropAction dropAction = (DropAction) action;
|
||||
if (dropAction.getSource().getContainer() != ContainerSlotType.CREATIVE_OUTPUT || dropAction.getSource().getSlot() != 50) {
|
||||
return rejectRequest(request);
|
||||
}
|
||||
|
@ -517,7 +517,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
|
|||
session.sendDownstreamPacket(creativePacket);
|
||||
}
|
||||
|
||||
private static boolean isCraftingGrid(StackRequestSlotInfoData slotInfoData) {
|
||||
private static boolean isCraftingGrid(ItemStackRequestSlotData slotInfoData) {
|
||||
return slotInfoData.getContainer() == ContainerSlotType.CRAFTING_INPUT;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ package org.geysermc.geyser.translator.inventory;
|
|||
|
||||
import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType;
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.BlockEntityDataPacket;
|
||||
|
|
|
@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.inventory;
|
|||
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData;
|
||||
import org.geysermc.geyser.inventory.BedrockContainerSlot;
|
||||
import org.geysermc.geyser.inventory.updater.UIInventoryUpdater;
|
||||
|
||||
|
@ -37,7 +37,7 @@ public class SmithingInventoryTranslator extends AbstractBlockInventoryTranslato
|
|||
}
|
||||
|
||||
@Override
|
||||
public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) {
|
||||
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
|
||||
return switch (slotInfoData.getContainer()) {
|
||||
case SMITHING_TABLE_INPUT -> 0;
|
||||
case SMITHING_TABLE_MATERIAL -> 1;
|
||||
|
|
|
@ -29,12 +29,12 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
|
|||
import com.github.steveice10.mc.protocol.data.game.inventory.ContainerType;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundContainerButtonClickPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackRequest;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemStackResponse;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.CraftRecipeStackRequestActionData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.stackrequestactions.StackRequestActionType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequest;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.ItemStackRequestAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.ItemStackRequestActionType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.action.RecipeItemStackRequestAction;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.response.ItemStackResponse;
|
||||
import org.geysermc.geyser.inventory.BedrockContainerSlot;
|
||||
import org.geysermc.geyser.inventory.GeyserItemStack;
|
||||
import org.geysermc.geyser.inventory.Inventory;
|
||||
|
@ -51,14 +51,14 @@ public class StonecutterInventoryTranslator extends AbstractBlockInventoryTransl
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldHandleRequestFirst(StackRequestActionData action, Inventory inventory) {
|
||||
return action.getType() == StackRequestActionType.CRAFT_RECIPE;
|
||||
protected boolean shouldHandleRequestFirst(ItemStackRequestAction action, Inventory inventory) {
|
||||
return action.getType() == ItemStackRequestActionType.CRAFT_RECIPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemStackResponse translateSpecialRequest(GeyserSession session, Inventory inventory, ItemStackRequest request) {
|
||||
// Guarded by shouldHandleRequestFirst
|
||||
CraftRecipeStackRequestActionData data = (CraftRecipeStackRequestActionData) request.getActions()[0];
|
||||
RecipeItemStackRequestAction data = (RecipeItemStackRequestAction) request.getActions()[0];
|
||||
|
||||
// Look up all possible options of cutting from this ID
|
||||
GeyserStonecutterData craftingData = session.getStonecutterRecipes().get(data.getRecipeNetworkId());
|
||||
|
@ -86,7 +86,7 @@ public class StonecutterInventoryTranslator extends AbstractBlockInventoryTransl
|
|||
}
|
||||
|
||||
@Override
|
||||
public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) {
|
||||
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
|
||||
return switch (slotInfoData.getContainer()) {
|
||||
case STONECUTTER_INPUT -> 0;
|
||||
case STONECUTTER_RESULT, CREATIVE_OUTPUT -> 1;
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
package org.geysermc.geyser.translator.inventory.chest;
|
||||
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.protocol.bedrock.data.defintions.BlockDefinition;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.BlockEntityDataPacket;
|
||||
|
|
|
@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.inventory.horse;
|
|||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerId;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.InventoryContentPacket;
|
||||
import org.geysermc.geyser.inventory.BedrockContainerSlot;
|
||||
import org.geysermc.geyser.inventory.Inventory;
|
||||
|
@ -52,7 +52,7 @@ public abstract class ChestedHorseInventoryTranslator extends AbstractHorseInven
|
|||
}
|
||||
|
||||
@Override
|
||||
public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) {
|
||||
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
|
||||
if (slotInfoData.getContainer() == ContainerSlotType.HORSE_EQUIP) {
|
||||
return this.equipSlot;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
package org.geysermc.geyser.translator.inventory.horse;
|
||||
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerSlotType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.StackRequestSlotInfoData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.ItemStackRequestSlotData;
|
||||
import org.geysermc.geyser.inventory.BedrockContainerSlot;
|
||||
|
||||
public class HorseInventoryTranslator extends AbstractHorseInventoryTranslator {
|
||||
|
@ -35,7 +35,7 @@ public class HorseInventoryTranslator extends AbstractHorseInventoryTranslator {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int bedrockSlotToJava(StackRequestSlotInfoData slotInfoData) {
|
||||
public int bedrockSlotToJava(ItemStackRequestSlotData slotInfoData) {
|
||||
if (slotInfoData.getContainer() == ContainerSlotType.HORSE_EQUIP) {
|
||||
return slotInfoData.getSlot();
|
||||
}
|
||||
|
|
|
@ -39,10 +39,10 @@ import com.github.steveice10.opennbt.tag.builtin.LongTag;
|
|||
import com.github.steveice10.opennbt.tag.builtin.ShortTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.StringTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
||||
import com.nukkitx.nbt.NbtList;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import com.nukkitx.nbt.NbtType;
|
||||
import org.cloudburstmc.nbt.NbtList;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtType;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
@ -380,7 +380,7 @@ public abstract class ItemTranslator {
|
|||
if (tag instanceof LongArrayTag) {
|
||||
//Long array tag does not exist in BE
|
||||
//LongArrayTag longArrayTag = (LongArrayTag) tag;
|
||||
//return new com.nukkitx.nbt.tag.LongArrayTag(longArrayTag.getName(), longArrayTag.getValue());
|
||||
//return new org.cloudburstmc.nbt.tag.LongArrayTag(longArrayTag.getName(), longArrayTag.getValue());
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,9 +26,9 @@
|
|||
package org.geysermc.geyser.translator.inventory.item.nbt;
|
||||
|
||||
import com.github.steveice10.opennbt.tag.builtin.*;
|
||||
import com.nukkitx.nbt.NbtList;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtType;
|
||||
import org.cloudburstmc.nbt.NbtList;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtType;
|
||||
import org.geysermc.geyser.network.GameProtocol;
|
||||
import org.geysermc.geyser.registry.Registries;
|
||||
import org.geysermc.geyser.registry.type.ItemMapping;
|
||||
|
|
|
@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType;
|
|||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.ListTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
||||
import org.geysermc.geyser.translator.inventory.item.nbt.BannerTranslator;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.level.block.entity;
|
|||
|
||||
import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType;
|
||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
|
||||
@BlockEntity(type = BlockEntityType.BEACON)
|
||||
public class BeaconBlockEntityTranslator extends BlockEntityTranslator {
|
||||
|
|
|
@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.level.block.entity;
|
|||
|
||||
import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType;
|
||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
||||
|
||||
@BlockEntity(type = BlockEntityType.BED)
|
||||
|
|
|
@ -26,9 +26,9 @@
|
|||
package org.geysermc.geyser.translator.level.block.entity;
|
||||
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import com.nukkitx.nbt.NbtList;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtType;
|
||||
import org.cloudburstmc.nbt.NbtList;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtType;
|
||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@ package org.geysermc.geyser.translator.level.block.entity;
|
|||
import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType;
|
||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.geyser.util.BlockEntityUtils;
|
||||
|
||||
/**
|
||||
|
|
|
@ -29,8 +29,8 @@ import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType;
|
|||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.ListTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.geyser.network.GameProtocol;
|
||||
import org.geysermc.geyser.registry.Registries;
|
||||
import org.geysermc.geyser.registry.type.ItemMapping;
|
||||
|
|
|
@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.level.block.entity;
|
|||
|
||||
import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType;
|
||||
import com.github.steveice10.opennbt.tag.builtin.*;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
||||
import org.geysermc.geyser.translator.text.MessageTranslator;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.level.block.entity;
|
|||
import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType;
|
||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
||||
import org.geysermc.geyser.level.block.DoubleChestValue;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
package org.geysermc.geyser.translator.level.block.entity;
|
||||
|
||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
|
||||
public class EmptyBlockEntityTranslator extends BlockEntityTranslator {
|
||||
@Override
|
||||
|
|
|
@ -30,9 +30,9 @@ import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
|||
import com.github.steveice10.opennbt.tag.builtin.IntTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.LongTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
||||
import com.nukkitx.nbt.NbtList;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import com.nukkitx.nbt.NbtType;
|
||||
import org.cloudburstmc.nbt.NbtList;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtType;
|
||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
|
||||
|
|
|
@ -26,8 +26,10 @@
|
|||
package org.geysermc.geyser.translator.level.block.entity;
|
||||
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.UpdateBlockPacket;
|
||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
|
|
|
@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType;
|
|||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.StringTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
||||
|
||||
@BlockEntity(type = BlockEntityType.JIGSAW)
|
||||
|
|
|
@ -29,8 +29,8 @@ import com.github.steveice10.mc.protocol.data.game.level.block.value.PistonValue
|
|||
import org.cloudburstmc.math.vector.Vector3d;
|
||||
import org.cloudburstmc.math.vector.Vector3f;
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.UpdateBlockPacket;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
package org.geysermc.geyser.translator.level.block.entity;
|
||||
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.level.block.entity;
|
|||
|
||||
import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType;
|
||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
||||
import org.geysermc.geyser.translator.inventory.ShulkerInventoryTranslator;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.level.block.entity;
|
|||
import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType;
|
||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.geyser.translator.text.MessageTranslator;
|
||||
import org.geysermc.geyser.util.SignUtils;
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
|||
import com.github.steveice10.opennbt.tag.builtin.ListTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.StringTag;
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.skin.SkinProvider;
|
||||
|
|
|
@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType;
|
|||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.StringTag;
|
||||
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.registry.Registries;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ package org.geysermc.geyser.translator.protocol.bedrock;
|
|||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetJigsawBlockPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundSignUpdatePacket;
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.BlockEntityDataPacket;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||
|
|
|
@ -47,10 +47,10 @@ import org.cloudburstmc.math.vector.Vector3i;
|
|||
import org.cloudburstmc.protocol.bedrock.data.LevelEvent;
|
||||
import org.cloudburstmc.protocol.bedrock.data.defintions.ItemDefinition;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.InventoryActionData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.InventorySource;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.LegacySetItemSlotData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.transaction.InventoryActionData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.transaction.InventorySource;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.transaction.LegacySetItemSlotData;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.ContainerOpenPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.InventoryTransactionPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.LevelEventPacket;
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
|
||||
package org.geysermc.geyser.translator.protocol.bedrock;
|
||||
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import com.nukkitx.nbt.NbtType;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtType;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.PositionTrackingDBClientRequestPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.PositionTrackingDBServerBroadcastPacket;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
|
|
|
@ -25,9 +25,7 @@
|
|||
|
||||
package org.geysermc.geyser.translator.protocol.java;
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundCustomSoundPacket;
|
||||
import org.cloudburstmc.math.vector.Vector3f;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.PlaySoundPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundDisguisedChatPacket;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||
import org.geysermc.geyser.translator.protocol.Translator;
|
||||
|
|
|
@ -42,8 +42,8 @@ import it.unimi.dsi.fastutil.ints.IntSet;
|
|||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.cloudburstmc.protocol.bedrock.data.defintions.ItemDefinition;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.CraftingData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.crafting.CraftingData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.descriptor.DefaultDescriptor;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.descriptor.ItemDescriptorWithCount;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.CraftingDataPacket;
|
||||
|
|
|
@ -27,7 +27,7 @@ package org.geysermc.geyser.translator.protocol.java.entity.player;
|
|||
|
||||
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundPlayerInfoRemovePacket;
|
||||
import com.nukkitx.protocol.bedrock.packet.PlayerListPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.PlayerListPacket;
|
||||
import org.geysermc.geyser.entity.type.player.PlayerEntity;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||
|
|
|
@ -29,8 +29,8 @@ import com.github.steveice10.mc.auth.data.GameProfile;
|
|||
import com.github.steveice10.mc.protocol.data.game.PlayerListEntry;
|
||||
import com.github.steveice10.mc.protocol.data.game.PlayerListEntryAction;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundPlayerInfoUpdatePacket;
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.protocol.bedrock.packet.PlayerListPacket;
|
||||
import org.cloudburstmc.math.vector.Vector3f;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.PlayerListPacket;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.entity.type.player.PlayerEntity;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
|
|
|
@ -29,8 +29,8 @@ 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.packet.ingame.clientbound.inventory.ClientboundContainerSetSlotPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerId;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.CraftingData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.crafting.CraftingData;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.descriptor.ItemDescriptorWithCount;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.CraftingDataPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket;
|
||||
|
|
|
@ -26,9 +26,9 @@
|
|||
package org.geysermc.geyser.translator.protocol.java.inventory;
|
||||
|
||||
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;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.UpdateEquipPacket;
|
||||
import org.geysermc.geyser.entity.type.Entity;
|
||||
|
|
|
@ -28,9 +28,9 @@ package org.geysermc.geyser.translator.protocol.java.inventory;
|
|||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
|
||||
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;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
|
||||
|
|
|
@ -28,8 +28,8 @@ package org.geysermc.geyser.translator.protocol.java.level;
|
|||
import com.github.steveice10.mc.protocol.data.game.level.block.value.*;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundBlockEventPacket;
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.BlockEntityDataPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.BlockEventPacket;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMaps;
|
||||
|
|
|
@ -28,9 +28,9 @@ package org.geysermc.geyser.translator.protocol.java.level;
|
|||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundExplodePacket;
|
||||
import org.cloudburstmc.math.vector.Vector3f;
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.protocol.bedrock.data.LevelEventType;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.protocol.bedrock.data.LevelEvent;
|
||||
import org.cloudburstmc.protocol.bedrock.data.SoundEvent;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.LevelEventGenericPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.LevelSoundEventPacket;
|
||||
|
@ -47,7 +47,7 @@ public class JavaExplodeTranslator extends PacketTranslator<ClientboundExplodePa
|
|||
@Override
|
||||
public void translate(GeyserSession session, ClientboundExplodePacket packet) {
|
||||
LevelEventGenericPacket levelEventPacket = new LevelEventGenericPacket();
|
||||
levelEventPacket.setEventId(2026/*LevelEvent.PARTICLE_BLOCK_EXPLOSION*/);
|
||||
levelEventPacket.setType(LevelEvent.PARTICLE_BLOCK_EXPLOSION);
|
||||
NbtMapBuilder builder = NbtMap.builder();
|
||||
builder.putFloat("originX", (float) packet.getX());
|
||||
builder.putFloat("originY", (float) packet.getY());
|
||||
|
|
|
@ -36,9 +36,12 @@ import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType;
|
|||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelChunkWithLightPacket;
|
||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import com.nukkitx.nbt.NBTOutputStream;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtUtils;
|
||||
import org.cloudburstmc.nbt.NBTOutputStream;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtUtils;
|
||||
import org.cloudburstmc.nbt.NBTOutputStream;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtUtils;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.LevelChunkPacket;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.ByteBufAllocator;
|
||||
|
|
|
@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.data.game.level.event.*;
|
|||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelEventPacket;
|
||||
import org.cloudburstmc.math.vector.Vector3f;
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.protocol.bedrock.data.LevelEventType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.SoundEvent;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.*;
|
||||
|
@ -263,7 +263,7 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
|
|||
LevelEventGenericPacket levelEventPacket = new LevelEventGenericPacket();
|
||||
// TODO add SCULK_BLOCK_CHARGE sound
|
||||
if (eventData.getCharge() > 0) {
|
||||
levelEventPacket.setEventId(2037/*LevelEvent.SCULK_CHARGE*/);
|
||||
levelEventPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.SCULK_CHARGE);
|
||||
levelEventPacket.setTag(
|
||||
NbtMap.builder()
|
||||
.putInt("x", packet.getPosition().getX())
|
||||
|
@ -274,7 +274,7 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
|
|||
.build()
|
||||
);
|
||||
} else {
|
||||
levelEventPacket.setEventId(2038/*LevelEvent.SCULK_CHARGE_POP*/);
|
||||
levelEventPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.SCULK_CHARGE_POP);
|
||||
levelEventPacket.setTag(
|
||||
NbtMap.builder()
|
||||
.putInt("x", packet.getPosition().getX())
|
||||
|
@ -288,7 +288,7 @@ public class JavaLevelEventTranslator extends PacketTranslator<ClientboundLevelE
|
|||
}
|
||||
case SCULK_SHRIEKER_SHRIEK -> {
|
||||
LevelEventGenericPacket levelEventPacket = new LevelEventGenericPacket();
|
||||
levelEventPacket.setEventId(2035/*LevelEvent.PARTICLE_SCULK_SHRIEK*/);
|
||||
levelEventPacket.setType(org.cloudburstmc.protocol.bedrock.data.LevelEvent.PARTICLE_SCULK_SHRIEK);
|
||||
levelEventPacket.setTag(
|
||||
NbtMap.builder()
|
||||
.putInt("originX", packet.getPosition().getX())
|
||||
|
|
|
@ -35,7 +35,7 @@ import com.github.steveice10.mc.protocol.data.game.level.particle.VibrationParti
|
|||
import com.github.steveice10.mc.protocol.data.game.level.particle.positionsource.BlockPositionSource;
|
||||
import com.github.steveice10.mc.protocol.data.game.level.particle.positionsource.EntityPositionSource;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLevelParticlesPacket;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.math.vector.Vector3f;
|
||||
import org.cloudburstmc.protocol.bedrock.data.LevelEvent;
|
||||
import org.cloudburstmc.protocol.bedrock.data.ParticleType;
|
||||
|
|
|
@ -27,13 +27,13 @@ package org.geysermc.geyser.translator.text;
|
|||
|
||||
import com.github.steveice10.mc.protocol.data.DefaultComponentSerializer;
|
||||
import com.github.steveice10.mc.protocol.data.game.scoreboard.TeamColor;
|
||||
import com.nukkitx.protocol.bedrock.packet.TextPacket;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TranslatableComponent;
|
||||
import net.kyori.adventure.text.renderer.TranslatableComponentRenderer;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.TextPacket;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.text.*;
|
||||
|
|
|
@ -27,7 +27,7 @@ package org.geysermc.geyser.util;
|
|||
|
||||
import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType;
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.BlockEntityDataPacket;
|
||||
import org.geysermc.geyser.registry.Registries;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
|
|
|
@ -27,9 +27,12 @@ package org.geysermc.geyser.util;
|
|||
|
||||
import com.github.steveice10.mc.protocol.data.game.entity.Effect;
|
||||
import org.cloudburstmc.math.vector.Vector3f;
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import org.cloudburstmc.protocol.bedrock.data.PlayerActionType;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.ChangeDimensionPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.ChunkRadiusUpdatedPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.MobEffectPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.PlayerActionPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.StopSoundPacket;
|
||||
import org.geysermc.geyser.entity.type.Entity;
|
||||
import org.geysermc.geyser.level.BedrockDimension;
|
||||
|
|
|
@ -31,14 +31,16 @@ import com.github.steveice10.mc.protocol.data.game.recipe.Ingredient;
|
|||
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.math.vector.Vector3i;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import com.nukkitx.nbt.NbtMapBuilder;
|
||||
import com.nukkitx.nbt.NbtType;
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMapBuilder;
|
||||
import org.cloudburstmc.nbt.NbtType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.defintions.ItemDefinition;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerId;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.InventorySlotPacket;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.PlayerHotbarPacket;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.inventory.Container;
|
||||
import org.geysermc.geyser.inventory.GeyserItemStack;
|
||||
import org.geysermc.geyser.inventory.Inventory;
|
||||
|
@ -201,14 +203,14 @@ public class InventoryUtils {
|
|||
.tag(root.build()).build();
|
||||
}
|
||||
|
||||
private static int getUnusableSpaceBlockID(int protocolVersion) {
|
||||
private static ItemDefinition getUnusableSpaceBlockID(int protocolVersion) {
|
||||
String unusableSpaceBlock = GeyserImpl.getInstance().getConfig().getUnusableSpaceBlock();
|
||||
ItemMapping unusableSpaceBlockID = Registries.ITEMS.forVersion(protocolVersion).getMapping(unusableSpaceBlock);
|
||||
if (unusableSpaceBlockID != null) {
|
||||
return unusableSpaceBlockID.getBedrockId();
|
||||
return unusableSpaceBlockID.getBedrockDefinition();
|
||||
} else {
|
||||
GeyserImpl.getInstance().getLogger().error("Invalid value" + unusableSpaceBlock + ". Resorting to barrier block.");
|
||||
return Registries.ITEMS.forVersion(protocolVersion).getStoredItems().barrier().getBedrockId();
|
||||
return Registries.ITEMS.forVersion(protocolVersion).getStoredItems().barrier().getBedrockDefinition();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
package org.geysermc.geyser.util.collection;
|
||||
|
||||
import org.cloudburstmc.math.vector.Vector3i;
|
||||
import com.nukkitx.nbt.NbtMap;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.geysermc.geyser.level.WorldManager;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.translator.inventory.LecternInventoryTranslator;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit f9d62b3f73db270bd4e0c833b7728b30d29e1369
|
||||
Subproject commit 1446e0b3fc9d702c1b07f194167b599475247fdf
|
Loading…
Reference in a new issue