mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
1.18 does not have its own block palette
Our logic to finding block palettes was just borked.
This commit is contained in:
parent
a305c22665
commit
9ba1efaa30
4 changed files with 12 additions and 10 deletions
|
@ -65,7 +65,7 @@ import java.util.Set;
|
|||
/**
|
||||
* Holds all the common registries in Geyser.
|
||||
*/
|
||||
public class Registries {
|
||||
public final class Registries {
|
||||
/**
|
||||
* A registry holding a CompoundTag of the known entity identifiers.
|
||||
*/
|
||||
|
|
|
@ -55,17 +55,21 @@ public class VersionedRegistry<V> extends AbstractMappedRegistry<Integer, V, Int
|
|||
* @return the closest value for the specified version
|
||||
*/
|
||||
public V forVersion(int version) {
|
||||
V value = null;
|
||||
Int2ObjectMap.Entry<V> current = null;
|
||||
for (Int2ObjectMap.Entry<V> entry : this.mappings.int2ObjectEntrySet()) {
|
||||
if (version < entry.getIntKey()) {
|
||||
int currentVersion = entry.getIntKey();
|
||||
if (version < currentVersion) {
|
||||
continue;
|
||||
}
|
||||
if (version == entry.getIntKey()) {
|
||||
if (version == currentVersion) {
|
||||
return entry.getValue();
|
||||
}
|
||||
value = entry.getValue();
|
||||
if (current == null || current.getIntKey() < currentVersion) {
|
||||
// This version is newer and should be prioritized
|
||||
current = entry;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
return current == null ? null : current.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,7 +30,6 @@ import com.google.common.collect.ImmutableMap;
|
|||
import com.nukkitx.nbt.*;
|
||||
import com.nukkitx.protocol.bedrock.v465.Bedrock_v465;
|
||||
import com.nukkitx.protocol.bedrock.v471.Bedrock_v471;
|
||||
import com.nukkitx.protocol.bedrock.v475.Bedrock_v475;
|
||||
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
||||
import it.unimi.dsi.fastutil.ints.IntSet;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
|
@ -39,12 +38,12 @@ import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
|||
import it.unimi.dsi.fastutil.objects.ObjectIntPair;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.level.block.BlockStateValues;
|
||||
import org.geysermc.geyser.level.physics.PistonBehavior;
|
||||
import org.geysermc.geyser.registry.BlockRegistries;
|
||||
import org.geysermc.geyser.registry.type.BlockMapping;
|
||||
import org.geysermc.geyser.registry.type.BlockMappings;
|
||||
import org.geysermc.geyser.util.BlockUtils;
|
||||
import org.geysermc.geyser.util.FileUtils;
|
||||
import org.geysermc.geyser.level.physics.PistonBehavior;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.InputStream;
|
||||
|
@ -65,8 +64,7 @@ public class BlockRegistryPopulator {
|
|||
static {
|
||||
ImmutableMap.Builder<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>> stateMapperBuilder = ImmutableMap.<ObjectIntPair<String>, BiFunction<String, NbtMapBuilder, String>>builder()
|
||||
.put(ObjectIntPair.of("1_17_30", Bedrock_v465.V465_CODEC.getProtocolVersion()), EMPTY_MAPPER)
|
||||
.put(ObjectIntPair.of("1_17_40", Bedrock_v471.V471_CODEC.getProtocolVersion()), EMPTY_MAPPER)
|
||||
.put(ObjectIntPair.of("1_18_0", Bedrock_v475.V475_CODEC.getProtocolVersion()), EMPTY_MAPPER);
|
||||
.put(ObjectIntPair.of("1_17_40", Bedrock_v471.V471_CODEC.getProtocolVersion()), EMPTY_MAPPER);
|
||||
|
||||
BLOCK_MAPPERS = stateMapperBuilder.build();
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue