mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-25 19:45:21 +01:00
18w02a
This commit is contained in:
parent
566c9dbda0
commit
9ff20f3fea
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>1.4.0-18w01a</version>
|
||||
<version>1.4.0-18w02a</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>1.4.0-18w01a</version>
|
||||
<version>1.4.0-18w02a</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
<dependency>
|
||||
<groupId>us.myles</groupId>
|
||||
<artifactId>viaversion-common</artifactId>
|
||||
<version>1.4.0-18w01a</version>
|
||||
<version>1.4.0-18w02a</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>1.4.0-18w01a</version>
|
||||
<version>1.4.0-18w02a</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -62,7 +62,7 @@ public class ProtocolVersion {
|
||||
register(v1_12 = new ProtocolVersion(335, "1.12"));
|
||||
register(v1_12_1 = new ProtocolVersion(338, "1.12.1"));
|
||||
register(v1_12_2 = new ProtocolVersion(340, "1.12.2"));
|
||||
register(v1_13 = new ProtocolVersion(352, "18w01a"));
|
||||
register(v1_13 = new ProtocolVersion(353, "18w02a"));
|
||||
register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@ import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.packets.EntityPack
|
||||
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.packets.InventoryPackets;
|
||||
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.packets.WorldPackets;
|
||||
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.providers.BlockEntityProvider;
|
||||
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.providers.PaintingProvider;
|
||||
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.storage.BlockStorage;
|
||||
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.storage.EntityTracker;
|
||||
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.storage.TabCompleteTracker;
|
||||
@ -391,5 +392,6 @@ public class ProtocolSnapshotTo1_12_2 extends Protocol {
|
||||
@Override
|
||||
protected void register(ViaProviders providers) {
|
||||
providers.register(BlockEntityProvider.class, new BlockEntityProvider());
|
||||
providers.register(PaintingProvider.class, new PaintingProvider());
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.packets;
|
||||
|
||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
import com.google.common.base.Optional;
|
||||
import us.myles.ViaVersion.api.PacketWrapper;
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
@ -17,11 +18,37 @@ import us.myles.ViaVersion.protocols.protocol1_9_1_2to1_9_3_4.types.Chunk1_9_3_4
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.data.MappingData;
|
||||
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.providers.BlockEntityProvider;
|
||||
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.providers.PaintingProvider;
|
||||
import us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.storage.BlockStorage;
|
||||
|
||||
public class WorldPackets {
|
||||
public static void register(Protocol protocol) {
|
||||
// Outgoing packets
|
||||
|
||||
// Spawn Painting
|
||||
protocol.registerOutgoing(State.PLAY, 0x04, 0x04, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.VAR_INT); // 0 - Entity ID
|
||||
map(Type.UUID); // 1 - Entity UUID
|
||||
|
||||
handler(new PacketHandler() {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
PaintingProvider provider = Via.getManager().getProviders().get(PaintingProvider.class);
|
||||
String motive = wrapper.read(Type.STRING);
|
||||
|
||||
Optional<Integer> id = provider.getIntByIdentifier(motive);
|
||||
|
||||
if (!id.isPresent())
|
||||
System.out.println("Could not find painting motive: " + motive + " falling back to default (0)");
|
||||
|
||||
wrapper.write(Type.VAR_INT, id.or(0));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Update Block Entity
|
||||
protocol.registerOutgoing(State.PLAY, 0x09, 0x09, new PacketRemapper() {
|
||||
@Override
|
||||
|
@ -0,0 +1,55 @@
|
||||
package us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.providers;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import us.myles.ViaVersion.api.platform.providers.Provider;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class PaintingProvider implements Provider {
|
||||
private Map<String, Integer> paintings = new ConcurrentHashMap<>();
|
||||
|
||||
public PaintingProvider() {
|
||||
add("kebab");
|
||||
add("aztec");
|
||||
add("alban");
|
||||
add("aztec2");
|
||||
add("bomb");
|
||||
add("plant");
|
||||
add("wasteland");
|
||||
add("pool");
|
||||
add("courbet");
|
||||
add("sea");
|
||||
add("sunset");
|
||||
add("creebet");
|
||||
add("wanderer");
|
||||
add("graham");
|
||||
add("match");
|
||||
add("bust");
|
||||
add("stage");
|
||||
add("void");
|
||||
add("skull_and_roses");
|
||||
add("wither");
|
||||
add("fighters");
|
||||
add("pointer");
|
||||
add("pigscene");
|
||||
add("burning_skull");
|
||||
add("skeleton");
|
||||
add("donkey_kong");
|
||||
}
|
||||
|
||||
private void add(String motive) {
|
||||
paintings.put("minecraft:" + motive, paintings.size());
|
||||
}
|
||||
|
||||
public Optional<Integer> getIntByIdentifier(String motive) {
|
||||
// Handle older versions
|
||||
if (!motive.startsWith("minecraft:"))
|
||||
motive = "minecraft:" + motive.toLowerCase();
|
||||
|
||||
if (paintings.containsKey(motive))
|
||||
return Optional.of(paintings.get(motive));
|
||||
|
||||
return Optional.absent();
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>1.4.0-18w01a</version>
|
||||
<version>1.4.0-18w02a</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>1.4.0-18w01a</version>
|
||||
<version>1.4.0-18w02a</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>viaversion-parent</name>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>1.4.0-18w01a</version>
|
||||
<version>1.4.0-18w02a</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>viaversion-parent</artifactId>
|
||||
<groupId>us.myles</groupId>
|
||||
<version>1.4.0-18w01a</version>
|
||||
<version>1.4.0-18w02a</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user