Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-09-07 13:22:54 +02:00
Map biomes
Dieser Commit ist enthalten in:
Ursprung
1e455b0391
Commit
45aab8f9f2
@ -0,0 +1,36 @@
|
||||
package nl.matsv.viabackwards.protocol.protocol1_16_1to1_16_2.data;
|
||||
import nl.matsv.viabackwards.ViaBackwards;
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.data.BiomeMappings;
|
||||
import us.myles.viaversion.libs.fastutil.ints.Int2IntMap;
|
||||
import us.myles.viaversion.libs.fastutil.ints.Int2IntOpenHashMap;
|
||||
|
||||
public class BackwardsBiomeMappings {
|
||||
|
||||
private static final Int2IntMap BIOMES = new Int2IntOpenHashMap();
|
||||
private static final int HIGHEST_VANILLA_BIOME;
|
||||
|
||||
static {
|
||||
int lastBiome = 0;
|
||||
for (Int2IntMap.Entry entry : BiomeMappings.getBiomes().int2IntEntrySet()) {
|
||||
int newBiome = entry.getIntValue();
|
||||
BIOMES.put(newBiome, entry.getIntKey());
|
||||
if (newBiome > lastBiome) {
|
||||
lastBiome = newBiome;
|
||||
}
|
||||
}
|
||||
|
||||
HIGHEST_VANILLA_BIOME = lastBiome;
|
||||
}
|
||||
|
||||
public static int getOldBiomeId(int biomeId) {
|
||||
if (biomeId > HIGHEST_VANILLA_BIOME) {
|
||||
if (!Via.getConfig().isSuppressConversionWarnings()) {
|
||||
ViaBackwards.getPlatform().getLogger().warning("Custom biome id could not be mapped: " + biomeId);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return BIOMES.getOrDefault(biomeId, biomeId);
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ package nl.matsv.viabackwards.protocol.protocol1_16_1to1_16_2.packets;
|
||||
import nl.matsv.viabackwards.ViaBackwards;
|
||||
import nl.matsv.viabackwards.api.rewriters.TranslatableRewriter;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_16_1to1_16_2.Protocol1_16_1To1_16_2;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_16_1to1_16_2.data.BackwardsBiomeMappings;
|
||||
import nl.matsv.viabackwards.protocol.protocol1_16_1to1_16_2.data.BackwardsMappings;
|
||||
import us.myles.ViaVersion.api.minecraft.BlockChangeRecord;
|
||||
import us.myles.ViaVersion.api.minecraft.BlockChangeRecord1_8;
|
||||
@ -71,7 +72,13 @@ public class BlockItemPackets1_16_2 extends nl.matsv.viabackwards.api.rewriters.
|
||||
Chunk chunk = wrapper.read(new Chunk1_16_2Type(clientWorld));
|
||||
wrapper.write(new Chunk1_16Type(clientWorld), chunk);
|
||||
|
||||
//TODO handle biome ids
|
||||
if (chunk.isBiomeData()) {
|
||||
int[] biomes = chunk.getBiomeData();
|
||||
for (int i = 0; i < biomes.length; i++) {
|
||||
int biome = biomes[i];
|
||||
biomes[i] = BackwardsBiomeMappings.getOldBiomeId(biome);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < chunk.getSections().length; i++) {
|
||||
ChunkSection section = chunk.getSections()[i];
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren