Merge pull request #1336 from Gerrygames/abstraction_1.14.1

Abstraction 1.14.1
This commit is contained in:
Myles 2019-05-14 09:26:20 +01:00 committed by GitHub
commit 08383c9141
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 213 additions and 34 deletions

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>2.0.2-SNAPSHOT</version> <version>2.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -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 us.myles.ViaVersion.protocols.protocol1_9to1_8.providers.MovementTransmitterProvider;
import java.util.HashSet; import java.util.HashSet;
import java.util.Locale;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
@ -85,9 +86,9 @@ public class BukkitViaLoader implements ViaPlatformLoader {
} }
} }
if ((Bukkit.getVersion().toLowerCase().contains("paper") if ((Bukkit.getVersion().toLowerCase(Locale.ROOT).contains("paper")
|| Bukkit.getVersion().toLowerCase().contains("taco") || Bukkit.getVersion().toLowerCase(Locale.ROOT).contains("taco")
|| Bukkit.getVersion().toLowerCase().contains("torch")) || Bukkit.getVersion().toLowerCase(Locale.ROOT).contains("torch"))
&& ProtocolRegistry.SERVER_PROTOCOL < ProtocolVersion.v1_12.getId()) { && ProtocolRegistry.SERVER_PROTOCOL < ProtocolVersion.v1_12.getId()) {
plugin.getLogger().info("Enabling Paper/TacoSpigot/Torch patch: Fixes block placement."); plugin.getLogger().info("Enabling Paper/TacoSpigot/Torch patch: Fixes block placement.");
storeListener(new PaperPatch(plugin)).register(); storeListener(new PaperPatch(plugin)).register();

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>2.0.2-SNAPSHOT</version> <version>2.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>2.0.2-SNAPSHOT</version> <version>2.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -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_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_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_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_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_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; 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_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_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());
} }
/** /**

View File

@ -36,6 +36,7 @@ public class ProtocolVersion {
public static final ProtocolVersion v1_13_1; public static final ProtocolVersion v1_13_1;
public static final ProtocolVersion v1_13_2; public static final ProtocolVersion v1_13_2;
public static final ProtocolVersion v1_14; public static final ProtocolVersion v1_14;
public static final ProtocolVersion v1_14_1;
public static final ProtocolVersion unknown; public static final ProtocolVersion unknown;
private final int id; private final int id;
@ -68,6 +69,7 @@ public class ProtocolVersion {
register(v1_13_1 = new ProtocolVersion(401, "1.13.1")); register(v1_13_1 = new ProtocolVersion(401, "1.13.1"));
register(v1_13_2 = new ProtocolVersion(404, "1.13.2")); register(v1_13_2 = new ProtocolVersion(404, "1.13.2"));
register(v1_14 = new ProtocolVersion(477, "1.14")); register(v1_14 = new ProtocolVersion(477, "1.14"));
register(v1_14_1 = new ProtocolVersion(480, "1.14.1"));
register(unknown = new ProtocolVersion(-1, "UNKNOWN")); register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
} }

View File

@ -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."); Preconditions.checkArgument(command.name().matches("^[a-z0-9_-]{3,15}$"), command.name() + " is not a valid sub-command name.");
if (hasSubCommand(command.name())) if (hasSubCommand(command.name()))
throw new Exception("ViaSubCommand " + command.name() + " does already exists!"); //Maybe another exception later. 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 @Override
public boolean hasSubCommand(String name) { public boolean hasSubCommand(String name) {
return commandMap.containsKey(name.toLowerCase()); return commandMap.containsKey(name.toLowerCase(Locale.ROOT));
} }
@Override @Override
public ViaSubCommand getSubCommand(String name) { public ViaSubCommand getSubCommand(String name) {
return commandMap.get(name.toLowerCase()); return commandMap.get(name.toLowerCase(Locale.ROOT));
} }
@Override @Override
@ -76,7 +76,7 @@ public abstract class ViaCommandHandler implements ViaVersionCommand {
if (args.length == 1) { if (args.length == 1) {
if (!args[0].isEmpty()) { if (!args[0].isEmpty()) {
for (ViaSubCommand sub : allowed) 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()); output.add(sub.name());
} else { } else {
for (ViaSubCommand sub : allowed) for (ViaSubCommand sub : allowed)

View File

@ -6,6 +6,7 @@ import us.myles.ViaVersion.api.minecraft.Position;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -33,7 +34,7 @@ public class AbstractStempConnectionHandler extends ConnectionHandler {
ConnectionData.connectionHandlerMap.put(blockData.getSavedBlockStateId(), handler); ConnectionData.connectionHandlerMap.put(blockData.getSavedBlockStateId(), handler);
} }
if (blockData.getMinecraftKey().equals(toKey)) { 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()); stemps.put(BlockFace.valueOf(facing), blockData.getSavedBlockStateId());
} }
} }

View File

@ -6,6 +6,7 @@ import us.myles.ViaVersion.api.minecraft.Position;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -19,10 +20,12 @@ class ChestConnectionHandler extends ConnectionHandler {
return new ConnectionData.ConnectorInitAction() { return new ConnectionData.ConnectorInitAction() {
@Override @Override
public void check(WrappedBlockData blockData) { 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; if (blockData.getValue("waterlogged").equals("true")) return;
chestFacings.put(blockData.getSavedBlockStateId(), BlockFace.valueOf(blockData.getValue("facing").toUpperCase())); chestFacings.put(blockData.getSavedBlockStateId(), BlockFace.valueOf(blockData.getValue("facing").toUpperCase(Locale.ROOT)));
if (blockData.getMinecraftKey().equalsIgnoreCase("minecraft:trapped_chest")) trappedChests.add(blockData.getSavedBlockStateId()); if (blockData.getMinecraftKey().equalsIgnoreCase("minecraft:trapped_chest"))
trappedChests.add(blockData.getSavedBlockStateId());
connectedStates.put(getStates(blockData), blockData.getSavedBlockStateId()); connectedStates.put(getStates(blockData), blockData.getSavedBlockStateId());
ConnectionData.connectionHandlerMap.put(blockData.getSavedBlockStateId(), connectionHandler); ConnectionData.connectionHandlerMap.put(blockData.getSavedBlockStateId(), connectionHandler);
} }
@ -34,7 +37,7 @@ class ChestConnectionHandler extends ConnectionHandler {
String type = blockData.getValue("type"); String type = blockData.getValue("type");
if (type.equals("left")) states |= 1; if (type.equals("left")) states |= 1;
if (type.equals("right")) states |= 2; 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; if (blockData.getMinecraftKey().equals("minecraft:trapped_chest")) states |= 16;
return states; return states;
} }

View File

@ -217,7 +217,7 @@ public class ConnectionData {
JsonObject object = type.getValue().getAsJsonObject(); JsonObject object = type.getValue().getAsJsonObject();
boolean[] data = new boolean[6]; boolean[] data = new boolean[6];
for (BlockFace value : BlockFace.values()) { for (BlockFace value : BlockFace.values()) {
String face = value.toString().toLowerCase(); String face = value.toString().toLowerCase(Locale.ROOT);
if (object.has(face)) { if (object.has(face)) {
data[value.ordinal()] = object.getAsJsonPrimitive(face).getAsBoolean(); data[value.ordinal()] = object.getAsJsonPrimitive(face).getAsBoolean();
} }

View File

@ -10,6 +10,7 @@ import us.myles.ViaVersion.api.minecraft.Position;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Map; import java.util.Map;
public class DoorConnectionHandler extends ConnectionHandler { public class DoorConnectionHandler extends ConnectionHandler {
@ -40,7 +41,7 @@ public class DoorConnectionHandler extends ConnectionHandler {
blockData.getValue("hinge").equals("right"), blockData.getValue("hinge").equals("right"),
blockData.getValue("powered").equals("true"), blockData.getValue("powered").equals("true"),
blockData.getValue("open").equals("true"), blockData.getValue("open").equals("true"),
BlockFace.valueOf(blockData.getValue("facing").toUpperCase()), BlockFace.valueOf(blockData.getValue("facing").toUpperCase(Locale.ROOT)),
type type
); );

View File

@ -10,6 +10,7 @@ import us.myles.ViaVersion.api.minecraft.Position;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Map; import java.util.Map;
public class StairConnectionHandler extends ConnectionHandler { public class StairConnectionHandler extends ConnectionHandler {
@ -58,7 +59,7 @@ public class StairConnectionHandler extends ConnectionHandler {
StairData stairData = new StairData( StairData stairData = new StairData(
blockData.getValue("half").equals("bottom"), blockData.getValue("half").equals("bottom"),
shape, (byte) type, shape, (byte) type,
BlockFace.valueOf(blockData.getValue("facing").toUpperCase()) BlockFace.valueOf(blockData.getValue("facing").toUpperCase(Locale.ROOT))
); );
stairDataMap.put(blockData.getSavedBlockStateId(), stairData); stairDataMap.put(blockData.getSavedBlockStateId(), stairData);

View File

@ -8,6 +8,7 @@ import us.myles.ViaVersion.api.minecraft.BlockFace;
import us.myles.ViaVersion.api.minecraft.Position; import us.myles.ViaVersion.api.minecraft.Position;
import java.util.HashMap; import java.util.HashMap;
import java.util.Locale;
import java.util.Map; import java.util.Map;
public class TripwireConnectionHandler extends ConnectionHandler { public class TripwireConnectionHandler extends ConnectionHandler {
@ -21,7 +22,7 @@ public class TripwireConnectionHandler extends ConnectionHandler {
@Override @Override
public void check(WrappedBlockData blockData) { public void check(WrappedBlockData blockData) {
if (blockData.getMinecraftKey().equals("minecraft:tripwire_hook")) { 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")) { } else if (blockData.getMinecraftKey().equals("minecraft:tripwire")) {
TripwireData tripwireData = new TripwireData( TripwireData tripwireData = new TripwireData(
blockData.getValue("attached").equals("true"), blockData.getValue("attached").equals("true"),

View File

@ -1,6 +1,7 @@
package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data; package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data;
import java.util.HashMap; import java.util.HashMap;
import java.util.Locale;
import java.util.Map; import java.util.Map;
public class NamedSoundRewriter { public class NamedSoundRewriter {
@ -148,6 +149,6 @@ public class NamedSoundRewriter {
public static String getNewId(String old) { public static String getNewId(String old) {
String newId = oldToNew.get(old); String newId = oldToNew.get(old);
return newId != null ? newId : old.toLowerCase(); return newId != null ? newId : old.toLowerCase(Locale.ROOT);
} }
} }

View File

@ -3,6 +3,7 @@ package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.providers;
import com.google.common.base.Optional; import com.google.common.base.Optional;
import us.myles.ViaVersion.api.platform.providers.Provider; import us.myles.ViaVersion.api.platform.providers.Provider;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
@ -45,7 +46,7 @@ public class PaintingProvider implements Provider {
public Optional<Integer> getIntByIdentifier(String motive) { public Optional<Integer> getIntByIdentifier(String motive) {
// Handle older versions // Handle older versions
if (!motive.startsWith("minecraft:")) if (!motive.startsWith("minecraft:"))
motive = "minecraft:" + motive.toLowerCase(); motive = "minecraft:" + motive.toLowerCase(Locale.ROOT);
return Optional.fromNullable(paintings.get(motive)); return Optional.fromNullable(paintings.get(motive));
} }
} }

View File

@ -17,6 +17,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.BitSet; import java.util.BitSet;
import java.util.List; import java.util.List;
import java.util.logging.Level;
public class Chunk1_13Type extends PartialType<Chunk, ClientWorld> { public class Chunk1_13Type extends PartialType<Chunk, ClientWorld> {
public Chunk1_13Type(ClientWorld param) { public Chunk1_13Type(ClientWorld param) {
@ -30,7 +31,7 @@ public class Chunk1_13Type extends PartialType<Chunk, ClientWorld> {
boolean groundUp = input.readBoolean(); boolean groundUp = input.readBoolean();
int primaryBitmask = Type.VAR_INT.read(input); 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); BitSet usedSections = new BitSet(16);
ChunkSection[] sections = new ChunkSection[16]; ChunkSection[] sections = new ChunkSection[16];
@ -44,18 +45,22 @@ public class Chunk1_13Type extends PartialType<Chunk, ClientWorld> {
// Read sections // Read sections
for (int i = 0; i < 16; i++) { for (int i = 0; i < 16; i++) {
if (!usedSections.get(i)) continue; // Section not set 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; sections[i] = section;
section.readBlockLight(input); section.readBlockLight(data);
if (world.getEnvironment() == Environment.NORMAL) { if (world.getEnvironment() == Environment.NORMAL) {
section.readSkyLight(input); section.readSkyLight(data);
} }
} }
int[] biomeData = groundUp ? new int[256] : null; int[] biomeData = groundUp ? new int[256] : null;
if (groundUp) { if (groundUp) {
for (int i = 0; i < 256; i++) { if (data.readableBytes() >= 256 * 4) {
biomeData[i] = input.readInt(); 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!");
} }
} }

View File

@ -0,0 +1,22 @@
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.metadata.MetadataRewriter1_14_1To1_14;
import us.myles.ViaVersion.protocols.protocol1_14_1to1_14.packets.EntityPackets;
import us.myles.ViaVersion.protocols.protocol1_14_1to1_14.storage.EntityTracker1_14_1;
public class Protocol1_14_1To1_14 extends Protocol {
@Override
protected void registerPackets() {
put(new MetadataRewriter1_14_1To1_14());
EntityPackets.register(this);
}
@Override
public void init(UserConnection userConnection) {
userConnection.put(new EntityTracker1_14_1(userConnection));
}
}

View File

@ -0,0 +1,22 @@
package us.myles.ViaVersion.protocols.protocol1_14_1to1_14.metadata;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.entities.Entity1_14Types;
import us.myles.ViaVersion.api.entities.Entity1_14Types.EntityType;
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
import us.myles.ViaVersion.api.rewriters.MetadataRewriter;
import java.util.List;
public class MetadataRewriter1_14_1To1_14 extends MetadataRewriter<Entity1_14Types.EntityType> {
public void handleMetadata(int entityId, EntityType type, Metadata metadata, List<Metadata> metadatas, UserConnection connection) {
if (type == null) return;
if (type.is(EntityType.VILLAGER) || type.is(EntityType.WANDERING_TRADER)) {
if (metadata.getId() >= 15) {
metadata.setId(metadata.getId() + 1);
}
}
}
}

View File

@ -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.metadata.MetadataRewriter1_14_1To1_14;
import us.myles.ViaVersion.protocols.protocol1_14_1to1_14.storage.EntityTracker1_14_1;
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(EntityTracker1_14_1.class).addEntity(entityId, entType);
protocol.get(MetadataRewriter1_14_1To1_14.class).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(EntityTracker1_14_1.class).addEntity(entityId, entType);
protocol.get(MetadataRewriter1_14_1To1_14.class).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(EntityTracker1_14_1.class).getEntity(entityId);
protocol.get(MetadataRewriter1_14_1To1_14.class).handleMetadata(entityId, type.orNull(), wrapper.get(Types1_14.METADATA_LIST, 0), wrapper.user());
}
});
}
});
}
}

View File

@ -0,0 +1,13 @@
package us.myles.ViaVersion.protocols.protocol1_14_1to1_14.storage;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.entities.Entity1_14Types;
import us.myles.ViaVersion.api.entities.Entity1_14Types.EntityType;
import us.myles.ViaVersion.api.storage.EntityTracker;
public class EntityTracker1_14_1 extends EntityTracker<Entity1_14Types.EntityType> {
public EntityTracker1_14_1(UserConnection user) {
super(user, EntityType.PLAYER);
}
}

View File

@ -3,6 +3,7 @@ package us.myles.ViaVersion.protocols.protocol1_9to1_8.sounds;
import lombok.Getter; import lombok.Getter;
import java.util.HashMap; import java.util.HashMap;
import java.util.Locale;
import java.util.Map; import java.util.Map;
@Getter @Getter
@ -284,7 +285,7 @@ public enum SoundEffect {
} }
public static SoundEffect getByName(String name) { public static SoundEffect getByName(String name) {
name = name.toLowerCase(); name = name.toLowerCase(Locale.ROOT);
return effects.get(name); return effects.get(name);
} }

View File

@ -12,6 +12,7 @@ import java.io.InputStreamReader;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.Locale;
import java.util.UUID; import java.util.UUID;
public class UpdateUtil { public class UpdateUtil {
@ -81,7 +82,7 @@ public class UpdateUtil {
if (current.compareTo(newest) < 0) if (current.compareTo(newest) < 0)
return "There is a newer version available: " + newest.toString() + ", you're on: " + current.toString(); return "There is a newer version available: " + newest.toString() + ", you're on: " + current.toString();
else if (console && current.compareTo(newest) != 0) { 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."; return "You are running a development version, please report any bugs to GitHub.";
} else { } else {
return "You are running a newer version than is released!"; return "You are running a newer version than is released!";

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>2.0.2-SNAPSHOT</version> <version>2.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<name>viaversion-jar</name> <name>viaversion-jar</name>

View File

@ -6,7 +6,7 @@
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<version>2.0.2-SNAPSHOT</version> <version>2.1.0</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>viaversion-parent</name> <name>viaversion-parent</name>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>2.0.2-SNAPSHOT</version> <version>2.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>2.0.2-SNAPSHOT</version> <version>2.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>2.0.2-SNAPSHOT</version> <version>2.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>