Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-08 17:20:24 +01:00
Merge pull request #855 from creeper123123321/dev
1.13-pre10 + some things
Dieser Commit ist enthalten in:
Commit
666779b012
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viaversion-parent</artifactId>
|
<artifactId>viaversion-parent</artifactId>
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<version>1.4.0-1.13-pre9</version>
|
<version>1.4.0-1.13-pre10</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viaversion-parent</artifactId>
|
<artifactId>viaversion-parent</artifactId>
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<version>1.4.0-1.13-pre9</version>
|
<version>1.4.0-1.13-pre10</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viaversion-parent</artifactId>
|
<artifactId>viaversion-parent</artifactId>
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<version>1.4.0-1.13-pre9</version>
|
<version>1.4.0-1.13-pre10</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@ -62,7 +62,7 @@ public class ProtocolVersion {
|
|||||||
register(v1_12 = new ProtocolVersion(335, "1.12"));
|
register(v1_12 = new ProtocolVersion(335, "1.12"));
|
||||||
register(v1_12_1 = new ProtocolVersion(338, "1.12.1"));
|
register(v1_12_1 = new ProtocolVersion(338, "1.12.1"));
|
||||||
register(v1_12_2 = new ProtocolVersion(340, "1.12.2"));
|
register(v1_12_2 = new ProtocolVersion(340, "1.12.2"));
|
||||||
register(v1_13 = new ProtocolVersion(391, "1.13-pre9"));
|
register(v1_13 = new ProtocolVersion(392, "1.13-pre10"));
|
||||||
register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
|
register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +49,56 @@ public class ProtocolSnapshotTo1_12_2 extends Protocol {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public static final PacketHandler SEND_DECLARE_COMMANDS_AND_TAGS = new PacketHandler() { // *insert here a good name*
|
||||||
|
@Override
|
||||||
|
public void handle(PacketWrapper w) throws Exception {
|
||||||
|
// Send fake declare commands
|
||||||
|
w.create(0x11, new ValueCreator() {
|
||||||
|
@Override
|
||||||
|
public void write(PacketWrapper wrapper) {
|
||||||
|
wrapper.write(Type.VAR_INT, 2); // Size
|
||||||
|
// Write root node
|
||||||
|
wrapper.write(Type.VAR_INT, 0); // Mark as command
|
||||||
|
wrapper.write(Type.VAR_INT, 1); // 1 child
|
||||||
|
wrapper.write(Type.VAR_INT, 1); // Child is at 1
|
||||||
|
|
||||||
|
// Write arg node
|
||||||
|
wrapper.write(Type.VAR_INT, 0x02 | 0x04 | 0x10); // Mark as command
|
||||||
|
wrapper.write(Type.VAR_INT, 0); // No children
|
||||||
|
// Extra data
|
||||||
|
wrapper.write(Type.STRING, "args"); // Arg name
|
||||||
|
wrapper.write(Type.STRING, "brigadier:string");
|
||||||
|
wrapper.write(Type.VAR_INT, 2); // Greedy
|
||||||
|
wrapper.write(Type.STRING, "minecraft:ask_server"); // Ask server
|
||||||
|
|
||||||
|
wrapper.write(Type.VAR_INT, 0); // Root node index
|
||||||
|
}
|
||||||
|
}).send(ProtocolSnapshotTo1_12_2.class);
|
||||||
|
|
||||||
|
// Send tags packet
|
||||||
|
w.create(0x55, new ValueCreator() {
|
||||||
|
@Override
|
||||||
|
public void write(PacketWrapper wrapper) throws Exception {
|
||||||
|
wrapper.write(Type.VAR_INT, MappingData.blockTags.size()); // block tags
|
||||||
|
for (Map.Entry<String, Integer[]> tag : MappingData.blockTags.entrySet()) {
|
||||||
|
wrapper.write(Type.STRING, tag.getKey());
|
||||||
|
wrapper.write(Type.VAR_INT_ARRAY, tag.getValue().clone());
|
||||||
|
}
|
||||||
|
wrapper.write(Type.VAR_INT, MappingData.itemTags.size()); // item tags
|
||||||
|
for (Map.Entry<String, Integer[]> tag : MappingData.itemTags.entrySet()) {
|
||||||
|
wrapper.write(Type.STRING, tag.getKey());
|
||||||
|
wrapper.write(Type.VAR_INT_ARRAY, tag.getValue().clone());
|
||||||
|
}
|
||||||
|
wrapper.write(Type.VAR_INT, MappingData.fluidTags.size()); // fluid tags
|
||||||
|
for (Map.Entry<String, Integer[]> tag : MappingData.fluidTags.entrySet()) {
|
||||||
|
wrapper.write(Type.STRING, tag.getKey());
|
||||||
|
wrapper.write(Type.VAR_INT_ARRAY, tag.getValue().clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).send(ProtocolSnapshotTo1_12_2.class);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
static {
|
static {
|
||||||
MappingData.init();
|
MappingData.init();
|
||||||
}
|
}
|
||||||
@ -165,53 +215,9 @@ public class ProtocolSnapshotTo1_12_2 extends Protocol {
|
|||||||
ClientWorld clientChunks = wrapper.user().get(ClientWorld.class);
|
ClientWorld clientChunks = wrapper.user().get(ClientWorld.class);
|
||||||
int dimensionId = wrapper.get(Type.INT, 1);
|
int dimensionId = wrapper.get(Type.INT, 1);
|
||||||
clientChunks.setEnvironment(dimensionId);
|
clientChunks.setEnvironment(dimensionId);
|
||||||
|
|
||||||
// Send fake declare commands
|
|
||||||
wrapper.create(0x11, new ValueCreator() {
|
|
||||||
@Override
|
|
||||||
public void write(PacketWrapper wrapper) {
|
|
||||||
wrapper.write(Type.VAR_INT, 2); // Size
|
|
||||||
// Write root node
|
|
||||||
wrapper.write(Type.VAR_INT, 0); // Mark as command
|
|
||||||
wrapper.write(Type.VAR_INT, 1); // 1 child
|
|
||||||
wrapper.write(Type.VAR_INT, 1); // Child is at 1
|
|
||||||
|
|
||||||
// Write arg node
|
|
||||||
wrapper.write(Type.VAR_INT, 0x02 | 0x04 | 0x10); // Mark as command
|
|
||||||
wrapper.write(Type.VAR_INT, 0); // No children
|
|
||||||
// Extra data
|
|
||||||
wrapper.write(Type.STRING, "args"); // Arg name
|
|
||||||
wrapper.write(Type.STRING, "brigadier:string");
|
|
||||||
wrapper.write(Type.VAR_INT, 2); // Greedy
|
|
||||||
wrapper.write(Type.STRING, "minecraft:ask_server"); // Ask server
|
|
||||||
|
|
||||||
wrapper.write(Type.VAR_INT, 0); // Root node index
|
|
||||||
}
|
|
||||||
}).send(ProtocolSnapshotTo1_12_2.class);
|
|
||||||
|
|
||||||
// Send tags packet
|
|
||||||
wrapper.create(0x55, new ValueCreator() {
|
|
||||||
@Override
|
|
||||||
public void write(PacketWrapper wrapper) throws Exception {
|
|
||||||
wrapper.write(Type.VAR_INT, MappingData.blockTags.size()); // block tags
|
|
||||||
for (Map.Entry<String, Integer[]> tag : MappingData.blockTags.entrySet()) {
|
|
||||||
wrapper.write(Type.STRING, tag.getKey());
|
|
||||||
wrapper.write(Type.VAR_INT_ARRAY, tag.getValue().clone());
|
|
||||||
}
|
|
||||||
wrapper.write(Type.VAR_INT, MappingData.itemTags.size()); // item tags
|
|
||||||
for (Map.Entry<String, Integer[]> tag : MappingData.itemTags.entrySet()) {
|
|
||||||
wrapper.write(Type.STRING, tag.getKey());
|
|
||||||
wrapper.write(Type.VAR_INT_ARRAY, tag.getValue().clone());
|
|
||||||
}
|
|
||||||
wrapper.write(Type.VAR_INT, MappingData.fluidTags.size()); // fluid tags
|
|
||||||
for (Map.Entry<String, Integer[]> tag : MappingData.fluidTags.entrySet()) {
|
|
||||||
wrapper.write(Type.STRING, tag.getKey());
|
|
||||||
wrapper.write(Type.VAR_INT_ARRAY, tag.getValue().clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).send(ProtocolSnapshotTo1_12_2.class);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
handler(SEND_DECLARE_COMMANDS_AND_TAGS);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -296,6 +302,7 @@ public class ProtocolSnapshotTo1_12_2 extends Protocol {
|
|||||||
clientWorld.setEnvironment(dimensionId);
|
clientWorld.setEnvironment(dimensionId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
handler(SEND_DECLARE_COMMANDS_AND_TAGS);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -15,8 +15,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class MappingData {
|
public class MappingData {
|
||||||
public static Map<Integer, Integer> oldToNewBlocks = new HashMap<>();
|
public static Map<Integer, Integer> oldToNewBlocks = new HashMap<>();
|
||||||
public static Map<Integer, Integer> oldToNewItems = new HashMap<>();
|
public static BiMap<Integer, Integer> oldToNewItems = HashBiMap.create();
|
||||||
public static Map<Integer, Integer> newToOldItems = new HashMap<>();
|
|
||||||
public static Map<String, Integer[]> blockTags = new HashMap<>();
|
public static Map<String, Integer[]> blockTags = new HashMap<>();
|
||||||
public static Map<String, Integer[]> itemTags = new HashMap<>();
|
public static Map<String, Integer[]> itemTags = new HashMap<>();
|
||||||
public static Map<String, Integer[]> fluidTags = new HashMap<>();
|
public static Map<String, Integer[]> fluidTags = new HashMap<>();
|
||||||
@ -32,8 +31,6 @@ public class MappingData {
|
|||||||
mapIdentifiers(oldToNewBlocks, mapping1_12.getAsJsonObject("blocks"), mapping1_13.getAsJsonObject("blocks"));
|
mapIdentifiers(oldToNewBlocks, mapping1_12.getAsJsonObject("blocks"), mapping1_13.getAsJsonObject("blocks"));
|
||||||
System.out.println("Loading item mapping...");
|
System.out.println("Loading item mapping...");
|
||||||
mapIdentifiers(oldToNewItems, mapping1_12.getAsJsonObject("items"), mapping1_13.getAsJsonObject("items"));
|
mapIdentifiers(oldToNewItems, mapping1_12.getAsJsonObject("items"), mapping1_13.getAsJsonObject("items"));
|
||||||
System.out.println("Loading new to old item mapping...");
|
|
||||||
mapIdentifiers(newToOldItems, mapping1_13.getAsJsonObject("items"), mapping1_12.getAsJsonObject("items"));
|
|
||||||
System.out.println("Loading new tags...");
|
System.out.println("Loading new tags...");
|
||||||
loadTags(blockTags, mapping1_13.getAsJsonObject("block_tags"));
|
loadTags(blockTags, mapping1_13.getAsJsonObject("block_tags"));
|
||||||
loadTags(itemTags, mapping1_13.getAsJsonObject("item_tags"));
|
loadTags(itemTags, mapping1_13.getAsJsonObject("item_tags"));
|
||||||
|
@ -263,36 +263,33 @@ public class InventoryPackets {
|
|||||||
// TODO Rewrite identifiers
|
// TODO Rewrite identifiers
|
||||||
public static void toClient(Item item) {
|
public static void toClient(Item item) {
|
||||||
if (item == null) return;
|
if (item == null) return;
|
||||||
|
|
||||||
// create tag
|
|
||||||
CompoundTag tag = item.getTag();
|
CompoundTag tag = item.getTag();
|
||||||
if (tag == null) {
|
|
||||||
item.setTag(tag = new CompoundTag("tag"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save original id
|
// Save original id
|
||||||
int originalId = (item.getId() << 16 | item.getData() & 0xFFFF);
|
int originalId = (item.getId() << 16 | item.getData() & 0xFFFF);
|
||||||
tag.put(new IntTag(NBT_TAG_NAME, originalId));
|
|
||||||
|
|
||||||
// NBT changes
|
// NBT Additions
|
||||||
if (isDamageable(item.getId())) {
|
if (isDamageable(item.getId())) {
|
||||||
|
if (tag == null) item.setTag(tag = new CompoundTag("tag"));
|
||||||
tag.put(new IntTag("Damage", item.getData()));
|
tag.put(new IntTag("Damage", item.getData()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.getId() == 358) { // map
|
if (item.getId() == 358) { // map
|
||||||
|
if (tag == null) item.setTag(tag = new CompoundTag("tag"));
|
||||||
tag.put(new IntTag("map", item.getData()));
|
tag.put(new IntTag("map", item.getData()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.getId() == 442) { // shield
|
// NBT Changes
|
||||||
|
if (tag != null) {
|
||||||
|
// Invert shield color id
|
||||||
|
if (item.getId() == 442) {
|
||||||
if (tag.get("BlockEntityTag") instanceof CompoundTag) {
|
if (tag.get("BlockEntityTag") instanceof CompoundTag) {
|
||||||
CompoundTag blockEntityTag = tag.get("BlockEntityTag");
|
CompoundTag blockEntityTag = tag.get("BlockEntityTag");
|
||||||
if (blockEntityTag.get("Base") instanceof IntTag) {
|
if (blockEntityTag.get("Base") instanceof IntTag) {
|
||||||
IntTag base = blockEntityTag.get("Base");
|
IntTag base = blockEntityTag.get("Base");
|
||||||
base.setValue(15 - base.getValue()); // invert color id
|
base.setValue(15 - base.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display Name now uses JSON
|
// Display Name now uses JSON
|
||||||
if (tag.get("display") instanceof CompoundTag) {
|
if (tag.get("display") instanceof CompoundTag) {
|
||||||
if (((CompoundTag) tag.get("display")).get("Name") instanceof StringTag) {
|
if (((CompoundTag) tag.get("display")).get("Name") instanceof StringTag) {
|
||||||
@ -304,7 +301,6 @@ public class InventoryPackets {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ench is now Enchantments and now uses identifiers
|
// ench is now Enchantments and now uses identifiers
|
||||||
if (tag.get("ench") instanceof ListTag) {
|
if (tag.get("ench") instanceof ListTag) {
|
||||||
ListTag ench = tag.get("ench");
|
ListTag ench = tag.get("ench");
|
||||||
@ -314,7 +310,7 @@ public class InventoryPackets {
|
|||||||
CompoundTag enchantmentEntry = new CompoundTag("");
|
CompoundTag enchantmentEntry = new CompoundTag("");
|
||||||
enchantmentEntry.put(new StringTag("id",
|
enchantmentEntry.put(new StringTag("id",
|
||||||
MappingData.oldEnchantmentsIds.get(
|
MappingData.oldEnchantmentsIds.get(
|
||||||
(Short) ((CompoundTag) enchEntry).get("id").getValue()
|
(short) ((CompoundTag) enchEntry).get("id").getValue()
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
enchantmentEntry.put(new ShortTag("lvl", (Short) ((CompoundTag) enchEntry).get("lvl").getValue()));
|
enchantmentEntry.put(new ShortTag("lvl", (Short) ((CompoundTag) enchEntry).get("lvl").getValue()));
|
||||||
@ -324,6 +320,7 @@ public class InventoryPackets {
|
|||||||
tag.remove("ench");
|
tag.remove("ench");
|
||||||
tag.put(enchantments);
|
tag.put(enchantments);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int rawId = (item.getId() << 4 | item.getData() & 0xF);
|
int rawId = (item.getId() << 4 | item.getData() & 0xF);
|
||||||
|
|
||||||
@ -345,7 +342,13 @@ public class InventoryPackets {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!MappingData.oldToNewItems.containsKey(rawId)) {
|
if (!MappingData.oldToNewItems.containsKey(rawId)) {
|
||||||
if (MappingData.oldToNewItems.containsKey(rawId & ~0xF)) {
|
if (!isDamageable(item.getId()) && item.getId() != 358) { // Map
|
||||||
|
if (tag == null) item.setTag(tag = new CompoundTag("tag"));
|
||||||
|
tag.put(new IntTag(NBT_TAG_NAME, originalId)); // Data will be lost, saving original id
|
||||||
|
}
|
||||||
|
if (item.getId() == 31 && item.getData() == 0) { // Shrub was removed
|
||||||
|
rawId = 32 << 4; // Dead Bush
|
||||||
|
} else if (MappingData.oldToNewItems.containsKey(rawId & ~0xF)) {
|
||||||
rawId &= ~0xF; // Remove data
|
rawId &= ~0xF; // Remove data
|
||||||
} else {
|
} else {
|
||||||
System.out.println("FAILED TO GET 1.13 ITEM FOR " + item.getId()); // TODO: Make this nicer etc, perhaps fix issues with mapping :T
|
System.out.println("FAILED TO GET 1.13 ITEM FOR " + item.getId()); // TODO: Make this nicer etc, perhaps fix issues with mapping :T
|
||||||
@ -378,7 +381,7 @@ public class InventoryPackets {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (rawId == null) {
|
if (rawId == null) {
|
||||||
Integer oldId = MappingData.newToOldItems.get((int) item.getId());
|
Integer oldId = MappingData.oldToNewItems.inverse().get((int) item.getId());
|
||||||
if (oldId != null) {
|
if (oldId != null) {
|
||||||
// Handle spawn eggs
|
// Handle spawn eggs
|
||||||
Optional<String> eggEntityId = SpawnEggRewriter.getEntityId(oldId);
|
Optional<String> eggEntityId = SpawnEggRewriter.getEntityId(oldId);
|
||||||
|
@ -42,7 +42,7 @@ public class BlockEntityProvider implements Provider {
|
|||||||
String id = (String) tag.get("id").getValue();
|
String id = (String) tag.get("id").getValue();
|
||||||
|
|
||||||
if (!handlers.containsKey(id)) {
|
if (!handlers.containsKey(id)) {
|
||||||
System.out.println("Unhandled BlockEntity " + id + " full tag: " + tag);
|
//System.out.println("Unhandled BlockEntity " + id + " full tag: " + tag);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,47 +9,53 @@ import java.util.Map;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public class FlowerPotHandler implements BlockEntityProvider.BlockEntityHandler {
|
public class FlowerPotHandler implements BlockEntityProvider.BlockEntityHandler {
|
||||||
private static final Map<Pair<String, Integer>, Integer> flowers = new ConcurrentHashMap<>();
|
private static final Map<Pair<String, Byte>, Integer> flowers = new ConcurrentHashMap<>();
|
||||||
|
private static final Map<Pair<Byte, Byte>, Integer> flowersNumberId = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
register("minecraft:air", 0, 5265);
|
register("minecraft:air", (byte) 0, (byte) 0, 5265);
|
||||||
register("minecraft:sapling", 0, 5266);
|
register("minecraft:sapling", (byte) 6, (byte) 0, 5266);
|
||||||
register("minecraft:sapling", 1, 5267);
|
register("minecraft:sapling", (byte) 6, (byte) 1, 5267);
|
||||||
register("minecraft:sapling", 2, 5268);
|
register("minecraft:sapling", (byte) 6, (byte) 2, 5268);
|
||||||
register("minecraft:sapling", 3, 5269);
|
register("minecraft:sapling", (byte) 6, (byte) 3, 5269);
|
||||||
register("minecraft:sapling", 4, 5270);
|
register("minecraft:sapling", (byte) 6, (byte) 4, 5270);
|
||||||
register("minecraft:sapling", 5, 5271);
|
register("minecraft:sapling", (byte) 6, (byte) 5, 5271);
|
||||||
register("minecraft:tallgrass", 2, 5272);
|
register("minecraft:tallgrass", (byte) 31, (byte) 2, 5272);
|
||||||
register("minecraft:yellow_flower", 0, 5273);
|
register("minecraft:yellow_flower", (byte) 37, (byte) 0, 5273);
|
||||||
register("minecraft:red_flower", 0, 5274);
|
register("minecraft:red_flower", (byte) 38, (byte) 0, 5274);
|
||||||
register("minecraft:red_flower", 1, 5275);
|
register("minecraft:red_flower", (byte) 38, (byte) 1, 5275);
|
||||||
register("minecraft:red_flower", 2, 5276);
|
register("minecraft:red_flower", (byte) 38, (byte) 2, 5276);
|
||||||
register("minecraft:red_flower", 3, 5277);
|
register("minecraft:red_flower", (byte) 38, (byte) 3, 5277);
|
||||||
register("minecraft:red_flower", 4, 5278);
|
register("minecraft:red_flower", (byte) 38, (byte) 4, 5278);
|
||||||
register("minecraft:red_flower", 5, 5279);
|
register("minecraft:red_flower", (byte) 38, (byte) 5, 5279);
|
||||||
register("minecraft:red_flower", 6, 5280);
|
register("minecraft:red_flower", (byte) 38, (byte) 6, 5280);
|
||||||
register("minecraft:red_flower", 7, 5281);
|
register("minecraft:red_flower", (byte) 38, (byte) 7, 5281);
|
||||||
register("minecraft:red_flower", 8, 5282);
|
register("minecraft:red_flower", (byte) 38, (byte) 8, 5282);
|
||||||
register("minecraft:red_mushroom", 0, 5283);
|
register("minecraft:red_mushroom", (byte) 40, (byte) 0, 5283);
|
||||||
register("minecraft:brown_mushroom", 0, 5284);
|
register("minecraft:brown_mushroom", (byte) 39, (byte) 0, 5284);
|
||||||
register("minecraft:deadbush", 0, 5285);
|
register("minecraft:deadbush", (byte) 32, (byte) 0, 5285);
|
||||||
register("minecraft:cactus", 0, 5286);
|
register("minecraft:cactus", (byte) 81, (byte) 0, 5286);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void register(String identifier, int blockData, int newId) {
|
public static void register(String identifier, byte numbericBlockId, byte blockData, int newId) {
|
||||||
flowers.put(new Pair<>(identifier, blockData), newId);
|
flowers.put(new Pair<>(identifier, blockData), newId);
|
||||||
|
flowersNumberId.put(new Pair<>(numbericBlockId, blockData), newId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int transform(UserConnection user, CompoundTag tag) {
|
public int transform(UserConnection user, CompoundTag tag) {
|
||||||
String item = (String) tag.get("Item").getValue();
|
Object item = tag.get("Item").getValue();
|
||||||
int data = (int) tag.get("Data").getValue();
|
byte data = ((Number) tag.get("Data").getValue()).byteValue();
|
||||||
|
|
||||||
Pair<String, Integer> pair = new Pair<>(item, data);
|
Pair<?, Byte> pair = item instanceof Number
|
||||||
|
? new Pair<>(((Number) item).byteValue(), data)
|
||||||
|
: new Pair<>((String) item, data);
|
||||||
|
|
||||||
if (flowers.containsKey(pair)) {
|
if (flowers.containsKey(pair)) {
|
||||||
return flowers.get(pair);
|
return flowers.get(pair);
|
||||||
|
} else if (flowersNumberId.containsKey(pair)) {
|
||||||
|
return flowersNumberId.get(pair);
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Could not find flowerpot content " + item + " for " + tag);
|
System.out.println("Could not find flowerpot content " + item + " for " + tag);
|
||||||
}
|
}
|
||||||
|
@ -1743,7 +1743,7 @@
|
|||||||
"448": "minecraft:detector_rail",
|
"448": "minecraft:detector_rail",
|
||||||
"464": "minecraft:sticky_piston",
|
"464": "minecraft:sticky_piston",
|
||||||
"480": "minecraft:cobweb",
|
"480": "minecraft:cobweb",
|
||||||
"496": "minecraft:dead_bush",
|
//"496": "minecraft:dead_bush",
|
||||||
"497": "minecraft:grass",
|
"497": "minecraft:grass",
|
||||||
"498": "minecraft:fern",
|
"498": "minecraft:fern",
|
||||||
"512": "minecraft:dead_bush",
|
"512": "minecraft:dead_bush",
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viaversion-parent</artifactId>
|
<artifactId>viaversion-parent</artifactId>
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<version>1.4.0-1.13-pre9</version>
|
<version>1.4.0-1.13-pre10</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<name>viaversion-jar</name>
|
<name>viaversion-jar</name>
|
||||||
|
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<artifactId>viaversion-parent</artifactId>
|
<artifactId>viaversion-parent</artifactId>
|
||||||
<version>1.4.0-1.13-pre9</version>
|
<version>1.4.0-1.13-pre10</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<name>viaversion-parent</name>
|
<name>viaversion-parent</name>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viaversion-parent</artifactId>
|
<artifactId>viaversion-parent</artifactId>
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<version>1.4.0-1.13-pre9</version>
|
<version>1.4.0-1.13-pre10</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viaversion-parent</artifactId>
|
<artifactId>viaversion-parent</artifactId>
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<version>1.4.0-1.13-pre9</version>
|
<version>1.4.0-1.13-pre10</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren