Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-19 22:40:18 +01:00
Address @Camotoy's review
Signed-off-by: Joshua Castle <26531652+Kas-tle@users.noreply.github.com>
Dieser Commit ist enthalten in:
Ursprung
2efdce481c
Commit
b2d9095815
@ -31,5 +31,4 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
|||||||
* This class is used to store a material instance for a custom block.
|
* This class is used to store a material instance for a custom block.
|
||||||
*/
|
*/
|
||||||
public record MaterialInstance(@NonNull String texture, @NonNull String renderMethod, boolean faceDimming, boolean ambientOcclusion) {
|
public record MaterialInstance(@NonNull String texture, @NonNull String renderMethod, boolean faceDimming, boolean ambientOcclusion) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,5 +33,4 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
|||||||
* This class is used to store a placement filter for a custom block.
|
* This class is used to store a placement filter for a custom block.
|
||||||
*/
|
*/
|
||||||
public record PlacementFilter(@NonNull List<Conditions> conditions) {
|
public record PlacementFilter(@NonNull List<Conditions> conditions) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,6 @@
|
|||||||
|
|
||||||
package org.geysermc.geyser.api.block.custom.property;
|
package org.geysermc.geyser.api.block.custom.property;
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is used to define a custom block property's type.
|
* This class is used to define a custom block property's type.
|
||||||
*/
|
*/
|
||||||
@ -35,9 +33,12 @@ public class PropertyType {
|
|||||||
public static final PropertyType INTEGER = new PropertyType(Integer.class);
|
public static final PropertyType INTEGER = new PropertyType(Integer.class);
|
||||||
public static final PropertyType STRING = new PropertyType(String.class);
|
public static final PropertyType STRING = new PropertyType(String.class);
|
||||||
|
|
||||||
@Getter
|
|
||||||
private final Class<?> typeClass;
|
private final Class<?> typeClass;
|
||||||
|
|
||||||
|
public Class<?> getTypeClass() {
|
||||||
|
return typeClass;
|
||||||
|
}
|
||||||
|
|
||||||
private PropertyType(Class<?> typeClass) {
|
private PropertyType(Class<?> typeClass) {
|
||||||
this.typeClass = typeClass;
|
this.typeClass = typeClass;
|
||||||
}
|
}
|
||||||
|
@ -93,10 +93,6 @@ public interface GeyserConfiguration {
|
|||||||
|
|
||||||
boolean isAddNonBedrockItems();
|
boolean isAddNonBedrockItems();
|
||||||
|
|
||||||
boolean isAddCustomBlocks();
|
|
||||||
|
|
||||||
boolean isAddCustomSkullBlocks();
|
|
||||||
|
|
||||||
boolean isAboveBedrockNetherBuilding();
|
boolean isAboveBedrockNetherBuilding();
|
||||||
|
|
||||||
boolean isForceResourcePacks();
|
boolean isForceResourcePacks();
|
||||||
|
@ -142,12 +142,6 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration
|
|||||||
@JsonProperty("above-bedrock-nether-building")
|
@JsonProperty("above-bedrock-nether-building")
|
||||||
private boolean aboveBedrockNetherBuilding = false;
|
private boolean aboveBedrockNetherBuilding = false;
|
||||||
|
|
||||||
@JsonProperty("add-custom-blocks")
|
|
||||||
boolean addCustomBlocks = true;
|
|
||||||
|
|
||||||
@JsonProperty("add-custom-skull-blocks")
|
|
||||||
boolean addCustomSkullBlocks = false;
|
|
||||||
|
|
||||||
@JsonProperty("force-resource-packs")
|
@JsonProperty("force-resource-packs")
|
||||||
private boolean forceResourcePacks = true;
|
private boolean forceResourcePacks = true;
|
||||||
|
|
||||||
@ -347,10 +341,6 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration
|
|||||||
@JsonProperty("config-version")
|
@JsonProperty("config-version")
|
||||||
private int configVersion = 0;
|
private int configVersion = 0;
|
||||||
|
|
||||||
public boolean isAddCustomSkullBlocks() {
|
|
||||||
return addCustomBlocks && addCustomSkullBlocks;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensure that the port deserializes in the config as a number no matter what.
|
* Ensure that the port deserializes in the config as a number no matter what.
|
||||||
*/
|
*/
|
||||||
|
@ -25,10 +25,11 @@
|
|||||||
|
|
||||||
package org.geysermc.geyser.level.block;
|
package org.geysermc.geyser.level.block;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap;
|
||||||
import java.util.Map;
|
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
|
||||||
import java.util.Set;
|
import it.unimi.dsi.fastutil.objects.Object2ObjectMaps;
|
||||||
|
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||||
|
import lombok.Value;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.geysermc.geyser.api.block.custom.component.BoxComponent;
|
import org.geysermc.geyser.api.block.custom.component.BoxComponent;
|
||||||
import org.geysermc.geyser.api.block.custom.component.CustomBlockComponents;
|
import org.geysermc.geyser.api.block.custom.component.CustomBlockComponents;
|
||||||
@ -37,11 +38,9 @@ import org.geysermc.geyser.api.block.custom.component.RotationComponent;
|
|||||||
import org.geysermc.geyser.api.block.custom.component.placementfilter.PlacementFilter;
|
import org.geysermc.geyser.api.block.custom.component.placementfilter.PlacementFilter;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap;
|
import java.util.HashSet;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
|
import java.util.Map;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectMaps;
|
import java.util.Set;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
|
||||||
import lombok.Value;
|
|
||||||
|
|
||||||
@Value
|
@Value
|
||||||
public class GeyserCustomBlockComponents implements CustomBlockComponents {
|
public class GeyserCustomBlockComponents implements CustomBlockComponents {
|
||||||
|
@ -73,7 +73,7 @@ public class SkullResourcePackManager {
|
|||||||
|
|
||||||
Path packPath = cachePath.resolve("player_skulls.mcpack");
|
Path packPath = cachePath.resolve("player_skulls.mcpack");
|
||||||
File packFile = packPath.toFile();
|
File packFile = packPath.toFile();
|
||||||
if (BlockRegistries.CUSTOM_SKULLS.get().isEmpty() || !GeyserImpl.getInstance().getConfig().isAddCustomSkullBlocks()) {
|
if (BlockRegistries.CUSTOM_SKULLS.get().isEmpty() || !GeyserImpl.getInstance().getConfig().isAddNonBedrockItems()) {
|
||||||
packFile.delete(); // No need to keep resource pack
|
packFile.delete(); // No need to keep resource pack
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,6 @@ import com.nukkitx.nbt.NbtMapBuilder;
|
|||||||
import com.nukkitx.protocol.bedrock.BedrockPacket;
|
import com.nukkitx.protocol.bedrock.BedrockPacket;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.CraftingData;
|
import com.nukkitx.protocol.bedrock.data.inventory.CraftingData;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.PotionMixData;
|
import com.nukkitx.protocol.bedrock.data.inventory.PotionMixData;
|
||||||
|
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||||
@ -44,7 +43,16 @@ import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
|||||||
import org.geysermc.geyser.entity.EntityDefinition;
|
import org.geysermc.geyser.entity.EntityDefinition;
|
||||||
import org.geysermc.geyser.inventory.item.Enchantment.JavaEnchantment;
|
import org.geysermc.geyser.inventory.item.Enchantment.JavaEnchantment;
|
||||||
import org.geysermc.geyser.inventory.recipe.GeyserRecipe;
|
import org.geysermc.geyser.inventory.recipe.GeyserRecipe;
|
||||||
import org.geysermc.geyser.registry.loader.*;
|
import org.geysermc.geyser.registry.loader.BiomeIdentifierRegistryLoader;
|
||||||
|
import org.geysermc.geyser.registry.loader.BlockEntityRegistryLoader;
|
||||||
|
import org.geysermc.geyser.registry.loader.EnchantmentRegistryLoader;
|
||||||
|
import org.geysermc.geyser.registry.loader.ParticleTypesRegistryLoader;
|
||||||
|
import org.geysermc.geyser.registry.loader.PotionMixRegistryLoader;
|
||||||
|
import org.geysermc.geyser.registry.loader.ProviderRegistryLoader;
|
||||||
|
import org.geysermc.geyser.registry.loader.RegistryLoaders;
|
||||||
|
import org.geysermc.geyser.registry.loader.SoundEventsRegistryLoader;
|
||||||
|
import org.geysermc.geyser.registry.loader.SoundRegistryLoader;
|
||||||
|
import org.geysermc.geyser.registry.loader.SoundTranslatorRegistryLoader;
|
||||||
import org.geysermc.geyser.registry.populator.ItemRegistryPopulator;
|
import org.geysermc.geyser.registry.populator.ItemRegistryPopulator;
|
||||||
import org.geysermc.geyser.registry.populator.PacketRegistryPopulator;
|
import org.geysermc.geyser.registry.populator.PacketRegistryPopulator;
|
||||||
import org.geysermc.geyser.registry.populator.RecipeRegistryPopulator;
|
import org.geysermc.geyser.registry.populator.RecipeRegistryPopulator;
|
||||||
@ -58,7 +66,11 @@ import org.geysermc.geyser.translator.level.event.LevelEventTranslator;
|
|||||||
import org.geysermc.geyser.translator.sound.SoundInteractionTranslator;
|
import org.geysermc.geyser.translator.sound.SoundInteractionTranslator;
|
||||||
import org.geysermc.geyser.translator.sound.SoundTranslator;
|
import org.geysermc.geyser.translator.sound.SoundTranslator;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.EnumMap;
|
||||||
|
import java.util.IdentityHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds all the common registries in Geyser.
|
* Holds all the common registries in Geyser.
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
package org.geysermc.geyser.registry.mappings.versions;
|
package org.geysermc.geyser.registry.mappings.versions;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
|
||||||
import org.geysermc.geyser.api.item.custom.CustomItemData;
|
import org.geysermc.geyser.api.item.custom.CustomItemData;
|
||||||
import org.geysermc.geyser.api.item.custom.CustomRenderOffsets;
|
import org.geysermc.geyser.api.item.custom.CustomRenderOffsets;
|
||||||
import org.geysermc.geyser.item.exception.InvalidCustomMappingsFileException;
|
import org.geysermc.geyser.item.exception.InvalidCustomMappingsFileException;
|
||||||
|
@ -25,28 +25,6 @@
|
|||||||
|
|
||||||
package org.geysermc.geyser.registry.populator;
|
package org.geysermc.geyser.registry.populator;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.util.ArrayDeque;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Deque;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
import java.util.zip.GZIPInputStream;
|
|
||||||
|
|
||||||
import org.geysermc.geyser.GeyserImpl;
|
|
||||||
import org.geysermc.geyser.api.block.custom.CustomBlockData;
|
|
||||||
import org.geysermc.geyser.api.block.custom.CustomBlockState;
|
|
||||||
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 com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
@ -58,7 +36,6 @@ import com.nukkitx.nbt.NbtType;
|
|||||||
import com.nukkitx.protocol.bedrock.data.BlockPropertyData;
|
import com.nukkitx.protocol.bedrock.data.BlockPropertyData;
|
||||||
import com.nukkitx.protocol.bedrock.v544.Bedrock_v544;
|
import com.nukkitx.protocol.bedrock.v544.Bedrock_v544;
|
||||||
import com.nukkitx.protocol.bedrock.v560.Bedrock_v560;
|
import com.nukkitx.protocol.bedrock.v560.Bedrock_v560;
|
||||||
|
|
||||||
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
||||||
import it.unimi.dsi.fastutil.ints.IntSet;
|
import it.unimi.dsi.fastutil.ints.IntSet;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||||
@ -66,6 +43,27 @@ import it.unimi.dsi.fastutil.objects.Object2IntMaps;
|
|||||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||||
import it.unimi.dsi.fastutil.objects.ObjectIntPair;
|
import it.unimi.dsi.fastutil.objects.ObjectIntPair;
|
||||||
|
import org.geysermc.geyser.GeyserImpl;
|
||||||
|
import org.geysermc.geyser.api.block.custom.CustomBlockData;
|
||||||
|
import org.geysermc.geyser.api.block.custom.CustomBlockState;
|
||||||
|
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 java.io.DataInputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.ArrayDeque;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Deque;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.BiFunction;
|
||||||
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Populates the block registries.
|
* Populates the block registries.
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package org.geysermc.geyser.registry.populator;
|
package org.geysermc.geyser.registry.populator;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.nukkitx.nbt.NbtMap;
|
||||||
import java.util.HashMap;
|
import com.nukkitx.nbt.NbtMapBuilder;
|
||||||
import java.util.List;
|
import com.nukkitx.nbt.NbtType;
|
||||||
import java.util.Map;
|
import com.nukkitx.protocol.bedrock.data.BlockPropertyData;
|
||||||
import java.util.Set;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||||
|
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.geysermc.geyser.GeyserImpl;
|
import org.geysermc.geyser.GeyserImpl;
|
||||||
@ -15,8 +15,8 @@ import org.geysermc.geyser.api.block.custom.CustomBlockState;
|
|||||||
import org.geysermc.geyser.api.block.custom.component.BoxComponent;
|
import org.geysermc.geyser.api.block.custom.component.BoxComponent;
|
||||||
import org.geysermc.geyser.api.block.custom.component.CustomBlockComponents;
|
import org.geysermc.geyser.api.block.custom.component.CustomBlockComponents;
|
||||||
import org.geysermc.geyser.api.block.custom.component.MaterialInstance;
|
import org.geysermc.geyser.api.block.custom.component.MaterialInstance;
|
||||||
import org.geysermc.geyser.api.block.custom.component.placementfilter.PlacementFilter;
|
|
||||||
import org.geysermc.geyser.api.block.custom.component.placementfilter.Conditions.Face;
|
import org.geysermc.geyser.api.block.custom.component.placementfilter.Conditions.Face;
|
||||||
|
import org.geysermc.geyser.api.block.custom.component.placementfilter.PlacementFilter;
|
||||||
import org.geysermc.geyser.api.block.custom.property.CustomBlockProperty;
|
import org.geysermc.geyser.api.block.custom.property.CustomBlockProperty;
|
||||||
import org.geysermc.geyser.api.block.custom.property.PropertyType;
|
import org.geysermc.geyser.api.block.custom.property.PropertyType;
|
||||||
import org.geysermc.geyser.api.event.lifecycle.GeyserDefineCustomBlocksEvent;
|
import org.geysermc.geyser.api.event.lifecycle.GeyserDefineCustomBlocksEvent;
|
||||||
@ -25,13 +25,11 @@ import org.geysermc.geyser.registry.BlockRegistries;
|
|||||||
import org.geysermc.geyser.registry.mappings.MappingsConfigReader;
|
import org.geysermc.geyser.registry.mappings.MappingsConfigReader;
|
||||||
import org.geysermc.geyser.registry.type.CustomSkull;
|
import org.geysermc.geyser.registry.type.CustomSkull;
|
||||||
|
|
||||||
import com.nukkitx.nbt.NbtMap;
|
import java.util.ArrayList;
|
||||||
import com.nukkitx.nbt.NbtMapBuilder;
|
import java.util.HashMap;
|
||||||
import com.nukkitx.nbt.NbtType;
|
import java.util.List;
|
||||||
import com.nukkitx.protocol.bedrock.data.BlockPropertyData;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
|
||||||
|
|
||||||
public class CustomBlockRegistryPopulator {
|
public class CustomBlockRegistryPopulator {
|
||||||
|
|
||||||
@ -39,7 +37,7 @@ public class CustomBlockRegistryPopulator {
|
|||||||
* Registers all custom blocks defined by extensions and user supplied mappings
|
* Registers all custom blocks defined by extensions and user supplied mappings
|
||||||
*/
|
*/
|
||||||
public static void registerCustomBedrockBlocks() {
|
public static void registerCustomBedrockBlocks() {
|
||||||
if (!GeyserImpl.getInstance().getConfig().isAddCustomBlocks()) {
|
if (!GeyserImpl.getInstance().getConfig().isAddNonBedrockItems()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Set<String> customBlockNames = new ObjectOpenHashSet<>();
|
Set<String> customBlockNames = new ObjectOpenHashSet<>();
|
||||||
|
@ -52,7 +52,7 @@ public class CustomSkullRegistryPopulator {
|
|||||||
SkullResourcePackManager.SKULL_SKINS.clear(); // Remove skins after reloading
|
SkullResourcePackManager.SKULL_SKINS.clear(); // Remove skins after reloading
|
||||||
BlockRegistries.CUSTOM_SKULLS.set(Object2ObjectMaps.emptyMap());
|
BlockRegistries.CUSTOM_SKULLS.set(Object2ObjectMaps.emptyMap());
|
||||||
|
|
||||||
if (!GeyserImpl.getInstance().getConfig().isAddCustomSkullBlocks()) {
|
if (!GeyserImpl.getInstance().getConfig().isAddNonBedrockItems()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,18 +25,34 @@
|
|||||||
|
|
||||||
package org.geysermc.geyser.registry.populator;
|
package org.geysermc.geyser.registry.populator;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import java.io.IOException;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import java.io.InputStream;
|
import com.google.common.collect.Multimap;
|
||||||
import java.util.ArrayList;
|
import com.google.common.collect.MultimapBuilder;
|
||||||
import java.util.Base64;
|
import com.nukkitx.nbt.NbtMap;
|
||||||
import java.util.Collection;
|
import com.nukkitx.nbt.NbtMapBuilder;
|
||||||
import java.util.Collections;
|
import com.nukkitx.nbt.NbtType;
|
||||||
import java.util.List;
|
import com.nukkitx.nbt.NbtUtils;
|
||||||
import java.util.Locale;
|
import com.nukkitx.protocol.bedrock.data.SoundEvent;
|
||||||
import java.util.Map;
|
import com.nukkitx.protocol.bedrock.data.inventory.ComponentItemData;
|
||||||
import java.util.Set;
|
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
||||||
|
import com.nukkitx.protocol.bedrock.packet.StartGamePacket;
|
||||||
|
import com.nukkitx.protocol.bedrock.v544.Bedrock_v544;
|
||||||
|
import com.nukkitx.protocol.bedrock.v560.Bedrock_v560;
|
||||||
|
import it.unimi.dsi.fastutil.ints.Int2IntMap;
|
||||||
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||||
|
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||||
|
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||||
|
import it.unimi.dsi.fastutil.ints.IntList;
|
||||||
|
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
||||||
|
import it.unimi.dsi.fastutil.ints.IntSet;
|
||||||
|
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||||
|
import it.unimi.dsi.fastutil.objects.Object2IntMaps;
|
||||||
|
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||||
|
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||||
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
|
import it.unimi.dsi.fastutil.objects.ObjectIntPair;
|
||||||
|
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.geysermc.geyser.Constants;
|
import org.geysermc.geyser.Constants;
|
||||||
import org.geysermc.geyser.GeyserBootstrap;
|
import org.geysermc.geyser.GeyserBootstrap;
|
||||||
@ -60,35 +76,17 @@ import org.geysermc.geyser.registry.type.PaletteItem;
|
|||||||
import org.geysermc.geyser.util.ItemUtils;
|
import org.geysermc.geyser.util.ItemUtils;
|
||||||
import org.geysermc.geyser.util.collection.FixedInt2IntMap;
|
import org.geysermc.geyser.util.collection.FixedInt2IntMap;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import java.io.ByteArrayInputStream;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import java.io.IOException;
|
||||||
import com.google.common.collect.Multimap;
|
import java.io.InputStream;
|
||||||
import com.google.common.collect.MultimapBuilder;
|
import java.util.ArrayList;
|
||||||
import com.nukkitx.nbt.NbtMap;
|
import java.util.Base64;
|
||||||
import com.nukkitx.nbt.NbtMapBuilder;
|
import java.util.Collection;
|
||||||
import com.nukkitx.nbt.NbtType;
|
import java.util.Collections;
|
||||||
import com.nukkitx.nbt.NbtUtils;
|
import java.util.List;
|
||||||
import com.nukkitx.protocol.bedrock.data.SoundEvent;
|
import java.util.Locale;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.ComponentItemData;
|
import java.util.Map;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
import java.util.Set;
|
||||||
import com.nukkitx.protocol.bedrock.packet.StartGamePacket;
|
|
||||||
import com.nukkitx.protocol.bedrock.v544.Bedrock_v544;
|
|
||||||
import com.nukkitx.protocol.bedrock.v560.Bedrock_v560;
|
|
||||||
|
|
||||||
import it.unimi.dsi.fastutil.ints.Int2IntMap;
|
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
|
||||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
|
||||||
import it.unimi.dsi.fastutil.ints.IntList;
|
|
||||||
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
|
||||||
import it.unimi.dsi.fastutil.ints.IntSet;
|
|
||||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
|
||||||
import it.unimi.dsi.fastutil.objects.Object2IntMaps;
|
|
||||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
|
||||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
|
||||||
import it.unimi.dsi.fastutil.objects.ObjectIntPair;
|
|
||||||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Populates the item registries.
|
* Populates the item registries.
|
||||||
|
@ -1491,10 +1491,15 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
|||||||
startGamePacket.setMultiplayerCorrelationId("");
|
startGamePacket.setMultiplayerCorrelationId("");
|
||||||
|
|
||||||
startGamePacket.setItemEntries(this.itemMappings.getItemEntries());
|
startGamePacket.setItemEntries(this.itemMappings.getItemEntries());
|
||||||
|
// Needed for custom block mappings and custom skulls system
|
||||||
startGamePacket.getBlockProperties().addAll(this.blockMappings.getBlockProperties());
|
startGamePacket.getBlockProperties().addAll(this.blockMappings.getBlockProperties());
|
||||||
|
|
||||||
|
// See https://learn.microsoft.com/en-us/minecraft/creator/documents/experimentalfeaturestoggle for info on each experiment
|
||||||
|
// data_driven_items (Holiday Creator Features) is needed for blocks and items
|
||||||
startGamePacket.getExperiments().add(new ExperimentData("data_driven_items", true));
|
startGamePacket.getExperiments().add(new ExperimentData("data_driven_items", true));
|
||||||
|
// Needed for block properties for states
|
||||||
startGamePacket.getExperiments().add(new ExperimentData("upcoming_creator_features", true));
|
startGamePacket.getExperiments().add(new ExperimentData("upcoming_creator_features", true));
|
||||||
|
// Needed for certain molang queries used in blocks and items
|
||||||
startGamePacket.getExperiments().add(new ExperimentData("experimental_molang_features", true));
|
startGamePacket.getExperiments().add(new ExperimentData("experimental_molang_features", true));
|
||||||
|
|
||||||
startGamePacket.setVanillaVersion("*");
|
startGamePacket.setVanillaVersion("*");
|
||||||
|
@ -25,29 +25,6 @@
|
|||||||
|
|
||||||
package org.geysermc.geyser.translator.inventory.item;
|
package org.geysermc.geyser.translator.inventory.item;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
|
|
||||||
import org.geysermc.geyser.GeyserImpl;
|
|
||||||
import org.geysermc.geyser.api.block.custom.CustomBlockData;
|
|
||||||
import org.geysermc.geyser.inventory.GeyserItemStack;
|
|
||||||
import org.geysermc.geyser.registry.BlockRegistries;
|
|
||||||
import org.geysermc.geyser.registry.type.CustomSkull;
|
|
||||||
import org.geysermc.geyser.registry.type.ItemMapping;
|
|
||||||
import org.geysermc.geyser.registry.type.ItemMappings;
|
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
|
||||||
import org.geysermc.geyser.skin.SkinManager;
|
|
||||||
import org.geysermc.geyser.text.MinecraftLocale;
|
|
||||||
import org.geysermc.geyser.translator.text.MessageTranslator;
|
|
||||||
import org.geysermc.geyser.util.FileUtils;
|
|
||||||
|
|
||||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
|
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
|
||||||
import com.github.steveice10.opennbt.tag.builtin.ByteArrayTag;
|
import com.github.steveice10.opennbt.tag.builtin.ByteArrayTag;
|
||||||
import com.github.steveice10.opennbt.tag.builtin.ByteTag;
|
import com.github.steveice10.opennbt.tag.builtin.ByteTag;
|
||||||
@ -67,11 +44,31 @@ import com.nukkitx.nbt.NbtMap;
|
|||||||
import com.nukkitx.nbt.NbtMapBuilder;
|
import com.nukkitx.nbt.NbtMapBuilder;
|
||||||
import com.nukkitx.nbt.NbtType;
|
import com.nukkitx.nbt.NbtType;
|
||||||
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
|
||||||
|
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
import net.kyori.adventure.text.format.NamedTextColor;
|
||||||
|
import org.geysermc.geyser.GeyserImpl;
|
||||||
|
import org.geysermc.geyser.api.block.custom.CustomBlockData;
|
||||||
|
import org.geysermc.geyser.inventory.GeyserItemStack;
|
||||||
|
import org.geysermc.geyser.registry.BlockRegistries;
|
||||||
|
import org.geysermc.geyser.registry.type.CustomSkull;
|
||||||
|
import org.geysermc.geyser.registry.type.ItemMapping;
|
||||||
|
import org.geysermc.geyser.registry.type.ItemMappings;
|
||||||
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
|
import org.geysermc.geyser.skin.SkinManager;
|
||||||
|
import org.geysermc.geyser.text.MinecraftLocale;
|
||||||
|
import org.geysermc.geyser.translator.text.MessageTranslator;
|
||||||
|
import org.geysermc.geyser.util.FileUtils;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public abstract class ItemTranslator {
|
public abstract class ItemTranslator {
|
||||||
private static final Int2ObjectMap<ItemTranslator> ITEM_STACK_TRANSLATORS = new Int2ObjectOpenHashMap<>();
|
private static final Int2ObjectMap<ItemTranslator> ITEM_STACK_TRANSLATORS = new Int2ObjectOpenHashMap<>();
|
||||||
|
@ -158,9 +158,10 @@ max-visible-custom-skulls: 128
|
|||||||
# The radius in blocks around the player in which custom skulls are displayed.
|
# The radius in blocks around the player in which custom skulls are displayed.
|
||||||
custom-skull-render-distance: 32
|
custom-skull-render-distance: 32
|
||||||
|
|
||||||
# Whether to add (at this time, only) the furnace minecart as a separate item in the game, which normally does not exist in Bedrock Edition.
|
# Whether to add any items and blocks which normally does not exist in Bedrock Edition.
|
||||||
# This should only need to be disabled if using a proxy that does not use the "transfer packet" style of server switching.
|
# This should only need to be disabled if using a proxy that does not use the "transfer packet" style of server switching.
|
||||||
# If this is disabled, furnace minecart items will be mapped to hopper minecart items.
|
# If this is disabled, furnace minecart items will be mapped to hopper minecart items.
|
||||||
|
# Geyser's block, item, and skull mappings systems will also be disabled.
|
||||||
# This option requires a restart of Geyser in order to change its setting.
|
# This option requires a restart of Geyser in order to change its setting.
|
||||||
add-non-bedrock-items: true
|
add-non-bedrock-items: true
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren