mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2024-09-06 01:08:08 +02:00
impl first block id remaps
This commit is contained in:
parent
d64e75d374
commit
c2d72214de
@ -16,6 +16,7 @@ import us.myles.ViaVersion.api.remapper.PacketHandler;
|
|||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.packets.State;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.data.MappingData;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@ -266,14 +267,25 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int getNewBlockStateId(int id) {
|
public static int getNewBlockStateId(int id) {
|
||||||
int newId = BackwardsMappings.blockMappings.getNewBlock(id);
|
int newId = BackwardsMappings.blockStateMappings.getNewBlock(id);
|
||||||
if (newId == -1) {
|
if (newId == -1) {
|
||||||
ViaBackwards.getPlatform().getLogger().warning("Missing 1.14 block for 1.13.2 block " + id);
|
ViaBackwards.getPlatform().getLogger().warning("Missing 1.14 blockstate id for 1.13.2 block " + id);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return newId;
|
return newId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static int getNewBlockId(int id) {
|
||||||
|
int newId = BackwardsMappings.blockMappings.getNewBlock(id);
|
||||||
|
if (newId == -1) {
|
||||||
|
ViaBackwards.getPlatform().getLogger().warning("Missing 1.14 block id for 1.13.2 block " + id);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return newId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(UserConnection user) {
|
public void init(UserConnection user) {
|
||||||
// Register ClientWorld
|
// Register ClientWorld
|
||||||
|
@ -14,6 +14,7 @@ import java.util.Arrays;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class BackwardsMappings {
|
public class BackwardsMappings {
|
||||||
|
public static BlockMappings blockStateMappings;
|
||||||
public static BlockMappings blockMappings;
|
public static BlockMappings blockMappings;
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
@ -22,7 +23,8 @@ public class BackwardsMappings {
|
|||||||
JsonObject mapping1_13_2to1_14 = loadData("mapping-1.13.2to1.14.json");
|
JsonObject mapping1_13_2to1_14 = loadData("mapping-1.13.2to1.14.json");
|
||||||
|
|
||||||
ViaBackwards.getPlatform().getLogger().info("Loading 1.14 -> 1.13.2 block mapping...");
|
ViaBackwards.getPlatform().getLogger().info("Loading 1.14 -> 1.13.2 block mapping...");
|
||||||
blockMappings = new BlockMappingsShortArray(mapping1_14.getAsJsonObject("blockstates"), mapping1_13_2.getAsJsonObject("blockstates"), mapping1_13_2to1_14.getAsJsonObject("blockstates"));
|
blockStateMappings = new BlockMappingsShortArray(mapping1_14.getAsJsonObject("blockstates"), mapping1_13_2.getAsJsonObject("blockstates"), mapping1_13_2to1_14.getAsJsonObject("blockstates"));
|
||||||
|
blockMappings = new BlockMappingsShortArray(mapping1_14.getAsJsonObject("blocks"), mapping1_13_2.getAsJsonObject("blocks"), mapping1_13_2to1_14.getAsJsonObject("blocks"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -449,7 +449,7 @@ public class BlockItemPackets1_14 extends BlockItemRewriter<Protocol1_13_2To1_14
|
|||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
wrapper.set(Type.VAR_INT, 0, Protocol1_13_2To1_14.getNewBlockStateId(wrapper.get(Type.VAR_INT, 0)));
|
wrapper.set(Type.VAR_INT, 0, Protocol1_13_2To1_14.getNewBlockId(wrapper.get(Type.VAR_INT, 0)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user