Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-20 06:50:08 +01:00
Merge remote-tracking branch 'Myles/master' into abstraction_1.14.1
Dieser Commit ist enthalten in:
Commit
f25442337d
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>2.0.2-SNAPSHOT</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -30,6 +30,7 @@ import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.HandItemProvider
|
||||
import us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.MovementTransmitterProvider;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Callable;
|
||||
@ -85,9 +86,9 @@ public class BukkitViaLoader implements ViaPlatformLoader {
|
||||
}
|
||||
}
|
||||
|
||||
if ((Bukkit.getVersion().toLowerCase().contains("paper")
|
||||
|| Bukkit.getVersion().toLowerCase().contains("taco")
|
||||
|| Bukkit.getVersion().toLowerCase().contains("torch"))
|
||||
if ((Bukkit.getVersion().toLowerCase(Locale.ROOT).contains("paper")
|
||||
|| Bukkit.getVersion().toLowerCase(Locale.ROOT).contains("taco")
|
||||
|| Bukkit.getVersion().toLowerCase(Locale.ROOT).contains("torch"))
|
||||
&& ProtocolRegistry.SERVER_PROTOCOL < ProtocolVersion.v1_12.getId()) {
|
||||
plugin.getLogger().info("Enabling Paper/TacoSpigot/Torch patch: Fixes block placement.");
|
||||
storeListener(new PaperPatch(plugin)).register();
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>2.0.2-SNAPSHOT</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>2.0.2-SNAPSHOT</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -15,6 +15,7 @@ import us.myles.ViaVersion.protocols.protocol1_12_2to1_12_1.Protocol1_12_2To1_12
|
||||
import us.myles.ViaVersion.protocols.protocol1_12to1_11_1.Protocol1_12To1_11_1;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13_2to1_13_1.Protocol1_13_2To1_13_1;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14_1to1_14.Protocol1_14_1To1_14;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.Protocol1_14To1_13_2;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4.Protocol1_9_1_2To1_9_3_4;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_1to1_9.Protocol1_9_1To1_9;
|
||||
@ -62,6 +63,7 @@ public class ProtocolRegistry {
|
||||
registerProtocol(new Protocol1_13_2To1_13_1(), Arrays.asList(ProtocolVersion.v1_13_2.getId()), ProtocolVersion.v1_13_1.getId());
|
||||
|
||||
registerProtocol(new Protocol1_14To1_13_2(), Arrays.asList(ProtocolVersion.v1_14.getId()), ProtocolVersion.v1_13_2.getId());
|
||||
registerProtocol(new Protocol1_14_1To1_14(), Arrays.asList(ProtocolVersion.v1_14_1.getId()), ProtocolVersion.v1_14.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,6 +36,7 @@ public class ProtocolVersion {
|
||||
public static final ProtocolVersion v1_13_1;
|
||||
public static final ProtocolVersion v1_13_2;
|
||||
public static final ProtocolVersion v1_14;
|
||||
public static final ProtocolVersion v1_14_1;
|
||||
public static final ProtocolVersion unknown;
|
||||
|
||||
private final int id;
|
||||
@ -68,6 +69,7 @@ public class ProtocolVersion {
|
||||
register(v1_13_1 = new ProtocolVersion(401, "1.13.1"));
|
||||
register(v1_13_2 = new ProtocolVersion(404, "1.13.2"));
|
||||
register(v1_14 = new ProtocolVersion(477, "1.14"));
|
||||
register(v1_14_1 = new ProtocolVersion(480, "1.14.1"));
|
||||
register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
|
||||
}
|
||||
|
||||
|
@ -28,17 +28,17 @@ public abstract class ViaCommandHandler implements ViaVersionCommand {
|
||||
Preconditions.checkArgument(command.name().matches("^[a-z0-9_-]{3,15}$"), command.name() + " is not a valid sub-command name.");
|
||||
if (hasSubCommand(command.name()))
|
||||
throw new Exception("ViaSubCommand " + command.name() + " does already exists!"); //Maybe another exception later.
|
||||
commandMap.put(command.name().toLowerCase(), command);
|
||||
commandMap.put(command.name().toLowerCase(Locale.ROOT), command);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSubCommand(String name) {
|
||||
return commandMap.containsKey(name.toLowerCase());
|
||||
return commandMap.containsKey(name.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViaSubCommand getSubCommand(String name) {
|
||||
return commandMap.get(name.toLowerCase());
|
||||
return commandMap.get(name.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -76,7 +76,7 @@ public abstract class ViaCommandHandler implements ViaVersionCommand {
|
||||
if (args.length == 1) {
|
||||
if (!args[0].isEmpty()) {
|
||||
for (ViaSubCommand sub : allowed)
|
||||
if (sub.name().toLowerCase().startsWith(args[0].toLowerCase()))
|
||||
if (sub.name().toLowerCase().startsWith(args[0].toLowerCase(Locale.ROOT)))
|
||||
output.add(sub.name());
|
||||
} else {
|
||||
for (ViaSubCommand sub : allowed)
|
||||
|
@ -6,6 +6,7 @@ import us.myles.ViaVersion.api.minecraft.Position;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@ -33,7 +34,7 @@ public class AbstractStempConnectionHandler extends ConnectionHandler {
|
||||
ConnectionData.connectionHandlerMap.put(blockData.getSavedBlockStateId(), handler);
|
||||
}
|
||||
if (blockData.getMinecraftKey().equals(toKey)) {
|
||||
String facing = blockData.getValue("facing").toUpperCase();
|
||||
String facing = blockData.getValue("facing").toUpperCase(Locale.ROOT);
|
||||
stemps.put(BlockFace.valueOf(facing), blockData.getSavedBlockStateId());
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import us.myles.ViaVersion.api.minecraft.Position;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@ -19,10 +20,12 @@ class ChestConnectionHandler extends ConnectionHandler {
|
||||
return new ConnectionData.ConnectorInitAction() {
|
||||
@Override
|
||||
public void check(WrappedBlockData blockData) {
|
||||
if (!blockData.getMinecraftKey().equals("minecraft:chest") && !blockData.getMinecraftKey().equals("minecraft:trapped_chest")) return;
|
||||
if (!blockData.getMinecraftKey().equals("minecraft:chest") && !blockData.getMinecraftKey().equals("minecraft:trapped_chest"))
|
||||
return;
|
||||
if (blockData.getValue("waterlogged").equals("true")) return;
|
||||
chestFacings.put(blockData.getSavedBlockStateId(), BlockFace.valueOf(blockData.getValue("facing").toUpperCase()));
|
||||
if (blockData.getMinecraftKey().equalsIgnoreCase("minecraft:trapped_chest")) trappedChests.add(blockData.getSavedBlockStateId());
|
||||
chestFacings.put(blockData.getSavedBlockStateId(), BlockFace.valueOf(blockData.getValue("facing").toUpperCase(Locale.ROOT)));
|
||||
if (blockData.getMinecraftKey().equalsIgnoreCase("minecraft:trapped_chest"))
|
||||
trappedChests.add(blockData.getSavedBlockStateId());
|
||||
connectedStates.put(getStates(blockData), blockData.getSavedBlockStateId());
|
||||
ConnectionData.connectionHandlerMap.put(blockData.getSavedBlockStateId(), connectionHandler);
|
||||
}
|
||||
@ -34,7 +37,7 @@ class ChestConnectionHandler extends ConnectionHandler {
|
||||
String type = blockData.getValue("type");
|
||||
if (type.equals("left")) states |= 1;
|
||||
if (type.equals("right")) states |= 2;
|
||||
states |= (BlockFace.valueOf(blockData.getValue("facing").toUpperCase()).ordinal() << 2);
|
||||
states |= (BlockFace.valueOf(blockData.getValue("facing").toUpperCase(Locale.ROOT)).ordinal() << 2);
|
||||
if (blockData.getMinecraftKey().equals("minecraft:trapped_chest")) states |= 16;
|
||||
return states;
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ public class ConnectionData {
|
||||
JsonObject object = type.getValue().getAsJsonObject();
|
||||
boolean[] data = new boolean[6];
|
||||
for (BlockFace value : BlockFace.values()) {
|
||||
String face = value.toString().toLowerCase();
|
||||
String face = value.toString().toLowerCase(Locale.ROOT);
|
||||
if (object.has(face)) {
|
||||
data[value.ordinal()] = object.getAsJsonPrimitive(face).getAsBoolean();
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import us.myles.ViaVersion.api.minecraft.Position;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
public class DoorConnectionHandler extends ConnectionHandler {
|
||||
@ -40,7 +41,7 @@ public class DoorConnectionHandler extends ConnectionHandler {
|
||||
blockData.getValue("hinge").equals("right"),
|
||||
blockData.getValue("powered").equals("true"),
|
||||
blockData.getValue("open").equals("true"),
|
||||
BlockFace.valueOf(blockData.getValue("facing").toUpperCase()),
|
||||
BlockFace.valueOf(blockData.getValue("facing").toUpperCase(Locale.ROOT)),
|
||||
type
|
||||
);
|
||||
|
||||
|
@ -10,6 +10,7 @@ import us.myles.ViaVersion.api.minecraft.Position;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
public class StairConnectionHandler extends ConnectionHandler {
|
||||
@ -58,7 +59,7 @@ public class StairConnectionHandler extends ConnectionHandler {
|
||||
StairData stairData = new StairData(
|
||||
blockData.getValue("half").equals("bottom"),
|
||||
shape, (byte) type,
|
||||
BlockFace.valueOf(blockData.getValue("facing").toUpperCase())
|
||||
BlockFace.valueOf(blockData.getValue("facing").toUpperCase(Locale.ROOT))
|
||||
);
|
||||
|
||||
stairDataMap.put(blockData.getSavedBlockStateId(), stairData);
|
||||
|
@ -8,6 +8,7 @@ import us.myles.ViaVersion.api.minecraft.BlockFace;
|
||||
import us.myles.ViaVersion.api.minecraft.Position;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
public class TripwireConnectionHandler extends ConnectionHandler {
|
||||
@ -21,7 +22,7 @@ public class TripwireConnectionHandler extends ConnectionHandler {
|
||||
@Override
|
||||
public void check(WrappedBlockData blockData) {
|
||||
if (blockData.getMinecraftKey().equals("minecraft:tripwire_hook")) {
|
||||
tripwireHooks.put(blockData.getSavedBlockStateId(), BlockFace.valueOf(blockData.getValue("facing").toUpperCase()));
|
||||
tripwireHooks.put(blockData.getSavedBlockStateId(), BlockFace.valueOf(blockData.getValue("facing").toUpperCase(Locale.ROOT)));
|
||||
} else if (blockData.getMinecraftKey().equals("minecraft:tripwire")) {
|
||||
TripwireData tripwireData = new TripwireData(
|
||||
blockData.getValue("attached").equals("true"),
|
||||
|
@ -1,6 +1,7 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
public class NamedSoundRewriter {
|
||||
@ -148,6 +149,6 @@ public class NamedSoundRewriter {
|
||||
|
||||
public static String getNewId(String old) {
|
||||
String newId = oldToNew.get(old);
|
||||
return newId != null ? newId : old.toLowerCase();
|
||||
return newId != null ? newId : old.toLowerCase(Locale.ROOT);
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.providers;
|
||||
import com.google.common.base.Optional;
|
||||
import us.myles.ViaVersion.api.platform.providers.Provider;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@ -45,7 +46,7 @@ public class PaintingProvider implements Provider {
|
||||
public Optional<Integer> getIntByIdentifier(String motive) {
|
||||
// Handle older versions
|
||||
if (!motive.startsWith("minecraft:"))
|
||||
motive = "minecraft:" + motive.toLowerCase();
|
||||
motive = "minecraft:" + motive.toLowerCase(Locale.ROOT);
|
||||
return Optional.fromNullable(paintings.get(motive));
|
||||
}
|
||||
}
|
@ -17,6 +17,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.BitSet;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class Chunk1_13Type extends PartialType<Chunk, ClientWorld> {
|
||||
public Chunk1_13Type(ClientWorld param) {
|
||||
@ -30,7 +31,7 @@ public class Chunk1_13Type extends PartialType<Chunk, ClientWorld> {
|
||||
|
||||
boolean groundUp = input.readBoolean();
|
||||
int primaryBitmask = Type.VAR_INT.read(input);
|
||||
Type.VAR_INT.read(input);
|
||||
ByteBuf data = input.readSlice(Type.VAR_INT.read(input));
|
||||
|
||||
BitSet usedSections = new BitSet(16);
|
||||
ChunkSection[] sections = new ChunkSection[16];
|
||||
@ -44,18 +45,22 @@ public class Chunk1_13Type extends PartialType<Chunk, ClientWorld> {
|
||||
// Read sections
|
||||
for (int i = 0; i < 16; i++) {
|
||||
if (!usedSections.get(i)) continue; // Section not set
|
||||
ChunkSection section = Types1_13.CHUNK_SECTION.read(input);
|
||||
ChunkSection section = Types1_13.CHUNK_SECTION.read(data);
|
||||
sections[i] = section;
|
||||
section.readBlockLight(input);
|
||||
section.readBlockLight(data);
|
||||
if (world.getEnvironment() == Environment.NORMAL) {
|
||||
section.readSkyLight(input);
|
||||
section.readSkyLight(data);
|
||||
}
|
||||
}
|
||||
|
||||
int[] biomeData = groundUp ? new int[256] : null;
|
||||
if (groundUp) {
|
||||
for (int i = 0; i < 256; i++) {
|
||||
biomeData[i] = input.readInt();
|
||||
if (data.readableBytes() >= 256 * 4) {
|
||||
for (int i = 0; i < 256; i++) {
|
||||
biomeData[i] = data.readInt();
|
||||
}
|
||||
} else {
|
||||
Via.getPlatform().getLogger().log(Level.WARNING, "Chunk x="+ chunkX + " z=" + chunkZ + " doesn't have biome data!");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,33 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_14_1to1_14;
|
||||
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.api.entities.Entity1_14Types;
|
||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MetadataRewriter {
|
||||
|
||||
public static void handleMetadata(int entityId, Entity1_14Types.EntityType type, List<Metadata> metadatas, UserConnection connection) {
|
||||
if (type == null) return;
|
||||
|
||||
for (Metadata metadata : new ArrayList<>(metadatas)) {
|
||||
try {
|
||||
if (type.is(Entity1_14Types.EntityType.VILLAGER) || type.is(Entity1_14Types.EntityType.WANDERING_TRADER)) {
|
||||
if (metadata.getId() >= 15) {
|
||||
metadata.setId(metadata.getId() + 1);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
metadatas.remove(metadata);
|
||||
if (!Via.getConfig().isSuppressMetadataErrors() || Via.getManager().isDebug()) {
|
||||
Via.getPlatform().getLogger().warning("An error occurred with entity metadata handler");
|
||||
Via.getPlatform().getLogger().warning("Metadata: " + metadata);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_14_1to1_14;
|
||||
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14_1to1_14.packets.EntityPackets;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14_1to1_14.storage.EntityTracker;
|
||||
|
||||
public class Protocol1_14_1To1_14 extends Protocol {
|
||||
|
||||
@Override
|
||||
protected void registerPackets() {
|
||||
EntityPackets.register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(UserConnection userConnection) {
|
||||
userConnection.put(new EntityTracker(userConnection));
|
||||
}
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_14_1to1_14.packets;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
import us.myles.ViaVersion.api.entities.Entity1_14Types;
|
||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
import us.myles.ViaVersion.api.type.types.version.Types1_14;
|
||||
import us.myles.ViaVersion.packets.State;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14_1to1_14.MetadataRewriter;
|
||||
import us.myles.ViaVersion.protocols.protocol1_14_1to1_14.storage.EntityTracker;
|
||||
|
||||
public class EntityPackets {
|
||||
|
||||
public static void register(Protocol protocol) {
|
||||
|
||||
// Spawn Mob
|
||||
protocol.registerOutgoing(State.PLAY, 0x03, 0x03, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.VAR_INT); // 0 - Entity ID
|
||||
map(Type.UUID); // 1 - Entity UUID
|
||||
map(Type.VAR_INT); // 2 - Entity Type
|
||||
map(Type.DOUBLE); // 3 - X
|
||||
map(Type.DOUBLE); // 4 - Y
|
||||
map(Type.DOUBLE); // 5 - Z
|
||||
map(Type.BYTE); // 6 - Yaw
|
||||
map(Type.BYTE); // 7 - Pitch
|
||||
map(Type.BYTE); // 8 - Head Pitch
|
||||
map(Type.SHORT); // 9 - Velocity X
|
||||
map(Type.SHORT); // 10 - Velocity Y
|
||||
map(Type.SHORT); // 11 - Velocity Z
|
||||
map(Types1_14.METADATA_LIST); // 12 - Metadata
|
||||
|
||||
handler(new PacketHandler() {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
int entityId = wrapper.get(Type.VAR_INT, 0);
|
||||
int type = wrapper.get(Type.VAR_INT, 1);
|
||||
|
||||
Entity1_14Types.EntityType entType = Entity1_14Types.getTypeFromId(type);
|
||||
|
||||
// Register Type ID
|
||||
wrapper.user().get(EntityTracker.class).addEntity(entityId, entType);
|
||||
|
||||
MetadataRewriter.handleMetadata(entityId, entType, wrapper.get(Types1_14.METADATA_LIST, 0), wrapper.user());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Spawn Player
|
||||
protocol.registerOutgoing(State.PLAY, 0x05, 0x05, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.VAR_INT); // 0 - Entity ID
|
||||
map(Type.UUID); // 1 - Player UUID
|
||||
map(Type.DOUBLE); // 2 - X
|
||||
map(Type.DOUBLE); // 3 - Y
|
||||
map(Type.DOUBLE); // 4 - Z
|
||||
map(Type.BYTE); // 5 - Yaw
|
||||
map(Type.BYTE); // 6 - Pitch
|
||||
map(Types1_14.METADATA_LIST); // 7 - Metadata
|
||||
|
||||
handler(new PacketHandler() {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
int entityId = wrapper.get(Type.VAR_INT, 0);
|
||||
|
||||
Entity1_14Types.EntityType entType = Entity1_14Types.EntityType.PLAYER;
|
||||
|
||||
// Register Type ID
|
||||
wrapper.user().get(EntityTracker.class).addEntity(entityId, entType);
|
||||
MetadataRewriter.handleMetadata(entityId, entType, wrapper.get(Types1_14.METADATA_LIST, 0), wrapper.user());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Entity Metadata
|
||||
protocol.registerOutgoing(State.PLAY, 0x43, 0x43, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.VAR_INT); // 0 - Entity ID
|
||||
map(Types1_14.METADATA_LIST); // 1 - Metadata list
|
||||
|
||||
handler(new PacketHandler() {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
int entityId = wrapper.get(Type.VAR_INT, 0);
|
||||
|
||||
Optional<Entity1_14Types.EntityType> type = wrapper.user().get(EntityTracker.class).get(entityId);
|
||||
MetadataRewriter.handleMetadata(entityId, type.orNull(), wrapper.get(Types1_14.METADATA_LIST, 0), wrapper.user());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_14_1to1_14.storage;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import us.myles.ViaVersion.api.data.ExternalJoinGameListener;
|
||||
import us.myles.ViaVersion.api.data.StoredObject;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.api.entities.Entity1_14Types;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class EntityTracker extends StoredObject implements ExternalJoinGameListener {
|
||||
private final Map<Integer, Entity1_14Types.EntityType> clientEntityTypes = new ConcurrentHashMap<>();
|
||||
@Getter
|
||||
@Setter
|
||||
private int clientEntityId;
|
||||
|
||||
public EntityTracker(UserConnection user) {
|
||||
super(user);
|
||||
}
|
||||
|
||||
public void removeEntity(int entityId) {
|
||||
clientEntityTypes.remove(entityId);
|
||||
}
|
||||
|
||||
public void addEntity(int entityId, Entity1_14Types.EntityType type) {
|
||||
clientEntityTypes.put(entityId, type);
|
||||
}
|
||||
|
||||
public boolean has(int entityId) {
|
||||
return clientEntityTypes.containsKey(entityId);
|
||||
}
|
||||
|
||||
public Optional<Entity1_14Types.EntityType> get(int id) {
|
||||
return Optional.fromNullable(clientEntityTypes.get(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExternalJoinGame(int playerEntityId) {
|
||||
clientEntityId = playerEntityId;
|
||||
clientEntityTypes.put(playerEntityId, Entity1_14Types.EntityType.PLAYER);
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ package us.myles.ViaVersion.protocols.protocol1_9to1_8.sounds;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
@Getter
|
||||
@ -284,7 +285,7 @@ public enum SoundEffect {
|
||||
}
|
||||
|
||||
public static SoundEffect getByName(String name) {
|
||||
name = name.toLowerCase();
|
||||
name = name.toLowerCase(Locale.ROOT);
|
||||
return effects.get(name);
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@ import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
|
||||
public class UpdateUtil {
|
||||
@ -81,7 +82,7 @@ public class UpdateUtil {
|
||||
if (current.compareTo(newest) < 0)
|
||||
return "There is a newer version available: " + newest.toString() + ", you're on: " + current.toString();
|
||||
else if (console && current.compareTo(newest) != 0) {
|
||||
if (current.getTag().toLowerCase().startsWith("dev") || current.getTag().toLowerCase().startsWith("snapshot")) {
|
||||
if (current.getTag().toLowerCase(Locale.ROOT).startsWith("dev") || current.getTag().toLowerCase(Locale.ROOT).startsWith("snapshot")) {
|
||||
return "You are running a development version, please report any bugs to GitHub.";
|
||||
} else {
|
||||
return "You are running a newer version than is released!";
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>2.0.2-SNAPSHOT</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<name>viaversion-jar</name>
|
||||
|
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>us.myles</groupId>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<version>2.0.2-SNAPSHOT</version>
|
||||
<version>2.1.0</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>viaversion-parent</name>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>2.0.2-SNAPSHOT</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>2.0.2-SNAPSHOT</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>2.0.2-SNAPSHOT</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren