Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-12-26 00:00:33 +01:00
impl first block id remaps
Dieser Commit ist enthalten in:
Ursprung
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.type.Type;
|
||||
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;
|
||||
|
||||
@Getter
|
||||
@ -266,14 +267,25 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol {
|
||||
}
|
||||
|
||||
public static int getNewBlockStateId(int id) {
|
||||
int newId = BackwardsMappings.blockMappings.getNewBlock(id);
|
||||
int newId = BackwardsMappings.blockStateMappings.getNewBlock(id);
|
||||
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 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
|
||||
public void init(UserConnection user) {
|
||||
// Register ClientWorld
|
||||
|
@ -14,6 +14,7 @@ import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
public class BackwardsMappings {
|
||||
public static BlockMappings blockStateMappings;
|
||||
public static BlockMappings blockMappings;
|
||||
|
||||
public static void init() {
|
||||
@ -22,7 +23,8 @@ public class BackwardsMappings {
|
||||
JsonObject mapping1_13_2to1_14 = loadData("mapping-1.13.2to1.14.json");
|
||||
|
||||
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() {
|
||||
@Override
|
||||
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)));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren