Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-12-27 08:30:10 +01:00
Various API changes to LegacyBlockItemRewriter (#703)
Dieser Commit ist enthalten in:
Ursprung
082cc010b2
Commit
4e856ef396
@ -67,7 +67,7 @@ public class BackwardsStructuredItemRewriter<C extends ClientboundPacketType, S
|
|||||||
|
|
||||||
// Save original id, set remapped id
|
// Save original id, set remapped id
|
||||||
final CompoundTag tag = createCustomTag(item);
|
final CompoundTag tag = createCustomTag(item);
|
||||||
tag.putInt(nbtTagName + "|id", item.identifier());
|
tag.putInt(getNbtTagName() + "|id", item.identifier());
|
||||||
item.setIdentifier(mappedItem.getId());
|
item.setIdentifier(mappedItem.getId());
|
||||||
|
|
||||||
// Add custom model data
|
// Add custom model data
|
||||||
@ -95,7 +95,7 @@ public class BackwardsStructuredItemRewriter<C extends ClientboundPacketType, S
|
|||||||
|
|
||||||
final CompoundTag tag = customTag(item);
|
final CompoundTag tag = customTag(item);
|
||||||
if (tag != null) {
|
if (tag != null) {
|
||||||
final Tag originalId = tag.remove(nbtTagName + "|id");
|
final Tag originalId = tag.remove(getNbtTagName() + "|id");
|
||||||
if (originalId instanceof IntTag) {
|
if (originalId instanceof IntTag) {
|
||||||
item.setIdentifier(((NumberTag) originalId).asInt());
|
item.setIdentifier(((NumberTag) originalId).asInt());
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ public class ItemRewriter<C extends ClientboundPacketType, S extends Serverbound
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Save original id, set remapped id
|
// Save original id, set remapped id
|
||||||
item.tag().putInt(nbtTagName + "|id", item.identifier());
|
item.tag().putInt(getNbtTagName() + "|id", item.identifier());
|
||||||
item.setIdentifier(data.getId());
|
item.setIdentifier(data.getId());
|
||||||
|
|
||||||
// Add custom model data
|
// Add custom model data
|
||||||
@ -105,7 +105,7 @@ public class ItemRewriter<C extends ClientboundPacketType, S extends Serverbound
|
|||||||
}
|
}
|
||||||
if (!display.contains("Name")) {
|
if (!display.contains("Name")) {
|
||||||
display.put("Name", new StringTag(data.getJsonName()));
|
display.put("Name", new StringTag(data.getJsonName()));
|
||||||
display.put(nbtTagName + "|customName", new ByteTag());
|
display.put(getNbtTagName() + "|customName", new ByteTag());
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
@ -116,7 +116,7 @@ public class ItemRewriter<C extends ClientboundPacketType, S extends Serverbound
|
|||||||
|
|
||||||
super.handleItemToServer(item);
|
super.handleItemToServer(item);
|
||||||
if (item.tag() != null) {
|
if (item.tag() != null) {
|
||||||
Tag originalId = item.tag().remove(nbtTagName + "|id");
|
Tag originalId = item.tag().remove(getNbtTagName() + "|id");
|
||||||
if (originalId instanceof IntTag) {
|
if (originalId instanceof IntTag) {
|
||||||
item.setIdentifier(((NumberTag) originalId).asInt());
|
item.setIdentifier(((NumberTag) originalId).asInt());
|
||||||
}
|
}
|
||||||
|
@ -32,13 +32,13 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
|||||||
public abstract class ItemRewriterBase<C extends ClientboundPacketType, S extends ServerboundPacketType,
|
public abstract class ItemRewriterBase<C extends ClientboundPacketType, S extends ServerboundPacketType,
|
||||||
T extends BackwardsProtocol<C, ?, ?, S>> extends ItemRewriter<C, S, T> {
|
T extends BackwardsProtocol<C, ?, ?, S>> extends ItemRewriter<C, S, T> {
|
||||||
|
|
||||||
protected final String nbtTagName;
|
|
||||||
protected final boolean jsonNameFormat;
|
protected final boolean jsonNameFormat;
|
||||||
|
protected final String protocolName;
|
||||||
|
|
||||||
protected ItemRewriterBase(T protocol, Type<Item> itemType, Type<Item[]> itemArrayType, Type<Item> mappedItemType, Type<Item[]> mappedItemArrayType, boolean jsonFormat) {
|
protected ItemRewriterBase(T protocol, Type<Item> itemType, Type<Item[]> itemArrayType, Type<Item> mappedItemType, Type<Item[]> mappedItemArrayType, boolean jsonFormat) {
|
||||||
super(protocol, itemType, itemArrayType, mappedItemType, mappedItemArrayType);
|
super(protocol, itemType, itemArrayType, mappedItemType, mappedItemArrayType);
|
||||||
this.jsonNameFormat = jsonFormat;
|
this.jsonNameFormat = jsonFormat;
|
||||||
nbtTagName = "VB|" + protocol.getClass().getSimpleName();
|
protocolName = protocol.getClass().getSimpleName();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ItemRewriterBase(T protocol, Type<Item> itemType, Type<Item[]> itemArrayType, boolean jsonNameFormat) {
|
protected ItemRewriterBase(T protocol, Type<Item> itemType, Type<Item[]> itemArrayType, boolean jsonNameFormat) {
|
||||||
@ -55,12 +55,12 @@ public abstract class ItemRewriterBase<C extends ClientboundPacketType, S extend
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean hasBackupTag(CompoundTag displayTag, String tagName) {
|
protected boolean hasBackupTag(CompoundTag displayTag, String tagName) {
|
||||||
return displayTag.contains(nbtTagName + "|o" + tagName);
|
return displayTag.contains(getNbtTagName() + "|o" + tagName);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void saveStringTag(CompoundTag displayTag, StringTag original, String name) {
|
protected void saveStringTag(CompoundTag displayTag, StringTag original, String name) {
|
||||||
// Multiple places might try to backup data
|
// Multiple places might try to backup data
|
||||||
String backupName = nbtTagName + "|o" + name;
|
String backupName = getNbtTagName() + "|o" + name;
|
||||||
if (!displayTag.contains(backupName)) {
|
if (!displayTag.contains(backupName)) {
|
||||||
displayTag.putString(backupName, original.getValue());
|
displayTag.putString(backupName, original.getValue());
|
||||||
}
|
}
|
||||||
@ -68,7 +68,7 @@ public abstract class ItemRewriterBase<C extends ClientboundPacketType, S extend
|
|||||||
|
|
||||||
protected void saveListTag(CompoundTag displayTag, ListTag<?> original, String name) {
|
protected void saveListTag(CompoundTag displayTag, ListTag<?> original, String name) {
|
||||||
// Multiple places might try to backup data
|
// Multiple places might try to backup data
|
||||||
String backupName = nbtTagName + "|o" + name;
|
String backupName = getNbtTagName() + "|o" + name;
|
||||||
if (!displayTag.contains(backupName)) {
|
if (!displayTag.contains(backupName)) {
|
||||||
displayTag.put(backupName, original.copy());
|
displayTag.put(backupName, original.copy());
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ public abstract class ItemRewriterBase<C extends ClientboundPacketType, S extend
|
|||||||
CompoundTag display = item.tag().getCompoundTag("display");
|
CompoundTag display = item.tag().getCompoundTag("display");
|
||||||
if (display != null) {
|
if (display != null) {
|
||||||
// Remove custom name / restore original name
|
// Remove custom name / restore original name
|
||||||
if (display.remove(nbtTagName + "|customName") != null) {
|
if (display.remove(getNbtTagName() + "|customName") != null) {
|
||||||
display.remove("Name");
|
display.remove("Name");
|
||||||
} else {
|
} else {
|
||||||
restoreStringTag(display, "Name");
|
restoreStringTag(display, "Name");
|
||||||
@ -92,20 +92,20 @@ public abstract class ItemRewriterBase<C extends ClientboundPacketType, S extend
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void restoreStringTag(CompoundTag tag, String tagName) {
|
protected void restoreStringTag(CompoundTag tag, String tagName) {
|
||||||
Tag original = tag.remove(nbtTagName + "|o" + tagName);
|
Tag original = tag.remove(getNbtTagName() + "|o" + tagName);
|
||||||
if (original instanceof StringTag) {
|
if (original instanceof StringTag) {
|
||||||
tag.putString(tagName, ((StringTag) original).getValue());
|
tag.putString(tagName, ((StringTag) original).getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void restoreListTag(CompoundTag tag, String tagName) {
|
protected void restoreListTag(CompoundTag tag, String tagName) {
|
||||||
Tag original = tag.remove(nbtTagName + "|o" + tagName);
|
Tag original = tag.remove(getNbtTagName() + "|o" + tagName);
|
||||||
if (original instanceof ListTag) {
|
if (original instanceof ListTag) {
|
||||||
tag.put(tagName, ((ListTag<?>) original).copy());
|
tag.put(tagName, ((ListTag<?>) original).copy());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNbtTagName() {
|
public String getNbtTagName() {
|
||||||
return nbtTagName;
|
return "VB|" + protocolName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,13 +23,17 @@ import com.viaversion.viabackwards.api.data.MappedLegacyBlockItem;
|
|||||||
import com.viaversion.viabackwards.api.data.BackwardsMappingDataLoader;
|
import com.viaversion.viabackwards.api.data.BackwardsMappingDataLoader;
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_11_1to1_12.data.BlockColors;
|
import com.viaversion.viabackwards.protocol.protocol1_11_1to1_12.data.BlockColors;
|
||||||
import com.viaversion.viabackwards.utils.Block;
|
import com.viaversion.viabackwards.utils.Block;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.BlockChangeRecord;
|
||||||
import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
|
import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
|
||||||
import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection;
|
import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection;
|
||||||
import com.viaversion.viaversion.api.minecraft.chunks.DataPalette;
|
import com.viaversion.viaversion.api.minecraft.chunks.DataPalette;
|
||||||
import com.viaversion.viaversion.api.minecraft.chunks.PaletteType;
|
import com.viaversion.viaversion.api.minecraft.chunks.PaletteType;
|
||||||
|
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_12;
|
||||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||||
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
|
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
|
||||||
|
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
|
||||||
|
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||||
import com.viaversion.viaversion.api.type.Type;
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectMap;
|
import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectMap;
|
||||||
import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectOpenHashMap;
|
import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectOpenHashMap;
|
||||||
@ -43,26 +47,27 @@ import com.viaversion.viaversion.libs.opennbt.tag.builtin.StringTag;
|
|||||||
import com.viaversion.viaversion.util.ComponentUtil;
|
import com.viaversion.viaversion.util.ComponentUtil;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
public abstract class LegacyBlockItemRewriter<C extends ClientboundPacketType, S extends ServerboundPacketType,
|
public abstract class LegacyBlockItemRewriter<C extends ClientboundPacketType, S extends ServerboundPacketType,
|
||||||
T extends BackwardsProtocol<C, ?, ?, S>> extends ItemRewriterBase<C, S, T> {
|
T extends BackwardsProtocol<C, ?, ?, S>> extends ItemRewriterBase<C, S, T> {
|
||||||
|
|
||||||
private static final Map<String, Int2ObjectMap<MappedLegacyBlockItem>> LEGACY_MAPPINGS = new HashMap<>();
|
protected final Int2ObjectMap<MappedLegacyBlockItem> replacementData = new Int2ObjectOpenHashMap<>(8); // Raw id -> mapped data
|
||||||
protected final Int2ObjectMap<MappedLegacyBlockItem> replacementData; // Raw id -> mapped data
|
|
||||||
|
|
||||||
static {
|
protected LegacyBlockItemRewriter(T protocol, String name) {
|
||||||
JsonObject jsonObject = BackwardsMappingDataLoader.INSTANCE.loadFromDataDir("legacy-mappings.json");
|
super(protocol, Type.ITEM1_8, Type.ITEM1_8_SHORT_ARRAY, false);
|
||||||
for (Map.Entry<String, JsonElement> entry : jsonObject.entrySet()) {
|
final JsonObject jsonObject = readMappingsFile("item-mappings-" + name + ".json");
|
||||||
Int2ObjectMap<MappedLegacyBlockItem> mappings = new Int2ObjectOpenHashMap<>(8);
|
for (Map.Entry<String, JsonElement> dataEntry : jsonObject.entrySet()) {
|
||||||
LEGACY_MAPPINGS.put(entry.getKey(), mappings);
|
addMapping(dataEntry.getKey(), dataEntry.getValue().getAsJsonObject(), replacementData);
|
||||||
for (Map.Entry<String, JsonElement> dataEntry : entry.getValue().getAsJsonObject().entrySet()) {
|
|
||||||
addMapping(dataEntry.getKey(), dataEntry.getValue().getAsJsonObject(), mappings);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addMapping(String key, JsonObject object, Int2ObjectMap<MappedLegacyBlockItem> mappings) {
|
protected JsonObject readMappingsFile(final String name) {
|
||||||
|
return BackwardsMappingDataLoader.INSTANCE.loadFromDataDir(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addMapping(String key, JsonObject object, Int2ObjectMap<MappedLegacyBlockItem> mappings) {
|
||||||
int id = object.getAsJsonPrimitive("id").getAsInt();
|
int id = object.getAsJsonPrimitive("id").getAsInt();
|
||||||
JsonPrimitive jsonData = object.getAsJsonPrimitive("data");
|
JsonPrimitive jsonData = object.getAsJsonPrimitive("data");
|
||||||
short data = jsonData != null ? jsonData.getAsShort() : 0;
|
short data = jsonData != null ? jsonData.getAsShort() : 0;
|
||||||
@ -104,9 +109,36 @@ public abstract class LegacyBlockItemRewriter<C extends ClientboundPacketType, S
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected LegacyBlockItemRewriter(T protocol) {
|
public void registerBlockChange(C packetType) {
|
||||||
super(protocol, Type.ITEM1_8, Type.ITEM1_8_SHORT_ARRAY, false);
|
protocol.registerClientbound(packetType, new PacketHandlers() {
|
||||||
replacementData = LEGACY_MAPPINGS.get(protocol.getClass().getSimpleName().split("To")[1].replace("_", "."));
|
@Override
|
||||||
|
public void register() {
|
||||||
|
map(Type.POSITION1_8); // 0 - Block Position
|
||||||
|
map(Type.VAR_INT); // 1 - Block
|
||||||
|
|
||||||
|
handler(wrapper -> {
|
||||||
|
int idx = wrapper.get(Type.VAR_INT, 0);
|
||||||
|
wrapper.set(Type.VAR_INT, 0, handleBlockID(idx));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerMultiBlockChange(C packetType) {
|
||||||
|
protocol.registerClientbound(packetType, new PacketHandlers() {
|
||||||
|
@Override
|
||||||
|
public void register() {
|
||||||
|
map(Type.INT); // 0 - Chunk X
|
||||||
|
map(Type.INT); // 1 - Chunk Z
|
||||||
|
map(Type.BLOCK_CHANGE_RECORD_ARRAY);
|
||||||
|
|
||||||
|
handler(wrapper -> {
|
||||||
|
for (BlockChangeRecord record : wrapper.get(Type.BLOCK_CHANGE_RECORD_ARRAY, 0)) {
|
||||||
|
record.setBlockId(handleBlockID(record.getBlockId()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -141,7 +173,7 @@ public abstract class LegacyBlockItemRewriter<C extends ClientboundPacketType, S
|
|||||||
if (nameTag == null) {
|
if (nameTag == null) {
|
||||||
nameTag = new StringTag(data.getName());
|
nameTag = new StringTag(data.getName());
|
||||||
display.put("Name", nameTag);
|
display.put("Name", nameTag);
|
||||||
display.put(nbtTagName + "|customName", new ByteTag());
|
display.put(getNbtTagName() + "|customName", new ByteTag());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle colors
|
// Handle colors
|
||||||
@ -163,6 +195,20 @@ public abstract class LegacyBlockItemRewriter<C extends ClientboundPacketType, S
|
|||||||
return (b.getId() << 4 | (b.getData() & 15));
|
return (b.getId() << 4 | (b.getData() & 15));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PacketHandler getFallingBlockHandler() {
|
||||||
|
return wrapper -> {
|
||||||
|
final Optional<EntityTypes1_12.ObjectType> type = EntityTypes1_12.ObjectType.findById(wrapper.get(Type.BYTE, 0));
|
||||||
|
if (type.isPresent() && type.get() == EntityTypes1_12.ObjectType.FALLING_BLOCK) {
|
||||||
|
final int objectData = wrapper.get(Type.INT, 0);
|
||||||
|
|
||||||
|
final Block block = handleBlock(objectData & 4095, objectData >> 12 & 15);
|
||||||
|
if (block == null) return;
|
||||||
|
|
||||||
|
wrapper.set(Type.INT, 0, block.getId() | block.getData() << 12);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public @Nullable Block handleBlock(int blockId, int data) {
|
public @Nullable Block handleBlock(int blockId, int data) {
|
||||||
MappedLegacyBlockItem settings = getMappedBlockItem(blockId, data);
|
MappedLegacyBlockItem settings = getMappedBlockItem(blockId, data);
|
||||||
if (settings == null || !settings.isBlock()) return null;
|
if (settings == null || !settings.isBlock()) return null;
|
||||||
|
@ -49,11 +49,14 @@ public class BlockItemPackets1_11 extends LegacyBlockItemRewriter<ClientboundPac
|
|||||||
private LegacyEnchantmentRewriter enchantmentRewriter;
|
private LegacyEnchantmentRewriter enchantmentRewriter;
|
||||||
|
|
||||||
public BlockItemPackets1_11(Protocol1_10To1_11 protocol) {
|
public BlockItemPackets1_11(Protocol1_10To1_11 protocol) {
|
||||||
super(protocol);
|
super(protocol, "1.11");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
|
registerBlockChange(ClientboundPackets1_9_3.BLOCK_CHANGE);
|
||||||
|
registerMultiBlockChange(ClientboundPackets1_9_3.MULTI_BLOCK_CHANGE);
|
||||||
|
|
||||||
protocol.registerClientbound(ClientboundPackets1_9_3.SET_SLOT, new PacketHandlers() {
|
protocol.registerClientbound(ClientboundPackets1_9_3.SET_SLOT, new PacketHandlers() {
|
||||||
@Override
|
@Override
|
||||||
public void register() {
|
public void register() {
|
||||||
@ -187,34 +190,6 @@ public class BlockItemPackets1_11 extends LegacyBlockItemRewriter<ClientboundPac
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
protocol.registerClientbound(ClientboundPackets1_9_3.BLOCK_CHANGE, new PacketHandlers() {
|
|
||||||
@Override
|
|
||||||
public void register() {
|
|
||||||
map(Type.POSITION1_8); // 0 - Block Position
|
|
||||||
map(Type.VAR_INT); // 1 - Block
|
|
||||||
|
|
||||||
handler(wrapper -> {
|
|
||||||
int idx = wrapper.get(Type.VAR_INT, 0);
|
|
||||||
wrapper.set(Type.VAR_INT, 0, handleBlockID(idx));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
protocol.registerClientbound(ClientboundPackets1_9_3.MULTI_BLOCK_CHANGE, new PacketHandlers() {
|
|
||||||
@Override
|
|
||||||
public void register() {
|
|
||||||
map(Type.INT); // 0 - Chunk X
|
|
||||||
map(Type.INT); // 1 - Chunk Z
|
|
||||||
map(Type.BLOCK_CHANGE_RECORD_ARRAY);
|
|
||||||
|
|
||||||
handler(wrapper -> {
|
|
||||||
for (BlockChangeRecord record : wrapper.get(Type.BLOCK_CHANGE_RECORD_ARRAY, 0)) {
|
|
||||||
record.setBlockId(handleBlockID(record.getBlockId()));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
protocol.registerClientbound(ClientboundPackets1_9_3.BLOCK_ENTITY_DATA, new PacketHandlers() {
|
protocol.registerClientbound(ClientboundPackets1_9_3.BLOCK_ENTITY_DATA, new PacketHandlers() {
|
||||||
@Override
|
@Override
|
||||||
public void register() {
|
public void register() {
|
||||||
@ -305,7 +280,7 @@ public class BlockItemPackets1_11 extends LegacyBlockItemRewriter<ClientboundPac
|
|||||||
return tag;
|
return tag;
|
||||||
});
|
});
|
||||||
|
|
||||||
enchantmentRewriter = new LegacyEnchantmentRewriter(nbtTagName);
|
enchantmentRewriter = new LegacyEnchantmentRewriter(getNbtTagName());
|
||||||
enchantmentRewriter.registerEnchantment(71, "§cCurse of Vanishing");
|
enchantmentRewriter.registerEnchantment(71, "§cCurse of Vanishing");
|
||||||
enchantmentRewriter.registerEnchantment(10, "§cCurse of Binding");
|
enchantmentRewriter.registerEnchantment(10, "§cCurse of Binding");
|
||||||
|
|
||||||
@ -343,10 +318,10 @@ public class BlockItemPackets1_11 extends LegacyBlockItemRewriter<ClientboundPac
|
|||||||
// Rewrite spawn eggs (id checks are done in the method itself)
|
// Rewrite spawn eggs (id checks are done in the method itself)
|
||||||
EntityIdRewriter.toServerItem(item, true);
|
EntityIdRewriter.toServerItem(item, true);
|
||||||
|
|
||||||
if (tag.getListTag(nbtTagName + "|ench") != null) {
|
if (tag.getListTag(getNbtTagName() + "|ench") != null) {
|
||||||
enchantmentRewriter.rewriteEnchantmentsToServer(tag, false);
|
enchantmentRewriter.rewriteEnchantmentsToServer(tag, false);
|
||||||
}
|
}
|
||||||
if (tag.getListTag(nbtTagName + "|StoredEnchantments") != null) {
|
if (tag.getListTag(getNbtTagName() + "|StoredEnchantments") != null) {
|
||||||
enchantmentRewriter.rewriteEnchantmentsToServer(tag, true);
|
enchantmentRewriter.rewriteEnchantmentsToServer(tag, true);
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
|
@ -24,11 +24,9 @@ import com.viaversion.viabackwards.api.rewriters.LegacyEntityRewriter;
|
|||||||
import com.viaversion.viabackwards.protocol.protocol1_10to1_11.PotionSplashHandler;
|
import com.viaversion.viabackwards.protocol.protocol1_10to1_11.PotionSplashHandler;
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_10to1_11.Protocol1_10To1_11;
|
import com.viaversion.viabackwards.protocol.protocol1_10to1_11.Protocol1_10To1_11;
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_10to1_11.storage.ChestedHorseStorage;
|
import com.viaversion.viabackwards.protocol.protocol1_10to1_11.storage.ChestedHorseStorage;
|
||||||
import com.viaversion.viabackwards.utils.Block;
|
|
||||||
import com.viaversion.viaversion.api.data.entity.StoredEntityData;
|
import com.viaversion.viaversion.api.data.entity.StoredEntityData;
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_11;
|
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_11;
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_12;
|
|
||||||
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
|
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
|
||||||
import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_9;
|
import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_9;
|
||||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||||
@ -36,7 +34,6 @@ import com.viaversion.viaversion.api.type.Type;
|
|||||||
import com.viaversion.viaversion.api.type.types.version.Types1_9;
|
import com.viaversion.viaversion.api.type.types.version.Types1_9;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3;
|
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public class EntityPackets1_11 extends LegacyEntityRewriter<ClientboundPackets1_9_3, Protocol1_10To1_11> {
|
public class EntityPackets1_11 extends LegacyEntityRewriter<ClientboundPackets1_9_3, Protocol1_10To1_11> {
|
||||||
|
|
||||||
@ -86,21 +83,7 @@ public class EntityPackets1_11 extends LegacyEntityRewriter<ClientboundPackets1_
|
|||||||
handler(getObjectTrackerHandler());
|
handler(getObjectTrackerHandler());
|
||||||
handler(getObjectRewriter(id -> EntityTypes1_11.ObjectType.findById(id).orElse(null)));
|
handler(getObjectRewriter(id -> EntityTypes1_11.ObjectType.findById(id).orElse(null)));
|
||||||
|
|
||||||
// Handle FallingBlock blocks
|
handler(protocol.getItemRewriter().getFallingBlockHandler());
|
||||||
handler(wrapper -> {
|
|
||||||
Optional<EntityTypes1_12.ObjectType> type = EntityTypes1_12.ObjectType.findById(wrapper.get(Type.BYTE, 0));
|
|
||||||
if (type.isPresent() && type.get() == EntityTypes1_12.ObjectType.FALLING_BLOCK) {
|
|
||||||
int objectData = wrapper.get(Type.INT, 0);
|
|
||||||
int objType = objectData & 4095;
|
|
||||||
int data = objectData >> 12 & 15;
|
|
||||||
|
|
||||||
Block block = protocol.getItemRewriter().handleBlock(objType, data);
|
|
||||||
if (block == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
wrapper.set(Type.INT, 0, block.getId() | block.getData() << 12);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -43,11 +43,14 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
|||||||
public class BlockItemPackets1_12 extends LegacyBlockItemRewriter<ClientboundPackets1_12, ServerboundPackets1_9_3, Protocol1_11_1To1_12> {
|
public class BlockItemPackets1_12 extends LegacyBlockItemRewriter<ClientboundPackets1_12, ServerboundPackets1_9_3, Protocol1_11_1To1_12> {
|
||||||
|
|
||||||
public BlockItemPackets1_12(Protocol1_11_1To1_12 protocol) {
|
public BlockItemPackets1_12(Protocol1_11_1To1_12 protocol) {
|
||||||
super(protocol);
|
super(protocol, "1.12");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
|
registerBlockChange(ClientboundPackets1_12.BLOCK_CHANGE);
|
||||||
|
registerMultiBlockChange(ClientboundPackets1_12.MULTI_BLOCK_CHANGE);
|
||||||
|
|
||||||
protocol.registerClientbound(ClientboundPackets1_12.MAP_DATA, new PacketHandlers() {
|
protocol.registerClientbound(ClientboundPackets1_12.MAP_DATA, new PacketHandlers() {
|
||||||
@Override
|
@Override
|
||||||
public void register() {
|
public void register() {
|
||||||
@ -159,34 +162,6 @@ public class BlockItemPackets1_12 extends LegacyBlockItemRewriter<ClientboundPac
|
|||||||
handleChunk(chunk);
|
handleChunk(chunk);
|
||||||
});
|
});
|
||||||
|
|
||||||
protocol.registerClientbound(ClientboundPackets1_12.BLOCK_CHANGE, new PacketHandlers() {
|
|
||||||
@Override
|
|
||||||
public void register() {
|
|
||||||
map(Type.POSITION1_8); // 0 - Block Position
|
|
||||||
map(Type.VAR_INT); // 1 - Block
|
|
||||||
|
|
||||||
handler(wrapper -> {
|
|
||||||
int idx = wrapper.get(Type.VAR_INT, 0);
|
|
||||||
wrapper.set(Type.VAR_INT, 0, handleBlockID(idx));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
protocol.registerClientbound(ClientboundPackets1_12.MULTI_BLOCK_CHANGE, new PacketHandlers() {
|
|
||||||
@Override
|
|
||||||
public void register() {
|
|
||||||
map(Type.INT); // 0 - Chunk X
|
|
||||||
map(Type.INT); // 1 - Chunk Z
|
|
||||||
map(Type.BLOCK_CHANGE_RECORD_ARRAY);
|
|
||||||
|
|
||||||
handler(wrapper -> {
|
|
||||||
for (BlockChangeRecord record : wrapper.get(Type.BLOCK_CHANGE_RECORD_ARRAY, 0)) {
|
|
||||||
record.setBlockId(handleBlockID(record.getBlockId()));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
protocol.registerClientbound(ClientboundPackets1_12.BLOCK_ENTITY_DATA, new PacketHandlers() {
|
protocol.registerClientbound(ClientboundPackets1_12.BLOCK_ENTITY_DATA, new PacketHandlers() {
|
||||||
@Override
|
@Override
|
||||||
public void register() {
|
public void register() {
|
||||||
|
@ -22,7 +22,6 @@ import com.viaversion.viabackwards.api.rewriters.LegacyEntityRewriter;
|
|||||||
import com.viaversion.viabackwards.protocol.protocol1_11_1to1_12.Protocol1_11_1To1_12;
|
import com.viaversion.viabackwards.protocol.protocol1_11_1to1_12.Protocol1_11_1To1_12;
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_11_1to1_12.data.ParrotStorage;
|
import com.viaversion.viabackwards.protocol.protocol1_11_1to1_12.data.ParrotStorage;
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_11_1to1_12.data.ShoulderTracker;
|
import com.viaversion.viabackwards.protocol.protocol1_11_1to1_12.data.ShoulderTracker;
|
||||||
import com.viaversion.viabackwards.utils.Block;
|
|
||||||
import com.viaversion.viaversion.api.data.entity.StoredEntityData;
|
import com.viaversion.viaversion.api.data.entity.StoredEntityData;
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_12;
|
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_12;
|
||||||
@ -36,7 +35,6 @@ import com.viaversion.viaversion.libs.gson.JsonElement;
|
|||||||
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_12to1_11_1.ClientboundPackets1_12;
|
import com.viaversion.viaversion.protocols.protocol1_12to1_11_1.ClientboundPackets1_12;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3;
|
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3;
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public class EntityPackets1_12 extends LegacyEntityRewriter<ClientboundPackets1_12, Protocol1_11_1To1_12> {
|
public class EntityPackets1_12 extends LegacyEntityRewriter<ClientboundPackets1_12, Protocol1_11_1To1_12> {
|
||||||
|
|
||||||
@ -63,22 +61,7 @@ public class EntityPackets1_12 extends LegacyEntityRewriter<ClientboundPackets1_
|
|||||||
handler(getObjectTrackerHandler());
|
handler(getObjectTrackerHandler());
|
||||||
handler(getObjectRewriter(id -> EntityTypes1_12.ObjectType.findById(id).orElse(null)));
|
handler(getObjectRewriter(id -> EntityTypes1_12.ObjectType.findById(id).orElse(null)));
|
||||||
|
|
||||||
// Handle FallingBlock blocks
|
handler(protocol.getItemRewriter().getFallingBlockHandler());
|
||||||
handler(wrapper -> {
|
|
||||||
Optional<EntityTypes1_12.ObjectType> type = EntityTypes1_12.ObjectType.findById(wrapper.get(Type.BYTE, 0));
|
|
||||||
if (type.isPresent() && type.get() == EntityTypes1_12.ObjectType.FALLING_BLOCK) {
|
|
||||||
int objectData = wrapper.get(Type.INT, 0);
|
|
||||||
int objType = objectData & 4095;
|
|
||||||
int data = objectData >> 12 & 15;
|
|
||||||
|
|
||||||
Block block = protocol.getItemRewriter().handleBlock(objType, data);
|
|
||||||
if (block == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
wrapper.set(Type.INT, 0, block.getId() | block.getData() << 12);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public class ItemPackets1_11_1 extends LegacyBlockItemRewriter<ClientboundPacket
|
|||||||
private LegacyEnchantmentRewriter enchantmentRewriter;
|
private LegacyEnchantmentRewriter enchantmentRewriter;
|
||||||
|
|
||||||
public ItemPackets1_11_1(Protocol1_11To1_11_1 protocol) {
|
public ItemPackets1_11_1(Protocol1_11To1_11_1 protocol) {
|
||||||
super(protocol);
|
super(protocol, "1.11.1");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -84,7 +84,7 @@ public class ItemPackets1_11_1 extends LegacyBlockItemRewriter<ClientboundPacket
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerRewrites() {
|
protected void registerRewrites() {
|
||||||
enchantmentRewriter = new LegacyEnchantmentRewriter(nbtTagName);
|
enchantmentRewriter = new LegacyEnchantmentRewriter(getNbtTagName());
|
||||||
enchantmentRewriter.registerEnchantment(22, "§7Sweeping Edge");
|
enchantmentRewriter.registerEnchantment(22, "§7Sweeping Edge");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,10 +113,10 @@ public class ItemPackets1_11_1 extends LegacyBlockItemRewriter<ClientboundPacket
|
|||||||
CompoundTag tag = item.tag();
|
CompoundTag tag = item.tag();
|
||||||
if (tag == null) return item;
|
if (tag == null) return item;
|
||||||
|
|
||||||
if (tag.getListTag(nbtTagName + "|ench") != null) {
|
if (tag.getListTag(getNbtTagName() + "|ench") != null) {
|
||||||
enchantmentRewriter.rewriteEnchantmentsToServer(tag, false);
|
enchantmentRewriter.rewriteEnchantmentsToServer(tag, false);
|
||||||
}
|
}
|
||||||
if (tag.getListTag(nbtTagName + "|StoredEnchantments") != null) {
|
if (tag.getListTag(getNbtTagName() + "|StoredEnchantments") != null) {
|
||||||
enchantmentRewriter.rewriteEnchantmentsToServer(tag, true);
|
enchantmentRewriter.rewriteEnchantmentsToServer(tag, true);
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
|
@ -71,7 +71,7 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit
|
|||||||
|
|
||||||
public BlockItemPackets1_13(Protocol1_12_2To1_13 protocol) {
|
public BlockItemPackets1_13(Protocol1_12_2To1_13 protocol) {
|
||||||
super(protocol, null, null);
|
super(protocol, null, null);
|
||||||
extraNbtTag = "VB|" + protocol.getClass().getSimpleName() + "|2";
|
extraNbtTag = getNbtTagName() + "|2";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isDamageable(int id) {
|
public static boolean isDamageable(int id) {
|
||||||
|
@ -166,7 +166,7 @@ public final class BlockItemPackets1_20 extends ItemRewriter<ClientboundPackets1
|
|||||||
final String pattern = Key.stripMinecraftNamespace(patternTag.getValue());
|
final String pattern = Key.stripMinecraftNamespace(patternTag.getValue());
|
||||||
if (NEW_TRIM_PATTERNS.contains(pattern)) {
|
if (NEW_TRIM_PATTERNS.contains(pattern)) {
|
||||||
tag.remove("Trim");
|
tag.remove("Trim");
|
||||||
tag.put(nbtTagName + "|Trim", trimTag);
|
tag.put(getNbtTagName() + "|Trim", trimTag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -184,7 +184,7 @@ public final class BlockItemPackets1_20 extends ItemRewriter<ClientboundPackets1
|
|||||||
// Add back original trim tag
|
// Add back original trim tag
|
||||||
final Tag trimTag;
|
final Tag trimTag;
|
||||||
final CompoundTag tag = item.tag();
|
final CompoundTag tag = item.tag();
|
||||||
if (tag != null && (trimTag = tag.remove(nbtTagName + "|Trim")) != null) {
|
if (tag != null && (trimTag = tag.remove(getNbtTagName() + "|Trim")) != null) {
|
||||||
tag.put("Trim", trimTag);
|
tag.put("Trim", trimTag);
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
|
@ -33,11 +33,14 @@ import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ServerboundPac
|
|||||||
public class BlockItemPackets1_10 extends LegacyBlockItemRewriter<ClientboundPackets1_9_3, ServerboundPackets1_9_3, Protocol1_9_4To1_10> {
|
public class BlockItemPackets1_10 extends LegacyBlockItemRewriter<ClientboundPackets1_9_3, ServerboundPackets1_9_3, Protocol1_9_4To1_10> {
|
||||||
|
|
||||||
public BlockItemPackets1_10(Protocol1_9_4To1_10 protocol) {
|
public BlockItemPackets1_10(Protocol1_9_4To1_10 protocol) {
|
||||||
super(protocol);
|
super(protocol, "1.10");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
|
registerBlockChange(ClientboundPackets1_9_3.BLOCK_CHANGE);
|
||||||
|
registerMultiBlockChange(ClientboundPackets1_9_3.MULTI_BLOCK_CHANGE);
|
||||||
|
|
||||||
registerSetSlot(ClientboundPackets1_9_3.SET_SLOT);
|
registerSetSlot(ClientboundPackets1_9_3.SET_SLOT);
|
||||||
registerWindowItems(ClientboundPackets1_9_3.WINDOW_ITEMS);
|
registerWindowItems(ClientboundPackets1_9_3.WINDOW_ITEMS);
|
||||||
|
|
||||||
@ -83,36 +86,6 @@ public class BlockItemPackets1_10 extends LegacyBlockItemRewriter<ClientboundPac
|
|||||||
handleChunk(chunk);
|
handleChunk(chunk);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Block Change Packet
|
|
||||||
protocol.registerClientbound(ClientboundPackets1_9_3.BLOCK_CHANGE, new PacketHandlers() {
|
|
||||||
@Override
|
|
||||||
public void register() {
|
|
||||||
map(Type.POSITION1_8); // 0 - Block Position
|
|
||||||
map(Type.VAR_INT); // 1 - Block
|
|
||||||
|
|
||||||
handler(wrapper -> {
|
|
||||||
int idx = wrapper.get(Type.VAR_INT, 0);
|
|
||||||
wrapper.set(Type.VAR_INT, 0, handleBlockID(idx));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Multi Block Change Packet
|
|
||||||
protocol.registerClientbound(ClientboundPackets1_9_3.MULTI_BLOCK_CHANGE, new PacketHandlers() {
|
|
||||||
@Override
|
|
||||||
public void register() {
|
|
||||||
map(Type.INT); // 0 - Chunk X
|
|
||||||
map(Type.INT); // 1 - Chunk Z
|
|
||||||
map(Type.BLOCK_CHANGE_RECORD_ARRAY);
|
|
||||||
|
|
||||||
handler(wrapper -> {
|
|
||||||
for (BlockChangeRecord record : wrapper.get(Type.BLOCK_CHANGE_RECORD_ARRAY, 0)) {
|
|
||||||
record.setBlockId(handleBlockID(record.getBlockId()));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Rewrite metadata items
|
// Rewrite metadata items
|
||||||
protocol.getEntityRewriter().filter().handler((event, meta) -> {
|
protocol.getEntityRewriter().filter().handler((event, meta) -> {
|
||||||
if (meta.metaType().type().equals(Type.ITEM1_8)) // Is Item
|
if (meta.metaType().type().equals(Type.ITEM1_8)) // Is Item
|
||||||
|
@ -22,11 +22,9 @@ import com.viaversion.viabackwards.api.entities.storage.EntityData;
|
|||||||
import com.viaversion.viabackwards.api.entities.storage.WrappedMetadata;
|
import com.viaversion.viabackwards.api.entities.storage.WrappedMetadata;
|
||||||
import com.viaversion.viabackwards.api.rewriters.LegacyEntityRewriter;
|
import com.viaversion.viabackwards.api.rewriters.LegacyEntityRewriter;
|
||||||
import com.viaversion.viabackwards.protocol.protocol1_9_4to1_10.Protocol1_9_4To1_10;
|
import com.viaversion.viabackwards.protocol.protocol1_9_4to1_10.Protocol1_9_4To1_10;
|
||||||
import com.viaversion.viabackwards.utils.Block;
|
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_10;
|
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_10;
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_11;
|
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_11;
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_12;
|
|
||||||
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
|
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
|
||||||
import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_9;
|
import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_9;
|
||||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||||
@ -34,7 +32,6 @@ import com.viaversion.viaversion.api.type.Type;
|
|||||||
import com.viaversion.viaversion.api.type.types.version.Types1_9;
|
import com.viaversion.viaversion.api.type.types.version.Types1_9;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3;
|
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.ClientboundPackets1_9_3;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public class EntityPackets1_10 extends LegacyEntityRewriter<ClientboundPackets1_9_3, Protocol1_9_4To1_10> {
|
public class EntityPackets1_10 extends LegacyEntityRewriter<ClientboundPackets1_9_3, Protocol1_9_4To1_10> {
|
||||||
|
|
||||||
@ -61,21 +58,7 @@ public class EntityPackets1_10 extends LegacyEntityRewriter<ClientboundPackets1_
|
|||||||
handler(getObjectTrackerHandler());
|
handler(getObjectTrackerHandler());
|
||||||
handler(getObjectRewriter(id -> EntityTypes1_11.ObjectType.findById(id).orElse(null)));
|
handler(getObjectRewriter(id -> EntityTypes1_11.ObjectType.findById(id).orElse(null)));
|
||||||
|
|
||||||
// Handle FallingBlock blocks
|
handler(protocol.getItemRewriter().getFallingBlockHandler());
|
||||||
handler(wrapper -> {
|
|
||||||
Optional<EntityTypes1_12.ObjectType> type = EntityTypes1_12.ObjectType.findById(wrapper.get(Type.BYTE, 0));
|
|
||||||
if (type.isPresent() && type.get() == EntityTypes1_12.ObjectType.FALLING_BLOCK) {
|
|
||||||
int objectData = wrapper.get(Type.INT, 0);
|
|
||||||
int objType = objectData & 4095;
|
|
||||||
int data = objectData >> 12 & 15;
|
|
||||||
|
|
||||||
Block block = protocol.getItemRewriter().handleBlock(objType, data);
|
|
||||||
if (block == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
wrapper.set(Type.INT, 0, block.getId() | block.getData() << 12);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"255": {
|
||||||
|
"id": 217,
|
||||||
|
"name": "1.10 Structure Block"
|
||||||
|
},
|
||||||
|
"217": {
|
||||||
|
"id": 287,
|
||||||
|
"name": "1.10 Structure Void",
|
||||||
|
"block": true
|
||||||
|
},
|
||||||
|
"213": {
|
||||||
|
"id": 159,
|
||||||
|
"data": 1,
|
||||||
|
"name": "1.10 Magma Block",
|
||||||
|
"block": true
|
||||||
|
},
|
||||||
|
"214": {
|
||||||
|
"id": 159,
|
||||||
|
"data": 14,
|
||||||
|
"name": "1.10 Nether Wart Block",
|
||||||
|
"block": true
|
||||||
|
},
|
||||||
|
"215": {
|
||||||
|
"id": 112,
|
||||||
|
"name": "1.10 Red Nether Bricks",
|
||||||
|
"block": true
|
||||||
|
},
|
||||||
|
"216": {
|
||||||
|
"id": 155,
|
||||||
|
"name": "1.10 Bone Block",
|
||||||
|
"block": true
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"452": {
|
||||||
|
"id": 265,
|
||||||
|
"name": "1.11.1 Iron Nugget"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"218": {
|
||||||
|
"id": 23,
|
||||||
|
"data": -1,
|
||||||
|
"name": "1.11 Observer",
|
||||||
|
"block": true
|
||||||
|
},
|
||||||
|
"449": {
|
||||||
|
"id": 418,
|
||||||
|
"name": "1.11 Totem of Undying"
|
||||||
|
},
|
||||||
|
"450": {
|
||||||
|
"id": 433,
|
||||||
|
"name": "1.11 Shulker Shell"
|
||||||
|
},
|
||||||
|
"219-234": {
|
||||||
|
"id": 158,
|
||||||
|
"name": "1.11 %color% Shulker Box",
|
||||||
|
"block": true
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"251": {
|
||||||
|
"id": 159,
|
||||||
|
"data": -1,
|
||||||
|
"name": "1.12 %vb_color% Concrete",
|
||||||
|
"block": true
|
||||||
|
},
|
||||||
|
"252": {
|
||||||
|
"id": 35,
|
||||||
|
"data": -1,
|
||||||
|
"name": "1.12 %vb_color% Concrete Powder",
|
||||||
|
"block": true
|
||||||
|
},
|
||||||
|
"453": {
|
||||||
|
"id": 340,
|
||||||
|
"name": "1.12 Knowledge Book"
|
||||||
|
},
|
||||||
|
"355": {
|
||||||
|
"id": 355,
|
||||||
|
"name": "1.12 %vb_color% Bed"
|
||||||
|
},
|
||||||
|
"235-250": {
|
||||||
|
"id": 159,
|
||||||
|
"name": "1.12 %color% Glazed Terracotta",
|
||||||
|
"block": true
|
||||||
|
}
|
||||||
|
}
|
@ -1,89 +0,0 @@
|
|||||||
{
|
|
||||||
"1.12": {
|
|
||||||
"251": {
|
|
||||||
"id": 159,
|
|
||||||
"data": -1,
|
|
||||||
"name": "1.12 %vb_color% Concrete",
|
|
||||||
"block": true
|
|
||||||
},
|
|
||||||
"252": {
|
|
||||||
"id": 35,
|
|
||||||
"data": -1,
|
|
||||||
"name": "1.12 %vb_color% Concrete Powder",
|
|
||||||
"block": true
|
|
||||||
},
|
|
||||||
"453": {
|
|
||||||
"id": 340,
|
|
||||||
"name": "1.12 Knowledge Book"
|
|
||||||
},
|
|
||||||
"355": {
|
|
||||||
"id": 355,
|
|
||||||
"name": "1.12 %vb_color% Bed"
|
|
||||||
},
|
|
||||||
"235-250": {
|
|
||||||
"id": 159,
|
|
||||||
"name": "1.12 %color% Glazed Terracotta",
|
|
||||||
"block": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"1.11.1": {
|
|
||||||
"452": {
|
|
||||||
"id": 265,
|
|
||||||
"name": "1.11.1 Iron Nugget"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"1.11": {
|
|
||||||
"218": {
|
|
||||||
"id": 23,
|
|
||||||
"data": -1,
|
|
||||||
"name": "1.11 Observer",
|
|
||||||
"block": true
|
|
||||||
},
|
|
||||||
"449": {
|
|
||||||
"id": 418,
|
|
||||||
"name": "1.11 Totem of Undying"
|
|
||||||
},
|
|
||||||
"450": {
|
|
||||||
"id": 433,
|
|
||||||
"name": "1.11 Shulker Shell"
|
|
||||||
},
|
|
||||||
"219-234": {
|
|
||||||
"id": 158,
|
|
||||||
"name": "1.11 %color% Shulker Box",
|
|
||||||
"block": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"1.10": {
|
|
||||||
"255": {
|
|
||||||
"id": 217,
|
|
||||||
"name": "1.10 Structure Block"
|
|
||||||
},
|
|
||||||
"217": {
|
|
||||||
"id": 287,
|
|
||||||
"name": "1.10 Structure Void",
|
|
||||||
"block": true
|
|
||||||
},
|
|
||||||
"213": {
|
|
||||||
"id": 159,
|
|
||||||
"data": 1,
|
|
||||||
"name": "1.10 Magma Block",
|
|
||||||
"block": true
|
|
||||||
},
|
|
||||||
"214": {
|
|
||||||
"id": 159,
|
|
||||||
"data": 14,
|
|
||||||
"name": "1.10 Nether Wart Block",
|
|
||||||
"block": true
|
|
||||||
},
|
|
||||||
"215": {
|
|
||||||
"id": 112,
|
|
||||||
"name": "1.10 Red Nether Bricks",
|
|
||||||
"block": true
|
|
||||||
},
|
|
||||||
"216": {
|
|
||||||
"id": 155,
|
|
||||||
"name": "1.10 Bone Block",
|
|
||||||
"block": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren