Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-27 00:23:03 +01:00
Improve tag loading and load non-vanilla tags as well (#4849)
* Work on new tag system, still largely unfinished * Continue work on new tag system, closer to testing now * Add holderset class for geyser * My IDE did some stuff it shouldn't have done * Add is method for HolderSets to TagCache * Add some documentation * Fix build and slightly adjust documentation * Fix some issues, still broken * Fix more issues with registering vanilla tags, works better now * Fix all issues with vanilla and non-vanilla tags, fix documentation a bit. * Small cleanup * Use IllegalArgumentException instead of asserting and make TagRegistry#getVanillaTags return original map * Generics - still untested * Remove different lookups for vanilla- and non-vanilla tags * Add toNetworkId and fromNetworkId methods to JavaRegistryKey, simplify TagCache * More cleanup, add documentation * Fix registry loading * Rename HolderSet to GeyserHolderSet and address reviews by camotoy * Make holder set reader method not throw an exception, clean up * Make holder set reader warn when failing to read * Add comment to make clearer why a cast is make --------- Co-authored-by: chris <github@onechris.mozmail.com>
Dieser Commit ist enthalten in:
Ursprung
b9b41b45f0
Commit
e78b24830d
@ -33,8 +33,9 @@ import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.entity.type.living.AgeableEntity;
|
||||
import org.geysermc.geyser.inventory.GeyserItemStack;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.tags.ItemTag;
|
||||
import org.geysermc.geyser.session.cache.tags.Tag;
|
||||
import org.geysermc.geyser.util.InteractionResult;
|
||||
import org.geysermc.geyser.util.InteractiveTag;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.player.Hand;
|
||||
@ -48,7 +49,7 @@ public abstract class AnimalEntity extends AgeableEntity {
|
||||
}
|
||||
|
||||
protected final boolean canEat(GeyserItemStack itemStack) {
|
||||
ItemTag tag = getFoodTag();
|
||||
Tag<Item> tag = getFoodTag();
|
||||
if (tag == null) {
|
||||
return false;
|
||||
}
|
||||
@ -58,7 +59,7 @@ public abstract class AnimalEntity extends AgeableEntity {
|
||||
/**
|
||||
* @return the tag associated with this animal for eating food. Null for nothing or different behavior.
|
||||
*/
|
||||
protected abstract @Nullable ItemTag getFoodTag();
|
||||
protected abstract @Nullable Tag<Item> getFoodTag();
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
|
@ -28,8 +28,10 @@ package org.geysermc.geyser.entity.type.living.animal;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.cloudburstmc.math.vector.Vector3f;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.tags.ItemTag;
|
||||
import org.geysermc.geyser.session.cache.tags.Tag;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.ArmadilloState;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.ObjectEntityMetadata;
|
||||
|
||||
@ -75,7 +77,7 @@ public class ArmadilloEntity extends AnimalEntity {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected ItemTag getFoodTag() {
|
||||
protected Tag<Item> getFoodTag() {
|
||||
return ItemTag.ARMADILLO_FOOD;
|
||||
}
|
||||
}
|
||||
|
@ -32,8 +32,10 @@ import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
|
||||
import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.inventory.GeyserItemStack;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.tags.ItemTag;
|
||||
import org.geysermc.geyser.session.cache.tags.Tag;
|
||||
import org.geysermc.geyser.util.EntityUtils;
|
||||
import org.geysermc.geyser.util.InteractionResult;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.BooleanEntityMetadata;
|
||||
@ -62,7 +64,7 @@ public class AxolotlEntity extends AnimalEntity {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected ItemTag getFoodTag() {
|
||||
protected Tag<Item> getFoodTag() {
|
||||
return ItemTag.AXOLOTL_FOOD;
|
||||
}
|
||||
|
||||
|
@ -32,8 +32,10 @@ import org.cloudburstmc.protocol.bedrock.data.entity.EntityEventType;
|
||||
import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.EntityEventPacket;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.tags.ItemTag;
|
||||
import org.geysermc.geyser.session.cache.tags.Tag;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.ByteEntityMetadata;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.IntEntityMetadata;
|
||||
|
||||
@ -69,7 +71,7 @@ public class BeeEntity extends AnimalEntity {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected ItemTag getFoodTag() {
|
||||
protected Tag<Item> getFoodTag() {
|
||||
return ItemTag.BEE_FOOD;
|
||||
}
|
||||
}
|
||||
|
@ -28,8 +28,10 @@ package org.geysermc.geyser.entity.type.living.animal;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.cloudburstmc.math.vector.Vector3f;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.tags.ItemTag;
|
||||
import org.geysermc.geyser.session.cache.tags.Tag;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@ -41,7 +43,7 @@ public class ChickenEntity extends AnimalEntity {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected ItemTag getFoodTag() {
|
||||
protected Tag<Item> getFoodTag() {
|
||||
return ItemTag.CHICKEN_FOOD;
|
||||
}
|
||||
}
|
||||
|
@ -33,8 +33,10 @@ import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.inventory.GeyserItemStack;
|
||||
import org.geysermc.geyser.item.Items;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.tags.ItemTag;
|
||||
import org.geysermc.geyser.session.cache.tags.Tag;
|
||||
import org.geysermc.geyser.util.InteractionResult;
|
||||
import org.geysermc.geyser.util.InteractiveTag;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.player.Hand;
|
||||
@ -69,7 +71,7 @@ public class CowEntity extends AnimalEntity {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected ItemTag getFoodTag() {
|
||||
protected Tag<Item> getFoodTag() {
|
||||
return ItemTag.COW_FOOD;
|
||||
}
|
||||
}
|
||||
|
@ -30,8 +30,10 @@ import org.cloudburstmc.math.vector.Vector3f;
|
||||
import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
|
||||
import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.tags.ItemTag;
|
||||
import org.geysermc.geyser.session.cache.tags.Tag;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.ByteEntityMetadata;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.IntEntityMetadata;
|
||||
|
||||
@ -57,7 +59,7 @@ public class FoxEntity extends AnimalEntity {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected ItemTag getFoodTag() {
|
||||
protected Tag<Item> getFoodTag() {
|
||||
return ItemTag.FOX_FOOD;
|
||||
}
|
||||
}
|
||||
|
@ -31,8 +31,10 @@ import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
|
||||
import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.entity.type.Entity;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.tags.ItemTag;
|
||||
import org.geysermc.geyser.session.cache.tags.Tag;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.Pose;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.IntEntityMetadata;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.ObjectEntityMetadata;
|
||||
@ -77,7 +79,7 @@ public class FrogEntity extends AnimalEntity {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected ItemTag getFoodTag() {
|
||||
protected Tag<Item> getFoodTag() {
|
||||
return ItemTag.FROG_FOOD;
|
||||
}
|
||||
}
|
||||
|
@ -34,8 +34,10 @@ import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.inventory.GeyserItemStack;
|
||||
import org.geysermc.geyser.item.Items;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.tags.ItemTag;
|
||||
import org.geysermc.geyser.session.cache.tags.Tag;
|
||||
import org.geysermc.geyser.util.InteractionResult;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.Pose;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.BooleanEntityMetadata;
|
||||
@ -99,7 +101,7 @@ public class GoatEntity extends AnimalEntity {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected ItemTag getFoodTag() {
|
||||
protected Tag<Item> getFoodTag() {
|
||||
return ItemTag.GOAT_FOOD;
|
||||
}
|
||||
}
|
||||
|
@ -30,8 +30,10 @@ import org.cloudburstmc.math.vector.Vector3f;
|
||||
import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
|
||||
import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.tags.ItemTag;
|
||||
import org.geysermc.geyser.session.cache.tags.Tag;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.BooleanEntityMetadata;
|
||||
|
||||
import java.util.UUID;
|
||||
@ -58,7 +60,7 @@ public class HoglinEntity extends AnimalEntity {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected ItemTag getFoodTag() {
|
||||
protected Tag<Item> getFoodTag() {
|
||||
return ItemTag.HOGLIN_FOOD;
|
||||
}
|
||||
|
||||
|
@ -31,8 +31,10 @@ import org.cloudburstmc.math.vector.Vector3f;
|
||||
import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.inventory.GeyserItemStack;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.tags.ItemTag;
|
||||
import org.geysermc.geyser.session.cache.tags.Tag;
|
||||
import org.geysermc.geyser.util.InteractionResult;
|
||||
import org.geysermc.geyser.util.InteractiveTag;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.player.Hand;
|
||||
@ -47,7 +49,7 @@ public class OcelotEntity extends AnimalEntity {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected ItemTag getFoodTag() {
|
||||
protected Tag<Item> getFoodTag() {
|
||||
return ItemTag.OCELOT_FOOD;
|
||||
}
|
||||
|
||||
|
@ -34,8 +34,10 @@ import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.EntityEventPacket;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.inventory.GeyserItemStack;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.tags.ItemTag;
|
||||
import org.geysermc.geyser.session.cache.tags.Tag;
|
||||
import org.geysermc.geyser.util.InteractionResult;
|
||||
import org.geysermc.geyser.util.InteractiveTag;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.ByteEntityMetadata;
|
||||
@ -90,7 +92,7 @@ public class PandaEntity extends AnimalEntity {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected ItemTag getFoodTag() {
|
||||
protected Tag<Item> getFoodTag() {
|
||||
return ItemTag.PANDA_FOOD;
|
||||
}
|
||||
|
||||
|
@ -38,9 +38,11 @@ import org.geysermc.geyser.entity.vehicle.BoostableVehicleComponent;
|
||||
import org.geysermc.geyser.entity.vehicle.ClientVehicle;
|
||||
import org.geysermc.geyser.entity.vehicle.VehicleComponent;
|
||||
import org.geysermc.geyser.inventory.GeyserItemStack;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.item.Items;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.tags.ItemTag;
|
||||
import org.geysermc.geyser.session.cache.tags.Tag;
|
||||
import org.geysermc.geyser.util.EntityUtils;
|
||||
import org.geysermc.geyser.util.InteractionResult;
|
||||
import org.geysermc.geyser.util.InteractiveTag;
|
||||
@ -58,7 +60,7 @@ public class PigEntity extends AnimalEntity implements Tickable, ClientVehicle {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected ItemTag getFoodTag() {
|
||||
protected Tag<Item> getFoodTag() {
|
||||
return ItemTag.PIG_FOOD;
|
||||
}
|
||||
|
||||
|
@ -28,8 +28,9 @@ package org.geysermc.geyser.entity.type.living.animal;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.cloudburstmc.math.vector.Vector3f;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.tags.ItemTag;
|
||||
import org.geysermc.geyser.session.cache.tags.Tag;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@ -41,7 +42,7 @@ public class PolarBearEntity extends AnimalEntity {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected ItemTag getFoodTag() {
|
||||
protected Tag<Item> getFoodTag() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -31,8 +31,10 @@ import org.cloudburstmc.math.vector.Vector3f;
|
||||
import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
|
||||
import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.tags.ItemTag;
|
||||
import org.geysermc.geyser.session.cache.tags.Tag;
|
||||
import org.geysermc.geyser.util.EntityUtils;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.IntEntityMetadata;
|
||||
|
||||
@ -79,7 +81,7 @@ public class RabbitEntity extends AnimalEntity {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected ItemTag getFoodTag() {
|
||||
protected Tag<Item> getFoodTag() {
|
||||
return ItemTag.RABBIT_FOOD;
|
||||
}
|
||||
}
|
||||
|
@ -34,8 +34,10 @@ import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.inventory.GeyserItemStack;
|
||||
import org.geysermc.geyser.item.Items;
|
||||
import org.geysermc.geyser.item.type.DyeItem;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.tags.ItemTag;
|
||||
import org.geysermc.geyser.session.cache.tags.Tag;
|
||||
import org.geysermc.geyser.util.InteractionResult;
|
||||
import org.geysermc.geyser.util.InteractiveTag;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.ByteEntityMetadata;
|
||||
@ -59,7 +61,7 @@ public class SheepEntity extends AnimalEntity {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected ItemTag getFoodTag() {
|
||||
protected Tag<Item> getFoodTag() {
|
||||
return ItemTag.SHEEP_FOOD;
|
||||
}
|
||||
|
||||
@ -103,4 +105,4 @@ public class SheepEntity extends AnimalEntity {
|
||||
private boolean canDye(GeyserItemStack item) {
|
||||
return item.asItem() instanceof DyeItem dyeItem && dyeItem.dyeColor() != this.color && !getFlag(EntityFlag.SHEARED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,8 +35,10 @@ import org.cloudburstmc.protocol.bedrock.packet.LevelSoundEventPacket;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.entity.EntityDefinitions;
|
||||
import org.geysermc.geyser.entity.type.Tickable;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.tags.ItemTag;
|
||||
import org.geysermc.geyser.session.cache.tags.Tag;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.Pose;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.SnifferState;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.ObjectEntityMetadata;
|
||||
@ -73,7 +75,7 @@ public class SnifferEntity extends AnimalEntity implements Tickable {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected ItemTag getFoodTag() {
|
||||
protected Tag<Item> getFoodTag() {
|
||||
return ItemTag.SNIFFER_FOOD;
|
||||
}
|
||||
|
||||
|
@ -39,9 +39,11 @@ import org.geysermc.geyser.entity.vehicle.BoostableVehicleComponent;
|
||||
import org.geysermc.geyser.entity.vehicle.ClientVehicle;
|
||||
import org.geysermc.geyser.entity.vehicle.VehicleComponent;
|
||||
import org.geysermc.geyser.inventory.GeyserItemStack;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.item.Items;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.tags.ItemTag;
|
||||
import org.geysermc.geyser.session.cache.tags.Tag;
|
||||
import org.geysermc.geyser.util.EntityUtils;
|
||||
import org.geysermc.geyser.util.InteractionResult;
|
||||
import org.geysermc.geyser.util.InteractiveTag;
|
||||
@ -105,7 +107,7 @@ public class StriderEntity extends AnimalEntity implements Tickable, ClientVehic
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected ItemTag getFoodTag() {
|
||||
protected Tag<Item> getFoodTag() {
|
||||
return ItemTag.STRIDER_FOOD;
|
||||
}
|
||||
|
||||
|
@ -29,8 +29,10 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.cloudburstmc.math.vector.Vector3f;
|
||||
import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.tags.ItemTag;
|
||||
import org.geysermc.geyser.session.cache.tags.Tag;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.BooleanEntityMetadata;
|
||||
|
||||
import java.util.UUID;
|
||||
@ -51,7 +53,7 @@ public class TurtleEntity extends AnimalEntity {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected ItemTag getFoodTag() {
|
||||
protected Tag<Item> getFoodTag() {
|
||||
return ItemTag.TURTLE_FOOD;
|
||||
}
|
||||
|
||||
|
@ -39,8 +39,10 @@ import org.geysermc.geyser.entity.attribute.GeyserAttributeType;
|
||||
import org.geysermc.geyser.entity.type.living.animal.AnimalEntity;
|
||||
import org.geysermc.geyser.inventory.GeyserItemStack;
|
||||
import org.geysermc.geyser.item.Items;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.tags.ItemTag;
|
||||
import org.geysermc.geyser.session.cache.tags.Tag;
|
||||
import org.geysermc.geyser.util.InteractionResult;
|
||||
import org.geysermc.geyser.util.InteractiveTag;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.ByteEntityMetadata;
|
||||
@ -119,7 +121,7 @@ public class AbstractHorseEntity extends AnimalEntity {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected ItemTag getFoodTag() {
|
||||
protected Tag<Item> getFoodTag() {
|
||||
return ItemTag.HORSE_FOOD;
|
||||
}
|
||||
|
||||
|
@ -35,12 +35,14 @@ import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
|
||||
import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType;
|
||||
import org.cloudburstmc.protocol.bedrock.packet.EntityEventPacket;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.entity.attribute.GeyserAttributeType;
|
||||
import org.geysermc.geyser.entity.vehicle.CamelVehicleComponent;
|
||||
import org.geysermc.geyser.entity.vehicle.ClientVehicle;
|
||||
import org.geysermc.geyser.entity.vehicle.VehicleComponent;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.tags.ItemTag;
|
||||
import org.geysermc.geyser.session.cache.tags.Tag;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.attribute.Attribute;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.attribute.AttributeType;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.Pose;
|
||||
@ -100,7 +102,7 @@ public class CamelEntity extends AbstractHorseEntity implements ClientVehicle {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @Nullable ItemTag getFoodTag() {
|
||||
protected @Nullable Tag<Item> getFoodTag() {
|
||||
return ItemTag.CAMEL_FOOD;
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,10 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.cloudburstmc.math.vector.Vector3f;
|
||||
import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.tags.ItemTag;
|
||||
import org.geysermc.geyser.session.cache.tags.Tag;
|
||||
import org.geysermc.geyser.util.MathUtils;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.IntEntityMetadata;
|
||||
|
||||
@ -56,7 +58,7 @@ public class LlamaEntity extends ChestedHorseEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @Nullable ItemTag getFoodTag() {
|
||||
protected @Nullable Tag<Item> getFoodTag() {
|
||||
return ItemTag.LLAMA_FOOD;
|
||||
}
|
||||
}
|
||||
|
@ -32,8 +32,10 @@ import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes;
|
||||
import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag;
|
||||
import org.geysermc.geyser.entity.EntityDefinition;
|
||||
import org.geysermc.geyser.inventory.GeyserItemStack;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.tags.ItemTag;
|
||||
import org.geysermc.geyser.session.cache.tags.Tag;
|
||||
import org.geysermc.geyser.util.InteractionResult;
|
||||
import org.geysermc.geyser.util.InteractiveTag;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.BooleanEntityMetadata;
|
||||
@ -109,7 +111,7 @@ public class CatEntity extends TameableEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @Nullable ItemTag getFoodTag() {
|
||||
protected @Nullable Tag<Item> getFoodTag() {
|
||||
return ItemTag.CAT_FOOD;
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@ import org.geysermc.geyser.inventory.GeyserItemStack;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.tags.ItemTag;
|
||||
import org.geysermc.geyser.session.cache.tags.Tag;
|
||||
import org.geysermc.geyser.util.InteractionResult;
|
||||
import org.geysermc.geyser.util.InteractiveTag;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.player.Hand;
|
||||
@ -47,7 +48,7 @@ public class ParrotEntity extends TameableEntity {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected ItemTag getFoodTag() {
|
||||
protected Tag<Item> getFoodTag() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -36,8 +36,10 @@ import org.geysermc.geyser.inventory.GeyserItemStack;
|
||||
import org.geysermc.geyser.item.Items;
|
||||
import org.geysermc.geyser.item.enchantment.EnchantmentComponent;
|
||||
import org.geysermc.geyser.item.type.DyeItem;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.tags.ItemTag;
|
||||
import org.geysermc.geyser.session.cache.tags.Tag;
|
||||
import org.geysermc.geyser.util.InteractionResult;
|
||||
import org.geysermc.geyser.util.InteractiveTag;
|
||||
import org.geysermc.geyser.util.ItemUtils;
|
||||
@ -116,7 +118,7 @@ public class WolfEntity extends TameableEntity {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected ItemTag getFoodTag() {
|
||||
protected Tag<Item> getFoodTag() {
|
||||
return ItemTag.WOLF_FOOD;
|
||||
}
|
||||
|
||||
|
@ -41,17 +41,15 @@ import org.geysermc.geyser.inventory.item.BedrockEnchantment;
|
||||
import org.geysermc.geyser.item.Items;
|
||||
import org.geysermc.geyser.item.enchantment.Enchantment;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.tags.EnchantmentTag;
|
||||
import org.geysermc.geyser.session.cache.tags.ItemTag;
|
||||
import org.geysermc.geyser.translator.inventory.InventoryTranslator;
|
||||
import org.geysermc.geyser.translator.text.MessageTranslator;
|
||||
import org.geysermc.geyser.util.ItemUtils;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.entity.player.GameMode;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponentType;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.item.component.HolderSet;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.item.component.ItemEnchantments;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundRenameItemPacket;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.IntStream;
|
||||
@ -314,14 +312,10 @@ public class AnvilInventoryUpdater extends InventoryUpdater {
|
||||
for (Object2IntMap.Entry<Enchantment> entry : getEnchantments(session, material).object2IntEntrySet()) {
|
||||
Enchantment enchantment = entry.getKey();
|
||||
|
||||
HolderSet supportedItems = enchantment.supportedItems();
|
||||
int[] supportedItemIds = supportedItems.resolve(tagId -> session.getTagCache().get(ItemTag.ALL_ITEM_TAGS.get(tagId)));
|
||||
boolean canApply = isEnchantedBook(input) || IntStream.of(supportedItemIds).anyMatch(id -> id == input.getJavaId());
|
||||
boolean canApply = isEnchantedBook(input) || session.getTagCache().is(enchantment.supportedItems(), input.asItem());
|
||||
|
||||
HolderSet exclusiveSet = enchantment.exclusiveSet();
|
||||
int[] incompatibleEnchantments = exclusiveSet.resolve(tagId -> session.getTagCache().get(EnchantmentTag.ALL_ENCHANTMENT_TAGS.get(tagId)));
|
||||
for (int i : incompatibleEnchantments) {
|
||||
Enchantment incompatible = session.getRegistryCache().enchantments().byId(i);
|
||||
List<Enchantment> incompatibleEnchantments = enchantment.exclusiveSet().resolve(session);
|
||||
for (Enchantment incompatible : incompatibleEnchantments) {
|
||||
if (combinedEnchantments.containsKey(incompatible)) {
|
||||
canApply = false;
|
||||
if (!bedrock) {
|
||||
|
@ -25,23 +25,20 @@
|
||||
|
||||
package org.geysermc.geyser.item.enchantment;
|
||||
|
||||
import it.unimi.dsi.fastutil.ints.IntArrays;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.cloudburstmc.nbt.NbtMap;
|
||||
import org.geysermc.geyser.inventory.item.BedrockEnchantment;
|
||||
import org.geysermc.geyser.item.Items;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.registry.Registries;
|
||||
import org.geysermc.geyser.session.cache.registry.JavaRegistries;
|
||||
import org.geysermc.geyser.session.cache.registry.RegistryEntryContext;
|
||||
import org.geysermc.geyser.session.cache.tags.GeyserHolderSet;
|
||||
import org.geysermc.geyser.translator.text.MessageTranslator;
|
||||
import org.geysermc.geyser.util.MinecraftKey;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.item.component.HolderSet;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.ToIntFunction;
|
||||
|
||||
/**
|
||||
* @param description only populated if {@link #bedrockEnchantment()} is not null.
|
||||
@ -49,23 +46,23 @@ import java.util.function.ToIntFunction;
|
||||
*/
|
||||
public record Enchantment(String identifier,
|
||||
Set<EnchantmentComponent> effects,
|
||||
HolderSet supportedItems,
|
||||
GeyserHolderSet<Item> supportedItems,
|
||||
int maxLevel,
|
||||
String description,
|
||||
int anvilCost,
|
||||
HolderSet exclusiveSet,
|
||||
GeyserHolderSet<Enchantment> exclusiveSet,
|
||||
@Nullable BedrockEnchantment bedrockEnchantment) {
|
||||
|
||||
public static Enchantment read(RegistryEntryContext context) {
|
||||
NbtMap data = context.data();
|
||||
Set<EnchantmentComponent> effects = readEnchantmentComponents(data.getCompound("effects"));
|
||||
|
||||
HolderSet supportedItems = readHolderSet(data.get("supported_items"), itemId -> Registries.JAVA_ITEM_IDENTIFIERS.getOrDefault(itemId.asString(), Items.AIR).javaId());
|
||||
GeyserHolderSet<Item> supportedItems = GeyserHolderSet.readHolderSet(context.session(), JavaRegistries.ITEM, data.get("supported_items"), itemId -> Registries.JAVA_ITEM_IDENTIFIERS.getOrDefault(itemId.asString(), Items.AIR).javaId());
|
||||
|
||||
int maxLevel = data.getInt("max_level");
|
||||
int anvilCost = data.getInt("anvil_cost");
|
||||
|
||||
HolderSet exclusiveSet = readHolderSet(data.getOrDefault("exclusive_set", null), context::getNetworkId);
|
||||
GeyserHolderSet<Enchantment> exclusiveSet = GeyserHolderSet.readHolderSet(context.session(), JavaRegistries.ENCHANTMENT, data.get("exclusive_set"), context::getNetworkId);
|
||||
|
||||
BedrockEnchantment bedrockEnchantment = BedrockEnchantment.getByJavaIdentifier(context.id().asString());
|
||||
|
||||
@ -86,24 +83,4 @@ public record Enchantment(String identifier,
|
||||
}
|
||||
return Set.copyOf(components); // Also ensures any empty sets are consolidated
|
||||
}
|
||||
|
||||
// TODO holder set util?
|
||||
private static HolderSet readHolderSet(@Nullable Object holderSet, ToIntFunction<Key> keyIdMapping) {
|
||||
if (holderSet == null) {
|
||||
return new HolderSet(IntArrays.EMPTY_ARRAY);
|
||||
}
|
||||
|
||||
if (holderSet instanceof String stringTag) {
|
||||
// Tag
|
||||
if (stringTag.startsWith("#")) {
|
||||
return new HolderSet(MinecraftKey.key(stringTag.substring(1))); // Remove '#' at beginning that indicates tag
|
||||
} else {
|
||||
return new HolderSet(new int[]{keyIdMapping.applyAsInt(MinecraftKey.key(stringTag))});
|
||||
}
|
||||
} else if (holderSet instanceof List<?> list) {
|
||||
// Assume the list is a list of strings
|
||||
return new HolderSet(list.stream().map(o -> (String) o).map(Key::key).mapToInt(keyIdMapping).toArray());
|
||||
}
|
||||
throw new IllegalArgumentException("Holder set must either be a tag, a string ID or a list of string IDs");
|
||||
}
|
||||
}
|
||||
|
@ -679,7 +679,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
||||
this.registryCache = new RegistryCache(this);
|
||||
this.skullCache = new SkullCache(this);
|
||||
this.structureBlockCache = new StructureBlockCache();
|
||||
this.tagCache = new TagCache();
|
||||
this.tagCache = new TagCache(this);
|
||||
this.worldCache = new WorldCache(this);
|
||||
this.cameraData = new GeyserCameraData(this);
|
||||
this.entityData = new GeyserEntityData(this);
|
||||
|
@ -46,7 +46,9 @@ import org.geysermc.geyser.level.JavaDimension;
|
||||
import org.geysermc.geyser.level.JukeboxSong;
|
||||
import org.geysermc.geyser.level.PaintingType;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.registry.JavaRegistries;
|
||||
import org.geysermc.geyser.session.cache.registry.JavaRegistry;
|
||||
import org.geysermc.geyser.session.cache.registry.JavaRegistryKey;
|
||||
import org.geysermc.geyser.session.cache.registry.RegistryEntryContext;
|
||||
import org.geysermc.geyser.session.cache.registry.SimpleJavaRegistry;
|
||||
import org.geysermc.geyser.text.ChatDecoration;
|
||||
@ -74,35 +76,34 @@ import java.util.function.ToIntFunction;
|
||||
@Accessors(fluent = true)
|
||||
@Getter
|
||||
public final class RegistryCache {
|
||||
private static final Map<Key, Map<Key, NbtMap>> DEFAULTS;
|
||||
private static final Map<Key, BiConsumer<RegistryCache, List<RegistryEntry>>> REGISTRIES = new HashMap<>();
|
||||
private static final Map<JavaRegistryKey<?>, Map<Key, NbtMap>> DEFAULTS;
|
||||
private static final Map<JavaRegistryKey<?>, BiConsumer<RegistryCache, List<RegistryEntry>>> REGISTRIES = new HashMap<>();
|
||||
|
||||
static {
|
||||
register("chat_type", cache -> cache.chatTypes, ChatDecoration::readChatType);
|
||||
register("dimension_type", cache -> cache.dimensions, JavaDimension::read);
|
||||
register("enchantment", cache -> cache.enchantments, Enchantment::read);
|
||||
register("jukebox_song", cache -> cache.jukeboxSongs, JukeboxSong::read);
|
||||
register("painting_variant", cache -> cache.paintings, context -> PaintingType.getByName(context.id()));
|
||||
register("trim_material", cache -> cache.trimMaterials, TrimRecipe::readTrimMaterial);
|
||||
register("trim_pattern", cache -> cache.trimPatterns, TrimRecipe::readTrimPattern);
|
||||
register("worldgen/biome", (cache, array) -> cache.biomeTranslations = array, BiomeTranslator::loadServerBiome);
|
||||
register("banner_pattern", cache -> cache.bannerPatterns, context -> BannerPattern.getByJavaIdentifier(context.id()));
|
||||
register("wolf_variant", cache -> cache.wolfVariants, context -> WolfEntity.BuiltInWolfVariant.getByJavaIdentifier(context.id().asString()));
|
||||
register(JavaRegistries.CHAT_TYPE, cache -> cache.chatTypes, ChatDecoration::readChatType);
|
||||
register(JavaRegistries.DIMENSION_TYPE, cache -> cache.dimensions, JavaDimension::read);
|
||||
register(JavaRegistries.ENCHANTMENT, cache -> cache.enchantments, Enchantment::read);
|
||||
register(JavaRegistries.JUKEBOX_SONG, cache -> cache.jukeboxSongs, JukeboxSong::read);
|
||||
register(JavaRegistries.PAINTING_VARIANT, cache -> cache.paintings, context -> PaintingType.getByName(context.id()));
|
||||
register(JavaRegistries.TRIM_MATERIAL, cache -> cache.trimMaterials, TrimRecipe::readTrimMaterial);
|
||||
register(JavaRegistries.TRIM_PATTERN, cache -> cache.trimPatterns, TrimRecipe::readTrimPattern);
|
||||
register(JavaRegistries.BIOME, (cache, array) -> cache.biomeTranslations = array, BiomeTranslator::loadServerBiome);
|
||||
register(JavaRegistries.BANNER_PATTERN, cache -> cache.bannerPatterns, context -> BannerPattern.getByJavaIdentifier(context.id()));
|
||||
register(JavaRegistries.WOLF_VARIANT, cache -> cache.wolfVariants, context -> WolfEntity.BuiltInWolfVariant.getByJavaIdentifier(context.id().asString()));
|
||||
|
||||
// Load from MCProtocolLib's classloader
|
||||
NbtMap tag = MinecraftProtocol.loadNetworkCodec();
|
||||
Map<Key, Map<Key, NbtMap>> defaults = new HashMap<>();
|
||||
Map<JavaRegistryKey<?>, Map<Key, NbtMap>> defaults = new HashMap<>();
|
||||
// Don't create a keySet - no need to create the cached object in HashMap if we don't use it again
|
||||
REGISTRIES.forEach((key, $) -> {
|
||||
List<NbtMap> rawValues = tag.getCompound(key.asString())
|
||||
.getList("value", NbtType.COMPOUND);
|
||||
REGISTRIES.forEach((registry, $) -> {
|
||||
List<NbtMap> rawValues = tag.getCompound(registry.registryKey().asString()).getList("value", NbtType.COMPOUND);
|
||||
Map<Key, NbtMap> values = new HashMap<>();
|
||||
for (NbtMap value : rawValues) {
|
||||
Key name = MinecraftKey.key(value.getString("name"));
|
||||
values.put(name, value.getCompound("element"));
|
||||
}
|
||||
// Can make these maps immutable and as efficient as possible after initialization
|
||||
defaults.put(key, Map.copyOf(values));
|
||||
defaults.put(registry, Map.copyOf(values));
|
||||
});
|
||||
|
||||
DEFAULTS = Map.copyOf(defaults);
|
||||
@ -137,7 +138,7 @@ public final class RegistryCache {
|
||||
* Loads a registry in, if we are tracking it.
|
||||
*/
|
||||
public void load(ClientboundRegistryDataPacket packet) {
|
||||
var reader = REGISTRIES.get(packet.getRegistry());
|
||||
var reader = REGISTRIES.get(JavaRegistries.fromKey(packet.getRegistry()));
|
||||
if (reader != null) {
|
||||
reader.accept(this, packet.getEntries());
|
||||
} else {
|
||||
@ -151,9 +152,8 @@ public final class RegistryCache {
|
||||
* @param reader converts the RegistryEntry NBT into a class file
|
||||
* @param <T> the class that represents these entries.
|
||||
*/
|
||||
private static <T> void register(String registry, Function<RegistryCache, JavaRegistry<T>> localCacheFunction, Function<RegistryEntryContext, T> reader) {
|
||||
Key registryKey = MinecraftKey.key(registry);
|
||||
REGISTRIES.put(registryKey, (registryCache, entries) -> {
|
||||
private static <T> void register(JavaRegistryKey<T> registry, Function<RegistryCache, JavaRegistry<T>> localCacheFunction, Function<RegistryEntryContext, T> reader) {
|
||||
REGISTRIES.put(registry, (registryCache, entries) -> {
|
||||
Map<Key, NbtMap> localRegistry = null;
|
||||
JavaRegistry<T> localCache = localCacheFunction.apply(registryCache);
|
||||
// Clear each local cache every time a new registry entry is given to us
|
||||
@ -172,7 +172,7 @@ public final class RegistryCache {
|
||||
// If the data is null, that's the server telling us we need to use our default values.
|
||||
if (entry.getData() == null) {
|
||||
if (localRegistry == null) { // Lazy initialize
|
||||
localRegistry = DEFAULTS.get(registryKey);
|
||||
localRegistry = DEFAULTS.get(registry);
|
||||
}
|
||||
entry = new RegistryEntry(entry.getId(), localRegistry.get(entry.getId()));
|
||||
}
|
||||
@ -189,8 +189,8 @@ public final class RegistryCache {
|
||||
/**
|
||||
* @param localCacheFunction the int array to set the final values to.
|
||||
*/
|
||||
private static void register(String registry, BiConsumer<RegistryCache, int[]> localCacheFunction, ToIntFunction<RegistryEntry> reader) {
|
||||
REGISTRIES.put(MinecraftKey.key(registry), (registryCache, entries) -> {
|
||||
private static void register(JavaRegistryKey<?> registry, BiConsumer<RegistryCache, int[]> localCacheFunction, ToIntFunction<RegistryEntry> reader) {
|
||||
REGISTRIES.put(registry, (registryCache, entries) -> {
|
||||
Int2IntMap temp = new Int2IntOpenHashMap();
|
||||
int greatestId = 0;
|
||||
for (int i = 0; i < entries.size(); i++) {
|
||||
|
@ -26,116 +26,114 @@
|
||||
package org.geysermc.geyser.session.cache;
|
||||
|
||||
import it.unimi.dsi.fastutil.ints.IntArrays;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.GeyserLogger;
|
||||
import org.geysermc.geyser.inventory.GeyserItemStack;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.level.block.type.Block;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.tags.BlockTag;
|
||||
import org.geysermc.geyser.session.cache.tags.EnchantmentTag;
|
||||
import org.geysermc.geyser.session.cache.tags.ItemTag;
|
||||
import org.geysermc.geyser.session.cache.registry.JavaRegistries;
|
||||
import org.geysermc.geyser.session.cache.registry.JavaRegistryKey;
|
||||
import org.geysermc.geyser.session.cache.tags.GeyserHolderSet;
|
||||
import org.geysermc.geyser.session.cache.tags.Tag;
|
||||
import org.geysermc.geyser.util.MinecraftKey;
|
||||
import org.geysermc.geyser.util.Ordered;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.common.clientbound.ClientboundUpdateTagsPacket;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.geysermc.geyser.session.cache.tags.BlockTag.ALL_BLOCK_TAGS;
|
||||
import static org.geysermc.geyser.session.cache.tags.EnchantmentTag.ALL_ENCHANTMENT_TAGS;
|
||||
import static org.geysermc.geyser.session.cache.tags.ItemTag.ALL_ITEM_TAGS;
|
||||
|
||||
/**
|
||||
* Manages information sent from the {@link ClientboundUpdateTagsPacket}. If that packet is not sent, all lists here
|
||||
* will remain empty, matching Java Edition behavior.
|
||||
* will remain empty, matching Java Edition behavior. Looking up a tag that wasn't listed in that packet will return an empty array.
|
||||
* Only tags from suitable registries in {@link JavaRegistries} are stored. Read {@link JavaRegistryKey} for more information.
|
||||
*/
|
||||
@ParametersAreNonnullByDefault
|
||||
public final class TagCache {
|
||||
private final int[][] blocks = new int[ALL_BLOCK_TAGS.size()][];
|
||||
private final int[][] items = new int[ALL_ITEM_TAGS.size()][];
|
||||
private final int[][] enchantments = new int[ALL_ENCHANTMENT_TAGS.size()][];
|
||||
private final GeyserSession session;
|
||||
private final Map<Tag<?>, int[]> tags = new Object2ObjectOpenHashMap<>();
|
||||
|
||||
public TagCache(GeyserSession session) {
|
||||
this.session = session;
|
||||
}
|
||||
|
||||
public void loadPacket(GeyserSession session, ClientboundUpdateTagsPacket packet) {
|
||||
Map<Key, int[]> blockTags = packet.getTags().get(MinecraftKey.key("block"));
|
||||
loadTags("Block", blockTags, ALL_BLOCK_TAGS, this.blocks);
|
||||
|
||||
// Hack btw
|
||||
Map<Key, Map<Key, int[]>> allTags = packet.getTags();
|
||||
GeyserLogger logger = session.getGeyser().getLogger();
|
||||
int[] convertableToMud = blockTags.get(MinecraftKey.key("convertable_to_mud"));
|
||||
boolean emulatePost1_18Logic = convertableToMud != null && convertableToMud.length != 0;
|
||||
session.setEmulatePost1_18Logic(emulatePost1_18Logic);
|
||||
if (logger.isDebug()) {
|
||||
logger.debug("Emulating post 1.18 block predication logic for " + session.bedrockUsername() + "? " + emulatePost1_18Logic);
|
||||
}
|
||||
|
||||
Map<Key, int[]> itemTags = packet.getTags().get(MinecraftKey.key("item"));
|
||||
loadTags("Item", itemTags, ALL_ITEM_TAGS, this.items);
|
||||
this.tags.clear();
|
||||
|
||||
// Hack btw
|
||||
boolean emulatePost1_13Logic = itemTags.get(MinecraftKey.key("signs")).length > 1;
|
||||
session.setEmulatePost1_13Logic(emulatePost1_13Logic);
|
||||
if (logger.isDebug()) {
|
||||
logger.debug("Emulating post 1.13 villager logic for " + session.bedrockUsername() + "? " + emulatePost1_13Logic);
|
||||
}
|
||||
|
||||
Map<Key, int[]> enchantmentTags = packet.getTags().get(MinecraftKey.key("enchantment"));
|
||||
loadTags("Enchantment", enchantmentTags, ALL_ENCHANTMENT_TAGS, this.enchantments);
|
||||
}
|
||||
|
||||
private <T extends Ordered> void loadTags(String type, @Nullable Map<Key, int[]> packetTags, Map<Key, T> allTags, int[][] localValues) {
|
||||
if (packetTags == null) {
|
||||
Arrays.fill(localValues, IntArrays.EMPTY_ARRAY);
|
||||
GeyserImpl.getInstance().getLogger().debug("Not loading " + type + " tags; they do not exist here.");
|
||||
return;
|
||||
}
|
||||
allTags.forEach((location, tag) -> {
|
||||
int[] values = packetTags.get(location);
|
||||
if (values != null) {
|
||||
if (values.length != 0) {
|
||||
localValues[tag.ordinal()] = values;
|
||||
} else {
|
||||
localValues[tag.ordinal()] = IntArrays.EMPTY_ARRAY;
|
||||
}
|
||||
} else {
|
||||
localValues[tag.ordinal()] = IntArrays.EMPTY_ARRAY;
|
||||
GeyserImpl.getInstance().getLogger().debug(type + " tag not found from server: " + location);
|
||||
for (Key registryKey : allTags.keySet()) {
|
||||
JavaRegistryKey<?> registry = JavaRegistries.fromKey(registryKey);
|
||||
if (registry == null || !registry.shouldStoreTags()) {
|
||||
logger.debug("Not loading tags for registry " + registryKey + " (registry not listed in JavaRegistries, or was not suitable to load tags)");
|
||||
continue;
|
||||
}
|
||||
});
|
||||
|
||||
Map<Key, int[]> registryTags = allTags.get(registryKey);
|
||||
|
||||
if (registry == JavaRegistries.BLOCK) {
|
||||
// Hack btw
|
||||
int[] convertableToMud = registryTags.get(MinecraftKey.key("convertable_to_mud"));
|
||||
boolean emulatePost1_18Logic = convertableToMud != null && convertableToMud.length != 0;
|
||||
session.setEmulatePost1_18Logic(emulatePost1_18Logic);
|
||||
if (logger.isDebug()) {
|
||||
logger.debug("Emulating post 1.18 block predication logic for " + session.bedrockUsername() + "? " + emulatePost1_18Logic);
|
||||
}
|
||||
} else if (registry == JavaRegistries.ITEM) {
|
||||
// Hack btw
|
||||
boolean emulatePost1_13Logic = registryTags.get(MinecraftKey.key("signs")).length > 1;
|
||||
session.setEmulatePost1_13Logic(emulatePost1_13Logic);
|
||||
if (logger.isDebug()) {
|
||||
logger.debug("Emulating post 1.13 villager logic for " + session.bedrockUsername() + "? " + emulatePost1_13Logic);
|
||||
}
|
||||
}
|
||||
|
||||
loadTags(registryTags, registry);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the block tag is present and contains this block mapping's Java ID.
|
||||
*/
|
||||
public boolean is(BlockTag tag, Block block) {
|
||||
int[] values = this.blocks[tag.ordinal()];
|
||||
return contains(values, block.javaId());
|
||||
private void loadTags(Map<Key, int[]> packetTags, JavaRegistryKey<?> registry) {
|
||||
for (Map.Entry<Key, int[]> tag : packetTags.entrySet()) {
|
||||
this.tags.put(new Tag<>(registry, tag.getKey()), tag.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
public <T> boolean is(Tag<T> tag, T object) {
|
||||
return contains(getRaw(tag), tag.registry().toNetworkId(session, object));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the item tag is present and contains this item stack's Java ID.
|
||||
*/
|
||||
public boolean is(ItemTag tag, GeyserItemStack itemStack) {
|
||||
public boolean is(Tag<Item> tag, GeyserItemStack itemStack) {
|
||||
return is(tag, itemStack.asItem());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the item tag is present and contains this item's Java ID.
|
||||
* @return true if the specified network ID is in the given holder set.
|
||||
*/
|
||||
public boolean is(ItemTag tag, Item item) {
|
||||
int[] values = this.items[tag.ordinal()];
|
||||
return contains(values, item.javaId());
|
||||
public <T> boolean is(GeyserHolderSet<T> holderSet, T object) {
|
||||
return contains(holderSet.resolveRaw(this), holderSet.getRegistry().toNetworkId(session, object));
|
||||
}
|
||||
|
||||
public int[] get(ItemTag itemTag) {
|
||||
return this.items[itemTag.ordinal()];
|
||||
public <T> List<T> get(Tag<T> tag) {
|
||||
return mapRawArray(session, getRaw(tag), tag.registry());
|
||||
}
|
||||
|
||||
public int[] get(EnchantmentTag enchantmentTag) {
|
||||
return this.enchantments[enchantmentTag.ordinal()];
|
||||
/**
|
||||
* @return the network IDs in the given tag. This can be an empty list.
|
||||
*/
|
||||
public int[] getRaw(Tag<?> tag) {
|
||||
return this.tags.getOrDefault(tag, IntArrays.EMPTY_ARRAY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps a raw array of network IDs to their respective objects.
|
||||
*/
|
||||
public static <T> List<T> mapRawArray(GeyserSession session, int[] array, JavaRegistryKey<T> registry) {
|
||||
return Arrays.stream(array).mapToObj(i -> registry.fromNetworkId(session, i)).toList();
|
||||
}
|
||||
|
||||
private static boolean contains(int[] array, int i) {
|
||||
|
112
core/src/main/java/org/geysermc/geyser/session/cache/registry/JavaRegistries.java
vendored
Normale Datei
112
core/src/main/java/org/geysermc/geyser/session/cache/registry/JavaRegistries.java
vendored
Normale Datei
@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright (c) 2024 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author GeyserMC
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.geyser.session.cache.registry;
|
||||
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.cloudburstmc.protocol.bedrock.data.TrimMaterial;
|
||||
import org.cloudburstmc.protocol.bedrock.data.TrimPattern;
|
||||
import org.geysermc.geyser.entity.type.living.animal.tameable.WolfEntity;
|
||||
import org.geysermc.geyser.inventory.item.BannerPattern;
|
||||
import org.geysermc.geyser.item.enchantment.Enchantment;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.level.JavaDimension;
|
||||
import org.geysermc.geyser.level.JukeboxSong;
|
||||
import org.geysermc.geyser.level.PaintingType;
|
||||
import org.geysermc.geyser.level.block.type.Block;
|
||||
import org.geysermc.geyser.registry.BlockRegistries;
|
||||
import org.geysermc.geyser.registry.ListRegistry;
|
||||
import org.geysermc.geyser.registry.Registries;
|
||||
import org.geysermc.geyser.session.cache.RegistryCache;
|
||||
import org.geysermc.geyser.util.MinecraftKey;
|
||||
import org.geysermc.mcprotocollib.protocol.data.game.chat.ChatType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Stores {@link JavaRegistryKey} for Java registries that are used for loading of data-driven objects, tags, or both. Read {@link JavaRegistryKey} for more information on how to use one.
|
||||
*/
|
||||
public class JavaRegistries {
|
||||
private static final List<JavaRegistryKey<?>> VALUES = new ArrayList<>();
|
||||
|
||||
public static final JavaRegistryKey<Block> BLOCK = create("block", BlockRegistries.JAVA_BLOCKS, Block::javaId);
|
||||
public static final JavaRegistryKey<Item> ITEM = create("item", Registries.JAVA_ITEMS, Item::javaId);
|
||||
public static final JavaRegistryKey<ChatType> CHAT_TYPE = create("chat_type", RegistryCache::chatTypes);
|
||||
public static final JavaRegistryKey<JavaDimension> DIMENSION_TYPE = create("dimension_type", RegistryCache::dimensions);
|
||||
public static final JavaRegistryKey<Enchantment> ENCHANTMENT = create("enchantment", RegistryCache::enchantments);
|
||||
public static final JavaRegistryKey<JukeboxSong> JUKEBOX_SONG = create("jukebox_song", RegistryCache::jukeboxSongs);
|
||||
public static final JavaRegistryKey<PaintingType> PAINTING_VARIANT = create("painting_variant", RegistryCache::paintings);
|
||||
public static final JavaRegistryKey<TrimMaterial> TRIM_MATERIAL = create("trim_material", RegistryCache::trimMaterials);
|
||||
public static final JavaRegistryKey<TrimPattern> TRIM_PATTERN = create("trim_pattern", RegistryCache::trimPatterns);
|
||||
/**
|
||||
* This registry should not be used in holder sets, tags, etc. It's simply used as a mapping from Java biomes to Bedrock ones.
|
||||
*/
|
||||
public static final JavaRegistryKey<Integer> BIOME = create("worldgen/biome");
|
||||
public static final JavaRegistryKey<BannerPattern> BANNER_PATTERN = create("banner_pattern", RegistryCache::bannerPatterns);
|
||||
public static final JavaRegistryKey<WolfEntity.BuiltInWolfVariant> WOLF_VARIANT = create("wolf_variant", RegistryCache::wolfVariants);
|
||||
|
||||
private static <T> JavaRegistryKey<T> create(String key, JavaRegistryKey.NetworkSerializer<T> networkSerializer, JavaRegistryKey.NetworkDeserializer<T> networkDeserializer) {
|
||||
JavaRegistryKey<T> registry = new JavaRegistryKey<>(MinecraftKey.key(key), networkSerializer, networkDeserializer);
|
||||
VALUES.add(registry);
|
||||
return registry;
|
||||
}
|
||||
|
||||
private static <T> JavaRegistryKey<T> create(String key, ListRegistry<T> registry, RegistryNetworkMapper<T> networkSerializer) {
|
||||
return create(key, (session, object) -> networkSerializer.get(object), (session, id) -> registry.get(id));
|
||||
}
|
||||
|
||||
private static <T> JavaRegistryKey<T> create(String key, RegistryGetter<T> getter) {
|
||||
return create(key, (session, object) -> getter.get(session.getRegistryCache()).byValue(object), (session, id) -> getter.get(session.getRegistryCache()).byId(id));
|
||||
}
|
||||
|
||||
private static <T> JavaRegistryKey<T> create(String key) {
|
||||
// Cast for ambiguous call
|
||||
return create(key, (JavaRegistryKey.NetworkSerializer<T>) null, null);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static JavaRegistryKey<?> fromKey(Key registryKey) {
|
||||
for (JavaRegistryKey<?> registry : VALUES) {
|
||||
if (registry.registryKey().equals(registryKey)) {
|
||||
return registry;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
interface RegistryGetter<T> {
|
||||
|
||||
JavaRegistry<T> get(RegistryCache cache);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
interface RegistryNetworkMapper<T> {
|
||||
|
||||
int get(T object);
|
||||
}
|
||||
}
|
86
core/src/main/java/org/geysermc/geyser/session/cache/registry/JavaRegistryKey.java
vendored
Normale Datei
86
core/src/main/java/org/geysermc/geyser/session/cache/registry/JavaRegistryKey.java
vendored
Normale Datei
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (c) 2024 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author GeyserMC
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.geyser.session.cache.registry;
|
||||
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Defines a Java registry, which can be hardcoded or data-driven. This class doesn't store registry contents itself, that is handled by {@link org.geysermc.geyser.session.cache.RegistryCache} in the case of
|
||||
* data-driven registries and other classes in the case of hardcoded registries.
|
||||
*
|
||||
* <p>This class is used when, for a Java registry, data-driven objects or tags need to be loaded. Only one instance of this class should be created for each Java registry. Instances of this
|
||||
* class are kept in {@link JavaRegistries}, which also has useful methods for creating instances of this class. When only using a registry to load data-driven objects, the network (de)serializer parameters
|
||||
* can be null. For tag loading however, these are required, as {@link org.geysermc.geyser.session.cache.TagCache} relies on their functionality.</p>
|
||||
*
|
||||
* @param registryKey the registry key, as it appears on Java.
|
||||
* @param networkSerializer a method that converts an object in this registry to its network ID.
|
||||
* @param networkDeserializer a method that converts a network ID to an object in this registry.
|
||||
* @param <T> the object type this registry holds.
|
||||
*/
|
||||
public record JavaRegistryKey<T>(Key registryKey, @Nullable NetworkSerializer<T> networkSerializer, @Nullable NetworkDeserializer<T> networkDeserializer) {
|
||||
|
||||
/**
|
||||
* Converts an object in this registry to its network ID. This will fail if this registry doesn't have a network serializer.
|
||||
*/
|
||||
public int toNetworkId(GeyserSession session, T object) {
|
||||
if (networkSerializer == null) {
|
||||
throw new UnsupportedOperationException("Registry does not hava a network serializer");
|
||||
}
|
||||
return networkSerializer.toNetworkId(session, object);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a network ID to an object in this registry. This will fail if this registry doesn't have a network deserializer.
|
||||
*/
|
||||
public T fromNetworkId(GeyserSession session, int networkId) {
|
||||
if (networkDeserializer == null) {
|
||||
throw new UnsupportedOperationException("Registry does not hava a network deserializer");
|
||||
}
|
||||
return networkDeserializer.fromNetworkId(session, networkId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if this registry has a network serializer and deserializer.
|
||||
*/
|
||||
public boolean shouldStoreTags() {
|
||||
return networkSerializer != null && networkDeserializer != null;
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface NetworkSerializer<T> {
|
||||
|
||||
int toNetworkId(GeyserSession session, T object);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface NetworkDeserializer<T> {
|
||||
|
||||
T fromNetworkId(GeyserSession session, int networkId);
|
||||
}
|
||||
}
|
@ -25,214 +25,203 @@
|
||||
|
||||
package org.geysermc.geyser.session.cache.tags;
|
||||
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.geysermc.geyser.util.Ordered;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.geysermc.geyser.level.block.type.Block;
|
||||
import org.geysermc.geyser.session.cache.registry.JavaRegistries;
|
||||
import org.geysermc.geyser.util.MinecraftKey;
|
||||
|
||||
/**
|
||||
* Lists vanilla block tags.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public final class BlockTag implements Ordered {
|
||||
public static final Map<Key, BlockTag> ALL_BLOCK_TAGS = new HashMap<>();
|
||||
public final class BlockTag {
|
||||
public static final Tag<Block> WOOL = create("wool");
|
||||
public static final Tag<Block> PLANKS = create("planks");
|
||||
public static final Tag<Block> STONE_BRICKS = create("stone_bricks");
|
||||
public static final Tag<Block> WOODEN_BUTTONS = create("wooden_buttons");
|
||||
public static final Tag<Block> STONE_BUTTONS = create("stone_buttons");
|
||||
public static final Tag<Block> BUTTONS = create("buttons");
|
||||
public static final Tag<Block> WOOL_CARPETS = create("wool_carpets");
|
||||
public static final Tag<Block> WOODEN_DOORS = create("wooden_doors");
|
||||
public static final Tag<Block> MOB_INTERACTABLE_DOORS = create("mob_interactable_doors");
|
||||
public static final Tag<Block> WOODEN_STAIRS = create("wooden_stairs");
|
||||
public static final Tag<Block> WOODEN_SLABS = create("wooden_slabs");
|
||||
public static final Tag<Block> WOODEN_FENCES = create("wooden_fences");
|
||||
public static final Tag<Block> PRESSURE_PLATES = create("pressure_plates");
|
||||
public static final Tag<Block> WOODEN_PRESSURE_PLATES = create("wooden_pressure_plates");
|
||||
public static final Tag<Block> STONE_PRESSURE_PLATES = create("stone_pressure_plates");
|
||||
public static final Tag<Block> WOODEN_TRAPDOORS = create("wooden_trapdoors");
|
||||
public static final Tag<Block> DOORS = create("doors");
|
||||
public static final Tag<Block> SAPLINGS = create("saplings");
|
||||
public static final Tag<Block> LOGS_THAT_BURN = create("logs_that_burn");
|
||||
public static final Tag<Block> OVERWORLD_NATURAL_LOGS = create("overworld_natural_logs");
|
||||
public static final Tag<Block> LOGS = create("logs");
|
||||
public static final Tag<Block> DARK_OAK_LOGS = create("dark_oak_logs");
|
||||
public static final Tag<Block> OAK_LOGS = create("oak_logs");
|
||||
public static final Tag<Block> BIRCH_LOGS = create("birch_logs");
|
||||
public static final Tag<Block> ACACIA_LOGS = create("acacia_logs");
|
||||
public static final Tag<Block> CHERRY_LOGS = create("cherry_logs");
|
||||
public static final Tag<Block> JUNGLE_LOGS = create("jungle_logs");
|
||||
public static final Tag<Block> SPRUCE_LOGS = create("spruce_logs");
|
||||
public static final Tag<Block> MANGROVE_LOGS = create("mangrove_logs");
|
||||
public static final Tag<Block> CRIMSON_STEMS = create("crimson_stems");
|
||||
public static final Tag<Block> WARPED_STEMS = create("warped_stems");
|
||||
public static final Tag<Block> BAMBOO_BLOCKS = create("bamboo_blocks");
|
||||
public static final Tag<Block> WART_BLOCKS = create("wart_blocks");
|
||||
public static final Tag<Block> BANNERS = create("banners");
|
||||
public static final Tag<Block> SAND = create("sand");
|
||||
public static final Tag<Block> SMELTS_TO_GLASS = create("smelts_to_glass");
|
||||
public static final Tag<Block> STAIRS = create("stairs");
|
||||
public static final Tag<Block> SLABS = create("slabs");
|
||||
public static final Tag<Block> WALLS = create("walls");
|
||||
public static final Tag<Block> ANVIL = create("anvil");
|
||||
public static final Tag<Block> RAILS = create("rails");
|
||||
public static final Tag<Block> LEAVES = create("leaves");
|
||||
public static final Tag<Block> TRAPDOORS = create("trapdoors");
|
||||
public static final Tag<Block> SMALL_FLOWERS = create("small_flowers");
|
||||
public static final Tag<Block> BEDS = create("beds");
|
||||
public static final Tag<Block> FENCES = create("fences");
|
||||
public static final Tag<Block> TALL_FLOWERS = create("tall_flowers");
|
||||
public static final Tag<Block> FLOWERS = create("flowers");
|
||||
public static final Tag<Block> PIGLIN_REPELLENTS = create("piglin_repellents");
|
||||
public static final Tag<Block> GOLD_ORES = create("gold_ores");
|
||||
public static final Tag<Block> IRON_ORES = create("iron_ores");
|
||||
public static final Tag<Block> DIAMOND_ORES = create("diamond_ores");
|
||||
public static final Tag<Block> REDSTONE_ORES = create("redstone_ores");
|
||||
public static final Tag<Block> LAPIS_ORES = create("lapis_ores");
|
||||
public static final Tag<Block> COAL_ORES = create("coal_ores");
|
||||
public static final Tag<Block> EMERALD_ORES = create("emerald_ores");
|
||||
public static final Tag<Block> COPPER_ORES = create("copper_ores");
|
||||
public static final Tag<Block> CANDLES = create("candles");
|
||||
public static final Tag<Block> DIRT = create("dirt");
|
||||
public static final Tag<Block> TERRACOTTA = create("terracotta");
|
||||
public static final Tag<Block> BADLANDS_TERRACOTTA = create("badlands_terracotta");
|
||||
public static final Tag<Block> CONCRETE_POWDER = create("concrete_powder");
|
||||
public static final Tag<Block> COMPLETES_FIND_TREE_TUTORIAL = create("completes_find_tree_tutorial");
|
||||
public static final Tag<Block> FLOWER_POTS = create("flower_pots");
|
||||
public static final Tag<Block> ENDERMAN_HOLDABLE = create("enderman_holdable");
|
||||
public static final Tag<Block> ICE = create("ice");
|
||||
public static final Tag<Block> VALID_SPAWN = create("valid_spawn");
|
||||
public static final Tag<Block> IMPERMEABLE = create("impermeable");
|
||||
public static final Tag<Block> UNDERWATER_BONEMEALS = create("underwater_bonemeals");
|
||||
public static final Tag<Block> CORAL_BLOCKS = create("coral_blocks");
|
||||
public static final Tag<Block> WALL_CORALS = create("wall_corals");
|
||||
public static final Tag<Block> CORAL_PLANTS = create("coral_plants");
|
||||
public static final Tag<Block> CORALS = create("corals");
|
||||
public static final Tag<Block> BAMBOO_PLANTABLE_ON = create("bamboo_plantable_on");
|
||||
public static final Tag<Block> STANDING_SIGNS = create("standing_signs");
|
||||
public static final Tag<Block> WALL_SIGNS = create("wall_signs");
|
||||
public static final Tag<Block> SIGNS = create("signs");
|
||||
public static final Tag<Block> CEILING_HANGING_SIGNS = create("ceiling_hanging_signs");
|
||||
public static final Tag<Block> WALL_HANGING_SIGNS = create("wall_hanging_signs");
|
||||
public static final Tag<Block> ALL_HANGING_SIGNS = create("all_hanging_signs");
|
||||
public static final Tag<Block> ALL_SIGNS = create("all_signs");
|
||||
public static final Tag<Block> DRAGON_IMMUNE = create("dragon_immune");
|
||||
public static final Tag<Block> DRAGON_TRANSPARENT = create("dragon_transparent");
|
||||
public static final Tag<Block> WITHER_IMMUNE = create("wither_immune");
|
||||
public static final Tag<Block> WITHER_SUMMON_BASE_BLOCKS = create("wither_summon_base_blocks");
|
||||
public static final Tag<Block> BEEHIVES = create("beehives");
|
||||
public static final Tag<Block> CROPS = create("crops");
|
||||
public static final Tag<Block> BEE_GROWABLES = create("bee_growables");
|
||||
public static final Tag<Block> PORTALS = create("portals");
|
||||
public static final Tag<Block> FIRE = create("fire");
|
||||
public static final Tag<Block> NYLIUM = create("nylium");
|
||||
public static final Tag<Block> BEACON_BASE_BLOCKS = create("beacon_base_blocks");
|
||||
public static final Tag<Block> SOUL_SPEED_BLOCKS = create("soul_speed_blocks");
|
||||
public static final Tag<Block> WALL_POST_OVERRIDE = create("wall_post_override");
|
||||
public static final Tag<Block> CLIMBABLE = create("climbable");
|
||||
public static final Tag<Block> FALL_DAMAGE_RESETTING = create("fall_damage_resetting");
|
||||
public static final Tag<Block> SHULKER_BOXES = create("shulker_boxes");
|
||||
public static final Tag<Block> HOGLIN_REPELLENTS = create("hoglin_repellents");
|
||||
public static final Tag<Block> SOUL_FIRE_BASE_BLOCKS = create("soul_fire_base_blocks");
|
||||
public static final Tag<Block> STRIDER_WARM_BLOCKS = create("strider_warm_blocks");
|
||||
public static final Tag<Block> CAMPFIRES = create("campfires");
|
||||
public static final Tag<Block> GUARDED_BY_PIGLINS = create("guarded_by_piglins");
|
||||
public static final Tag<Block> PREVENT_MOB_SPAWNING_INSIDE = create("prevent_mob_spawning_inside");
|
||||
public static final Tag<Block> FENCE_GATES = create("fence_gates");
|
||||
public static final Tag<Block> UNSTABLE_BOTTOM_CENTER = create("unstable_bottom_center");
|
||||
public static final Tag<Block> MUSHROOM_GROW_BLOCK = create("mushroom_grow_block");
|
||||
public static final Tag<Block> INFINIBURN_OVERWORLD = create("infiniburn_overworld");
|
||||
public static final Tag<Block> INFINIBURN_NETHER = create("infiniburn_nether");
|
||||
public static final Tag<Block> INFINIBURN_END = create("infiniburn_end");
|
||||
public static final Tag<Block> BASE_STONE_OVERWORLD = create("base_stone_overworld");
|
||||
public static final Tag<Block> STONE_ORE_REPLACEABLES = create("stone_ore_replaceables");
|
||||
public static final Tag<Block> DEEPSLATE_ORE_REPLACEABLES = create("deepslate_ore_replaceables");
|
||||
public static final Tag<Block> BASE_STONE_NETHER = create("base_stone_nether");
|
||||
public static final Tag<Block> OVERWORLD_CARVER_REPLACEABLES = create("overworld_carver_replaceables");
|
||||
public static final Tag<Block> NETHER_CARVER_REPLACEABLES = create("nether_carver_replaceables");
|
||||
public static final Tag<Block> CANDLE_CAKES = create("candle_cakes");
|
||||
public static final Tag<Block> CAULDRONS = create("cauldrons");
|
||||
public static final Tag<Block> CRYSTAL_SOUND_BLOCKS = create("crystal_sound_blocks");
|
||||
public static final Tag<Block> INSIDE_STEP_SOUND_BLOCKS = create("inside_step_sound_blocks");
|
||||
public static final Tag<Block> COMBINATION_STEP_SOUND_BLOCKS = create("combination_step_sound_blocks");
|
||||
public static final Tag<Block> CAMEL_SAND_STEP_SOUND_BLOCKS = create("camel_sand_step_sound_blocks");
|
||||
public static final Tag<Block> OCCLUDES_VIBRATION_SIGNALS = create("occludes_vibration_signals");
|
||||
public static final Tag<Block> DAMPENS_VIBRATIONS = create("dampens_vibrations");
|
||||
public static final Tag<Block> DRIPSTONE_REPLACEABLE_BLOCKS = create("dripstone_replaceable_blocks");
|
||||
public static final Tag<Block> CAVE_VINES = create("cave_vines");
|
||||
public static final Tag<Block> MOSS_REPLACEABLE = create("moss_replaceable");
|
||||
public static final Tag<Block> LUSH_GROUND_REPLACEABLE = create("lush_ground_replaceable");
|
||||
public static final Tag<Block> AZALEA_ROOT_REPLACEABLE = create("azalea_root_replaceable");
|
||||
public static final Tag<Block> SMALL_DRIPLEAF_PLACEABLE = create("small_dripleaf_placeable");
|
||||
public static final Tag<Block> BIG_DRIPLEAF_PLACEABLE = create("big_dripleaf_placeable");
|
||||
public static final Tag<Block> SNOW = create("snow");
|
||||
public static final Tag<Block> MINEABLE_AXE = create("mineable/axe");
|
||||
public static final Tag<Block> MINEABLE_HOE = create("mineable/hoe");
|
||||
public static final Tag<Block> MINEABLE_PICKAXE = create("mineable/pickaxe");
|
||||
public static final Tag<Block> MINEABLE_SHOVEL = create("mineable/shovel");
|
||||
public static final Tag<Block> SWORD_EFFICIENT = create("sword_efficient");
|
||||
public static final Tag<Block> NEEDS_DIAMOND_TOOL = create("needs_diamond_tool");
|
||||
public static final Tag<Block> NEEDS_IRON_TOOL = create("needs_iron_tool");
|
||||
public static final Tag<Block> NEEDS_STONE_TOOL = create("needs_stone_tool");
|
||||
public static final Tag<Block> INCORRECT_FOR_NETHERITE_TOOL = create("incorrect_for_netherite_tool");
|
||||
public static final Tag<Block> INCORRECT_FOR_DIAMOND_TOOL = create("incorrect_for_diamond_tool");
|
||||
public static final Tag<Block> INCORRECT_FOR_IRON_TOOL = create("incorrect_for_iron_tool");
|
||||
public static final Tag<Block> INCORRECT_FOR_STONE_TOOL = create("incorrect_for_stone_tool");
|
||||
public static final Tag<Block> INCORRECT_FOR_GOLD_TOOL = create("incorrect_for_gold_tool");
|
||||
public static final Tag<Block> INCORRECT_FOR_WOODEN_TOOL = create("incorrect_for_wooden_tool");
|
||||
public static final Tag<Block> FEATURES_CANNOT_REPLACE = create("features_cannot_replace");
|
||||
public static final Tag<Block> LAVA_POOL_STONE_CANNOT_REPLACE = create("lava_pool_stone_cannot_replace");
|
||||
public static final Tag<Block> GEODE_INVALID_BLOCKS = create("geode_invalid_blocks");
|
||||
public static final Tag<Block> FROG_PREFER_JUMP_TO = create("frog_prefer_jump_to");
|
||||
public static final Tag<Block> SCULK_REPLACEABLE = create("sculk_replaceable");
|
||||
public static final Tag<Block> SCULK_REPLACEABLE_WORLD_GEN = create("sculk_replaceable_world_gen");
|
||||
public static final Tag<Block> ANCIENT_CITY_REPLACEABLE = create("ancient_city_replaceable");
|
||||
public static final Tag<Block> VIBRATION_RESONATORS = create("vibration_resonators");
|
||||
public static final Tag<Block> ANIMALS_SPAWNABLE_ON = create("animals_spawnable_on");
|
||||
public static final Tag<Block> ARMADILLO_SPAWNABLE_ON = create("armadillo_spawnable_on");
|
||||
public static final Tag<Block> AXOLOTLS_SPAWNABLE_ON = create("axolotls_spawnable_on");
|
||||
public static final Tag<Block> GOATS_SPAWNABLE_ON = create("goats_spawnable_on");
|
||||
public static final Tag<Block> MOOSHROOMS_SPAWNABLE_ON = create("mooshrooms_spawnable_on");
|
||||
public static final Tag<Block> PARROTS_SPAWNABLE_ON = create("parrots_spawnable_on");
|
||||
public static final Tag<Block> POLAR_BEARS_SPAWNABLE_ON_ALTERNATE = create("polar_bears_spawnable_on_alternate");
|
||||
public static final Tag<Block> RABBITS_SPAWNABLE_ON = create("rabbits_spawnable_on");
|
||||
public static final Tag<Block> FOXES_SPAWNABLE_ON = create("foxes_spawnable_on");
|
||||
public static final Tag<Block> WOLVES_SPAWNABLE_ON = create("wolves_spawnable_on");
|
||||
public static final Tag<Block> FROGS_SPAWNABLE_ON = create("frogs_spawnable_on");
|
||||
public static final Tag<Block> AZALEA_GROWS_ON = create("azalea_grows_on");
|
||||
public static final Tag<Block> CONVERTABLE_TO_MUD = create("convertable_to_mud");
|
||||
public static final Tag<Block> MANGROVE_LOGS_CAN_GROW_THROUGH = create("mangrove_logs_can_grow_through");
|
||||
public static final Tag<Block> MANGROVE_ROOTS_CAN_GROW_THROUGH = create("mangrove_roots_can_grow_through");
|
||||
public static final Tag<Block> DEAD_BUSH_MAY_PLACE_ON = create("dead_bush_may_place_on");
|
||||
public static final Tag<Block> SNAPS_GOAT_HORN = create("snaps_goat_horn");
|
||||
public static final Tag<Block> REPLACEABLE_BY_TREES = create("replaceable_by_trees");
|
||||
public static final Tag<Block> SNOW_LAYER_CANNOT_SURVIVE_ON = create("snow_layer_cannot_survive_on");
|
||||
public static final Tag<Block> SNOW_LAYER_CAN_SURVIVE_ON = create("snow_layer_can_survive_on");
|
||||
public static final Tag<Block> INVALID_SPAWN_INSIDE = create("invalid_spawn_inside");
|
||||
public static final Tag<Block> SNIFFER_DIGGABLE_BLOCK = create("sniffer_diggable_block");
|
||||
public static final Tag<Block> SNIFFER_EGG_HATCH_BOOST = create("sniffer_egg_hatch_boost");
|
||||
public static final Tag<Block> TRAIL_RUINS_REPLACEABLE = create("trail_ruins_replaceable");
|
||||
public static final Tag<Block> REPLACEABLE = create("replaceable");
|
||||
public static final Tag<Block> ENCHANTMENT_POWER_PROVIDER = create("enchantment_power_provider");
|
||||
public static final Tag<Block> ENCHANTMENT_POWER_TRANSMITTER = create("enchantment_power_transmitter");
|
||||
public static final Tag<Block> MAINTAINS_FARMLAND = create("maintains_farmland");
|
||||
public static final Tag<Block> BLOCKS_WIND_CHARGE_EXPLOSIONS = create("blocks_wind_charge_explosions");
|
||||
public static final Tag<Block> DOES_NOT_BLOCK_HOPPERS = create("does_not_block_hoppers");
|
||||
public static final Tag<Block> AIR = create("air");
|
||||
|
||||
public static final BlockTag WOOL = new BlockTag("wool");
|
||||
public static final BlockTag PLANKS = new BlockTag("planks");
|
||||
public static final BlockTag STONE_BRICKS = new BlockTag("stone_bricks");
|
||||
public static final BlockTag WOODEN_BUTTONS = new BlockTag("wooden_buttons");
|
||||
public static final BlockTag STONE_BUTTONS = new BlockTag("stone_buttons");
|
||||
public static final BlockTag BUTTONS = new BlockTag("buttons");
|
||||
public static final BlockTag WOOL_CARPETS = new BlockTag("wool_carpets");
|
||||
public static final BlockTag WOODEN_DOORS = new BlockTag("wooden_doors");
|
||||
public static final BlockTag MOB_INTERACTABLE_DOORS = new BlockTag("mob_interactable_doors");
|
||||
public static final BlockTag WOODEN_STAIRS = new BlockTag("wooden_stairs");
|
||||
public static final BlockTag WOODEN_SLABS = new BlockTag("wooden_slabs");
|
||||
public static final BlockTag WOODEN_FENCES = new BlockTag("wooden_fences");
|
||||
public static final BlockTag PRESSURE_PLATES = new BlockTag("pressure_plates");
|
||||
public static final BlockTag WOODEN_PRESSURE_PLATES = new BlockTag("wooden_pressure_plates");
|
||||
public static final BlockTag STONE_PRESSURE_PLATES = new BlockTag("stone_pressure_plates");
|
||||
public static final BlockTag WOODEN_TRAPDOORS = new BlockTag("wooden_trapdoors");
|
||||
public static final BlockTag DOORS = new BlockTag("doors");
|
||||
public static final BlockTag SAPLINGS = new BlockTag("saplings");
|
||||
public static final BlockTag LOGS_THAT_BURN = new BlockTag("logs_that_burn");
|
||||
public static final BlockTag OVERWORLD_NATURAL_LOGS = new BlockTag("overworld_natural_logs");
|
||||
public static final BlockTag LOGS = new BlockTag("logs");
|
||||
public static final BlockTag DARK_OAK_LOGS = new BlockTag("dark_oak_logs");
|
||||
public static final BlockTag OAK_LOGS = new BlockTag("oak_logs");
|
||||
public static final BlockTag BIRCH_LOGS = new BlockTag("birch_logs");
|
||||
public static final BlockTag ACACIA_LOGS = new BlockTag("acacia_logs");
|
||||
public static final BlockTag CHERRY_LOGS = new BlockTag("cherry_logs");
|
||||
public static final BlockTag JUNGLE_LOGS = new BlockTag("jungle_logs");
|
||||
public static final BlockTag SPRUCE_LOGS = new BlockTag("spruce_logs");
|
||||
public static final BlockTag MANGROVE_LOGS = new BlockTag("mangrove_logs");
|
||||
public static final BlockTag CRIMSON_STEMS = new BlockTag("crimson_stems");
|
||||
public static final BlockTag WARPED_STEMS = new BlockTag("warped_stems");
|
||||
public static final BlockTag BAMBOO_BLOCKS = new BlockTag("bamboo_blocks");
|
||||
public static final BlockTag WART_BLOCKS = new BlockTag("wart_blocks");
|
||||
public static final BlockTag BANNERS = new BlockTag("banners");
|
||||
public static final BlockTag SAND = new BlockTag("sand");
|
||||
public static final BlockTag SMELTS_TO_GLASS = new BlockTag("smelts_to_glass");
|
||||
public static final BlockTag STAIRS = new BlockTag("stairs");
|
||||
public static final BlockTag SLABS = new BlockTag("slabs");
|
||||
public static final BlockTag WALLS = new BlockTag("walls");
|
||||
public static final BlockTag ANVIL = new BlockTag("anvil");
|
||||
public static final BlockTag RAILS = new BlockTag("rails");
|
||||
public static final BlockTag LEAVES = new BlockTag("leaves");
|
||||
public static final BlockTag TRAPDOORS = new BlockTag("trapdoors");
|
||||
public static final BlockTag SMALL_FLOWERS = new BlockTag("small_flowers");
|
||||
public static final BlockTag BEDS = new BlockTag("beds");
|
||||
public static final BlockTag FENCES = new BlockTag("fences");
|
||||
public static final BlockTag TALL_FLOWERS = new BlockTag("tall_flowers");
|
||||
public static final BlockTag FLOWERS = new BlockTag("flowers");
|
||||
public static final BlockTag PIGLIN_REPELLENTS = new BlockTag("piglin_repellents");
|
||||
public static final BlockTag GOLD_ORES = new BlockTag("gold_ores");
|
||||
public static final BlockTag IRON_ORES = new BlockTag("iron_ores");
|
||||
public static final BlockTag DIAMOND_ORES = new BlockTag("diamond_ores");
|
||||
public static final BlockTag REDSTONE_ORES = new BlockTag("redstone_ores");
|
||||
public static final BlockTag LAPIS_ORES = new BlockTag("lapis_ores");
|
||||
public static final BlockTag COAL_ORES = new BlockTag("coal_ores");
|
||||
public static final BlockTag EMERALD_ORES = new BlockTag("emerald_ores");
|
||||
public static final BlockTag COPPER_ORES = new BlockTag("copper_ores");
|
||||
public static final BlockTag CANDLES = new BlockTag("candles");
|
||||
public static final BlockTag DIRT = new BlockTag("dirt");
|
||||
public static final BlockTag TERRACOTTA = new BlockTag("terracotta");
|
||||
public static final BlockTag BADLANDS_TERRACOTTA = new BlockTag("badlands_terracotta");
|
||||
public static final BlockTag CONCRETE_POWDER = new BlockTag("concrete_powder");
|
||||
public static final BlockTag COMPLETES_FIND_TREE_TUTORIAL = new BlockTag("completes_find_tree_tutorial");
|
||||
public static final BlockTag FLOWER_POTS = new BlockTag("flower_pots");
|
||||
public static final BlockTag ENDERMAN_HOLDABLE = new BlockTag("enderman_holdable");
|
||||
public static final BlockTag ICE = new BlockTag("ice");
|
||||
public static final BlockTag VALID_SPAWN = new BlockTag("valid_spawn");
|
||||
public static final BlockTag IMPERMEABLE = new BlockTag("impermeable");
|
||||
public static final BlockTag UNDERWATER_BONEMEALS = new BlockTag("underwater_bonemeals");
|
||||
public static final BlockTag CORAL_BLOCKS = new BlockTag("coral_blocks");
|
||||
public static final BlockTag WALL_CORALS = new BlockTag("wall_corals");
|
||||
public static final BlockTag CORAL_PLANTS = new BlockTag("coral_plants");
|
||||
public static final BlockTag CORALS = new BlockTag("corals");
|
||||
public static final BlockTag BAMBOO_PLANTABLE_ON = new BlockTag("bamboo_plantable_on");
|
||||
public static final BlockTag STANDING_SIGNS = new BlockTag("standing_signs");
|
||||
public static final BlockTag WALL_SIGNS = new BlockTag("wall_signs");
|
||||
public static final BlockTag SIGNS = new BlockTag("signs");
|
||||
public static final BlockTag CEILING_HANGING_SIGNS = new BlockTag("ceiling_hanging_signs");
|
||||
public static final BlockTag WALL_HANGING_SIGNS = new BlockTag("wall_hanging_signs");
|
||||
public static final BlockTag ALL_HANGING_SIGNS = new BlockTag("all_hanging_signs");
|
||||
public static final BlockTag ALL_SIGNS = new BlockTag("all_signs");
|
||||
public static final BlockTag DRAGON_IMMUNE = new BlockTag("dragon_immune");
|
||||
public static final BlockTag DRAGON_TRANSPARENT = new BlockTag("dragon_transparent");
|
||||
public static final BlockTag WITHER_IMMUNE = new BlockTag("wither_immune");
|
||||
public static final BlockTag WITHER_SUMMON_BASE_BLOCKS = new BlockTag("wither_summon_base_blocks");
|
||||
public static final BlockTag BEEHIVES = new BlockTag("beehives");
|
||||
public static final BlockTag CROPS = new BlockTag("crops");
|
||||
public static final BlockTag BEE_GROWABLES = new BlockTag("bee_growables");
|
||||
public static final BlockTag PORTALS = new BlockTag("portals");
|
||||
public static final BlockTag FIRE = new BlockTag("fire");
|
||||
public static final BlockTag NYLIUM = new BlockTag("nylium");
|
||||
public static final BlockTag BEACON_BASE_BLOCKS = new BlockTag("beacon_base_blocks");
|
||||
public static final BlockTag SOUL_SPEED_BLOCKS = new BlockTag("soul_speed_blocks");
|
||||
public static final BlockTag WALL_POST_OVERRIDE = new BlockTag("wall_post_override");
|
||||
public static final BlockTag CLIMBABLE = new BlockTag("climbable");
|
||||
public static final BlockTag FALL_DAMAGE_RESETTING = new BlockTag("fall_damage_resetting");
|
||||
public static final BlockTag SHULKER_BOXES = new BlockTag("shulker_boxes");
|
||||
public static final BlockTag HOGLIN_REPELLENTS = new BlockTag("hoglin_repellents");
|
||||
public static final BlockTag SOUL_FIRE_BASE_BLOCKS = new BlockTag("soul_fire_base_blocks");
|
||||
public static final BlockTag STRIDER_WARM_BLOCKS = new BlockTag("strider_warm_blocks");
|
||||
public static final BlockTag CAMPFIRES = new BlockTag("campfires");
|
||||
public static final BlockTag GUARDED_BY_PIGLINS = new BlockTag("guarded_by_piglins");
|
||||
public static final BlockTag PREVENT_MOB_SPAWNING_INSIDE = new BlockTag("prevent_mob_spawning_inside");
|
||||
public static final BlockTag FENCE_GATES = new BlockTag("fence_gates");
|
||||
public static final BlockTag UNSTABLE_BOTTOM_CENTER = new BlockTag("unstable_bottom_center");
|
||||
public static final BlockTag MUSHROOM_GROW_BLOCK = new BlockTag("mushroom_grow_block");
|
||||
public static final BlockTag INFINIBURN_OVERWORLD = new BlockTag("infiniburn_overworld");
|
||||
public static final BlockTag INFINIBURN_NETHER = new BlockTag("infiniburn_nether");
|
||||
public static final BlockTag INFINIBURN_END = new BlockTag("infiniburn_end");
|
||||
public static final BlockTag BASE_STONE_OVERWORLD = new BlockTag("base_stone_overworld");
|
||||
public static final BlockTag STONE_ORE_REPLACEABLES = new BlockTag("stone_ore_replaceables");
|
||||
public static final BlockTag DEEPSLATE_ORE_REPLACEABLES = new BlockTag("deepslate_ore_replaceables");
|
||||
public static final BlockTag BASE_STONE_NETHER = new BlockTag("base_stone_nether");
|
||||
public static final BlockTag OVERWORLD_CARVER_REPLACEABLES = new BlockTag("overworld_carver_replaceables");
|
||||
public static final BlockTag NETHER_CARVER_REPLACEABLES = new BlockTag("nether_carver_replaceables");
|
||||
public static final BlockTag CANDLE_CAKES = new BlockTag("candle_cakes");
|
||||
public static final BlockTag CAULDRONS = new BlockTag("cauldrons");
|
||||
public static final BlockTag CRYSTAL_SOUND_BLOCKS = new BlockTag("crystal_sound_blocks");
|
||||
public static final BlockTag INSIDE_STEP_SOUND_BLOCKS = new BlockTag("inside_step_sound_blocks");
|
||||
public static final BlockTag COMBINATION_STEP_SOUND_BLOCKS = new BlockTag("combination_step_sound_blocks");
|
||||
public static final BlockTag CAMEL_SAND_STEP_SOUND_BLOCKS = new BlockTag("camel_sand_step_sound_blocks");
|
||||
public static final BlockTag OCCLUDES_VIBRATION_SIGNALS = new BlockTag("occludes_vibration_signals");
|
||||
public static final BlockTag DAMPENS_VIBRATIONS = new BlockTag("dampens_vibrations");
|
||||
public static final BlockTag DRIPSTONE_REPLACEABLE_BLOCKS = new BlockTag("dripstone_replaceable_blocks");
|
||||
public static final BlockTag CAVE_VINES = new BlockTag("cave_vines");
|
||||
public static final BlockTag MOSS_REPLACEABLE = new BlockTag("moss_replaceable");
|
||||
public static final BlockTag LUSH_GROUND_REPLACEABLE = new BlockTag("lush_ground_replaceable");
|
||||
public static final BlockTag AZALEA_ROOT_REPLACEABLE = new BlockTag("azalea_root_replaceable");
|
||||
public static final BlockTag SMALL_DRIPLEAF_PLACEABLE = new BlockTag("small_dripleaf_placeable");
|
||||
public static final BlockTag BIG_DRIPLEAF_PLACEABLE = new BlockTag("big_dripleaf_placeable");
|
||||
public static final BlockTag SNOW = new BlockTag("snow");
|
||||
public static final BlockTag MINEABLE_AXE = new BlockTag("mineable/axe");
|
||||
public static final BlockTag MINEABLE_HOE = new BlockTag("mineable/hoe");
|
||||
public static final BlockTag MINEABLE_PICKAXE = new BlockTag("mineable/pickaxe");
|
||||
public static final BlockTag MINEABLE_SHOVEL = new BlockTag("mineable/shovel");
|
||||
public static final BlockTag SWORD_EFFICIENT = new BlockTag("sword_efficient");
|
||||
public static final BlockTag NEEDS_DIAMOND_TOOL = new BlockTag("needs_diamond_tool");
|
||||
public static final BlockTag NEEDS_IRON_TOOL = new BlockTag("needs_iron_tool");
|
||||
public static final BlockTag NEEDS_STONE_TOOL = new BlockTag("needs_stone_tool");
|
||||
public static final BlockTag INCORRECT_FOR_NETHERITE_TOOL = new BlockTag("incorrect_for_netherite_tool");
|
||||
public static final BlockTag INCORRECT_FOR_DIAMOND_TOOL = new BlockTag("incorrect_for_diamond_tool");
|
||||
public static final BlockTag INCORRECT_FOR_IRON_TOOL = new BlockTag("incorrect_for_iron_tool");
|
||||
public static final BlockTag INCORRECT_FOR_STONE_TOOL = new BlockTag("incorrect_for_stone_tool");
|
||||
public static final BlockTag INCORRECT_FOR_GOLD_TOOL = new BlockTag("incorrect_for_gold_tool");
|
||||
public static final BlockTag INCORRECT_FOR_WOODEN_TOOL = new BlockTag("incorrect_for_wooden_tool");
|
||||
public static final BlockTag FEATURES_CANNOT_REPLACE = new BlockTag("features_cannot_replace");
|
||||
public static final BlockTag LAVA_POOL_STONE_CANNOT_REPLACE = new BlockTag("lava_pool_stone_cannot_replace");
|
||||
public static final BlockTag GEODE_INVALID_BLOCKS = new BlockTag("geode_invalid_blocks");
|
||||
public static final BlockTag FROG_PREFER_JUMP_TO = new BlockTag("frog_prefer_jump_to");
|
||||
public static final BlockTag SCULK_REPLACEABLE = new BlockTag("sculk_replaceable");
|
||||
public static final BlockTag SCULK_REPLACEABLE_WORLD_GEN = new BlockTag("sculk_replaceable_world_gen");
|
||||
public static final BlockTag ANCIENT_CITY_REPLACEABLE = new BlockTag("ancient_city_replaceable");
|
||||
public static final BlockTag VIBRATION_RESONATORS = new BlockTag("vibration_resonators");
|
||||
public static final BlockTag ANIMALS_SPAWNABLE_ON = new BlockTag("animals_spawnable_on");
|
||||
public static final BlockTag ARMADILLO_SPAWNABLE_ON = new BlockTag("armadillo_spawnable_on");
|
||||
public static final BlockTag AXOLOTLS_SPAWNABLE_ON = new BlockTag("axolotls_spawnable_on");
|
||||
public static final BlockTag GOATS_SPAWNABLE_ON = new BlockTag("goats_spawnable_on");
|
||||
public static final BlockTag MOOSHROOMS_SPAWNABLE_ON = new BlockTag("mooshrooms_spawnable_on");
|
||||
public static final BlockTag PARROTS_SPAWNABLE_ON = new BlockTag("parrots_spawnable_on");
|
||||
public static final BlockTag POLAR_BEARS_SPAWNABLE_ON_ALTERNATE = new BlockTag("polar_bears_spawnable_on_alternate");
|
||||
public static final BlockTag RABBITS_SPAWNABLE_ON = new BlockTag("rabbits_spawnable_on");
|
||||
public static final BlockTag FOXES_SPAWNABLE_ON = new BlockTag("foxes_spawnable_on");
|
||||
public static final BlockTag WOLVES_SPAWNABLE_ON = new BlockTag("wolves_spawnable_on");
|
||||
public static final BlockTag FROGS_SPAWNABLE_ON = new BlockTag("frogs_spawnable_on");
|
||||
public static final BlockTag AZALEA_GROWS_ON = new BlockTag("azalea_grows_on");
|
||||
public static final BlockTag CONVERTABLE_TO_MUD = new BlockTag("convertable_to_mud");
|
||||
public static final BlockTag MANGROVE_LOGS_CAN_GROW_THROUGH = new BlockTag("mangrove_logs_can_grow_through");
|
||||
public static final BlockTag MANGROVE_ROOTS_CAN_GROW_THROUGH = new BlockTag("mangrove_roots_can_grow_through");
|
||||
public static final BlockTag DEAD_BUSH_MAY_PLACE_ON = new BlockTag("dead_bush_may_place_on");
|
||||
public static final BlockTag SNAPS_GOAT_HORN = new BlockTag("snaps_goat_horn");
|
||||
public static final BlockTag REPLACEABLE_BY_TREES = new BlockTag("replaceable_by_trees");
|
||||
public static final BlockTag SNOW_LAYER_CANNOT_SURVIVE_ON = new BlockTag("snow_layer_cannot_survive_on");
|
||||
public static final BlockTag SNOW_LAYER_CAN_SURVIVE_ON = new BlockTag("snow_layer_can_survive_on");
|
||||
public static final BlockTag INVALID_SPAWN_INSIDE = new BlockTag("invalid_spawn_inside");
|
||||
public static final BlockTag SNIFFER_DIGGABLE_BLOCK = new BlockTag("sniffer_diggable_block");
|
||||
public static final BlockTag SNIFFER_EGG_HATCH_BOOST = new BlockTag("sniffer_egg_hatch_boost");
|
||||
public static final BlockTag TRAIL_RUINS_REPLACEABLE = new BlockTag("trail_ruins_replaceable");
|
||||
public static final BlockTag REPLACEABLE = new BlockTag("replaceable");
|
||||
public static final BlockTag ENCHANTMENT_POWER_PROVIDER = new BlockTag("enchantment_power_provider");
|
||||
public static final BlockTag ENCHANTMENT_POWER_TRANSMITTER = new BlockTag("enchantment_power_transmitter");
|
||||
public static final BlockTag MAINTAINS_FARMLAND = new BlockTag("maintains_farmland");
|
||||
public static final BlockTag BLOCKS_WIND_CHARGE_EXPLOSIONS = new BlockTag("blocks_wind_charge_explosions");
|
||||
public static final BlockTag DOES_NOT_BLOCK_HOPPERS = new BlockTag("does_not_block_hoppers");
|
||||
public static final BlockTag AIR = new BlockTag("air");
|
||||
private BlockTag() {}
|
||||
|
||||
private final int id;
|
||||
|
||||
private BlockTag(String identifier) {
|
||||
this.id = ALL_BLOCK_TAGS.size();
|
||||
register(identifier, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int ordinal() {
|
||||
return id;
|
||||
}
|
||||
|
||||
private static void register(String name, BlockTag tag) {
|
||||
ALL_BLOCK_TAGS.put(Key.key(name), tag);
|
||||
private static Tag<Block> create(String name) {
|
||||
return new Tag<>(JavaRegistries.BLOCK, MinecraftKey.key(name));
|
||||
}
|
||||
}
|
||||
|
@ -25,67 +25,55 @@
|
||||
|
||||
package org.geysermc.geyser.session.cache.tags;
|
||||
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.geysermc.geyser.item.enchantment.Enchantment;
|
||||
import org.geysermc.geyser.session.cache.registry.JavaRegistries;
|
||||
import org.geysermc.geyser.util.MinecraftKey;
|
||||
import org.geysermc.geyser.util.Ordered;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Lists vanilla enchantment tags.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public final class EnchantmentTag implements Ordered {
|
||||
public static final Map<Key, EnchantmentTag> ALL_ENCHANTMENT_TAGS = new HashMap<>();
|
||||
public final class EnchantmentTag {
|
||||
public static final Tag<Enchantment> TOOLTIP_ORDER = create("tooltip_order");
|
||||
public static final Tag<Enchantment> EXCLUSIVE_SET_ARMOR = create("exclusive_set/armor");
|
||||
public static final Tag<Enchantment> EXCLUSIVE_SET_BOOTS = create("exclusive_set/boots");
|
||||
public static final Tag<Enchantment> EXCLUSIVE_SET_BOW = create("exclusive_set/bow");
|
||||
public static final Tag<Enchantment> EXCLUSIVE_SET_CROSSBOW = create("exclusive_set/crossbow");
|
||||
public static final Tag<Enchantment> EXCLUSIVE_SET_DAMAGE = create("exclusive_set/damage");
|
||||
public static final Tag<Enchantment> EXCLUSIVE_SET_MINING = create("exclusive_set/mining");
|
||||
public static final Tag<Enchantment> EXCLUSIVE_SET_RIPTIDE = create("exclusive_set/riptide");
|
||||
public static final Tag<Enchantment> TRADEABLE = create("tradeable");
|
||||
public static final Tag<Enchantment> DOUBLE_TRADE_PRICE = create("double_trade_price");
|
||||
public static final Tag<Enchantment> IN_ENCHANTING_TABLE = create("in_enchanting_table");
|
||||
public static final Tag<Enchantment> ON_MOB_SPAWN_EQUIPMENT = create("on_mob_spawn_equipment");
|
||||
public static final Tag<Enchantment> ON_TRADED_EQUIPMENT = create("on_traded_equipment");
|
||||
public static final Tag<Enchantment> ON_RANDOM_LOOT = create("on_random_loot");
|
||||
public static final Tag<Enchantment> CURSE = create("curse");
|
||||
public static final Tag<Enchantment> SMELTS_LOOT = create("smelts_loot");
|
||||
public static final Tag<Enchantment> PREVENTS_BEE_SPAWNS_WHEN_MINING = create("prevents_bee_spawns_when_mining");
|
||||
public static final Tag<Enchantment> PREVENTS_DECORATED_POT_SHATTERING = create("prevents_decorated_pot_shattering");
|
||||
public static final Tag<Enchantment> PREVENTS_ICE_MELTING = create("prevents_ice_melting");
|
||||
public static final Tag<Enchantment> PREVENTS_INFESTED_SPAWNS = create("prevents_infested_spawns");
|
||||
public static final Tag<Enchantment> TREASURE = create("treasure");
|
||||
public static final Tag<Enchantment> NON_TREASURE = create("non_treasure");
|
||||
public static final Tag<Enchantment> TRADES_DESERT_COMMON = create("trades/desert_common");
|
||||
public static final Tag<Enchantment> TRADES_JUNGLE_COMMON = create("trades/jungle_common");
|
||||
public static final Tag<Enchantment> TRADES_PLAINS_COMMON = create("trades/plains_common");
|
||||
public static final Tag<Enchantment> TRADES_SAVANNA_COMMON = create("trades/savanna_common");
|
||||
public static final Tag<Enchantment> TRADES_SNOW_COMMON = create("trades/snow_common");
|
||||
public static final Tag<Enchantment> TRADES_SWAMP_COMMON = create("trades/swamp_common");
|
||||
public static final Tag<Enchantment> TRADES_TAIGA_COMMON = create("trades/taiga_common");
|
||||
public static final Tag<Enchantment> TRADES_DESERT_SPECIAL = create("trades/desert_special");
|
||||
public static final Tag<Enchantment> TRADES_JUNGLE_SPECIAL = create("trades/jungle_special");
|
||||
public static final Tag<Enchantment> TRADES_PLAINS_SPECIAL = create("trades/plains_special");
|
||||
public static final Tag<Enchantment> TRADES_SAVANNA_SPECIAL = create("trades/savanna_special");
|
||||
public static final Tag<Enchantment> TRADES_SNOW_SPECIAL = create("trades/snow_special");
|
||||
public static final Tag<Enchantment> TRADES_SWAMP_SPECIAL = create("trades/swamp_special");
|
||||
public static final Tag<Enchantment> TRADES_TAIGA_SPECIAL = create("trades/taiga_special");
|
||||
|
||||
public static final EnchantmentTag TOOLTIP_ORDER = new EnchantmentTag("tooltip_order");
|
||||
public static final EnchantmentTag EXCLUSIVE_SET_ARMOR = new EnchantmentTag("exclusive_set/armor");
|
||||
public static final EnchantmentTag EXCLUSIVE_SET_BOOTS = new EnchantmentTag("exclusive_set/boots");
|
||||
public static final EnchantmentTag EXCLUSIVE_SET_BOW = new EnchantmentTag("exclusive_set/bow");
|
||||
public static final EnchantmentTag EXCLUSIVE_SET_CROSSBOW = new EnchantmentTag("exclusive_set/crossbow");
|
||||
public static final EnchantmentTag EXCLUSIVE_SET_DAMAGE = new EnchantmentTag("exclusive_set/damage");
|
||||
public static final EnchantmentTag EXCLUSIVE_SET_MINING = new EnchantmentTag("exclusive_set/mining");
|
||||
public static final EnchantmentTag EXCLUSIVE_SET_RIPTIDE = new EnchantmentTag("exclusive_set/riptide");
|
||||
public static final EnchantmentTag TRADEABLE = new EnchantmentTag("tradeable");
|
||||
public static final EnchantmentTag DOUBLE_TRADE_PRICE = new EnchantmentTag("double_trade_price");
|
||||
public static final EnchantmentTag IN_ENCHANTING_TABLE = new EnchantmentTag("in_enchanting_table");
|
||||
public static final EnchantmentTag ON_MOB_SPAWN_EQUIPMENT = new EnchantmentTag("on_mob_spawn_equipment");
|
||||
public static final EnchantmentTag ON_TRADED_EQUIPMENT = new EnchantmentTag("on_traded_equipment");
|
||||
public static final EnchantmentTag ON_RANDOM_LOOT = new EnchantmentTag("on_random_loot");
|
||||
public static final EnchantmentTag CURSE = new EnchantmentTag("curse");
|
||||
public static final EnchantmentTag SMELTS_LOOT = new EnchantmentTag("smelts_loot");
|
||||
public static final EnchantmentTag PREVENTS_BEE_SPAWNS_WHEN_MINING = new EnchantmentTag("prevents_bee_spawns_when_mining");
|
||||
public static final EnchantmentTag PREVENTS_DECORATED_POT_SHATTERING = new EnchantmentTag("prevents_decorated_pot_shattering");
|
||||
public static final EnchantmentTag PREVENTS_ICE_MELTING = new EnchantmentTag("prevents_ice_melting");
|
||||
public static final EnchantmentTag PREVENTS_INFESTED_SPAWNS = new EnchantmentTag("prevents_infested_spawns");
|
||||
public static final EnchantmentTag TREASURE = new EnchantmentTag("treasure");
|
||||
public static final EnchantmentTag NON_TREASURE = new EnchantmentTag("non_treasure");
|
||||
public static final EnchantmentTag TRADES_DESERT_COMMON = new EnchantmentTag("trades/desert_common");
|
||||
public static final EnchantmentTag TRADES_JUNGLE_COMMON = new EnchantmentTag("trades/jungle_common");
|
||||
public static final EnchantmentTag TRADES_PLAINS_COMMON = new EnchantmentTag("trades/plains_common");
|
||||
public static final EnchantmentTag TRADES_SAVANNA_COMMON = new EnchantmentTag("trades/savanna_common");
|
||||
public static final EnchantmentTag TRADES_SNOW_COMMON = new EnchantmentTag("trades/snow_common");
|
||||
public static final EnchantmentTag TRADES_SWAMP_COMMON = new EnchantmentTag("trades/swamp_common");
|
||||
public static final EnchantmentTag TRADES_TAIGA_COMMON = new EnchantmentTag("trades/taiga_common");
|
||||
public static final EnchantmentTag TRADES_DESERT_SPECIAL = new EnchantmentTag("trades/desert_special");
|
||||
public static final EnchantmentTag TRADES_JUNGLE_SPECIAL = new EnchantmentTag("trades/jungle_special");
|
||||
public static final EnchantmentTag TRADES_PLAINS_SPECIAL = new EnchantmentTag("trades/plains_special");
|
||||
public static final EnchantmentTag TRADES_SAVANNA_SPECIAL = new EnchantmentTag("trades/savanna_special");
|
||||
public static final EnchantmentTag TRADES_SNOW_SPECIAL = new EnchantmentTag("trades/snow_special");
|
||||
public static final EnchantmentTag TRADES_SWAMP_SPECIAL = new EnchantmentTag("trades/swamp_special");
|
||||
public static final EnchantmentTag TRADES_TAIGA_SPECIAL = new EnchantmentTag("trades/taiga_special");
|
||||
private EnchantmentTag() {}
|
||||
|
||||
private final int id;
|
||||
|
||||
private EnchantmentTag(String identifier) {
|
||||
this.id = ALL_ENCHANTMENT_TAGS.size();
|
||||
register(identifier, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int ordinal() {
|
||||
return id;
|
||||
}
|
||||
|
||||
private static void register(String name, EnchantmentTag tag) {
|
||||
ALL_ENCHANTMENT_TAGS.put(MinecraftKey.key(name), tag);
|
||||
private static Tag<Enchantment> create(String name) {
|
||||
return new Tag<>(JavaRegistries.ENCHANTMENT, MinecraftKey.key(name));
|
||||
}
|
||||
}
|
||||
|
118
core/src/main/java/org/geysermc/geyser/session/cache/tags/GeyserHolderSet.java
vendored
Normale Datei
118
core/src/main/java/org/geysermc/geyser/session/cache/tags/GeyserHolderSet.java
vendored
Normale Datei
@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright (c) 2024 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author GeyserMC
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.geyser.session.cache.tags;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.function.ToIntFunction;
|
||||
|
||||
import it.unimi.dsi.fastutil.ints.IntArrays;
|
||||
import lombok.Data;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.session.cache.TagCache;
|
||||
import org.geysermc.geyser.session.cache.registry.JavaRegistryKey;
|
||||
|
||||
/**
|
||||
* Similar to vanilla Minecraft's HolderSets, stores either a tag or a list of IDs (this list can also be represented as a single ID in vanilla HolderSets).
|
||||
*
|
||||
* <p>Because HolderSets utilise tags, when loading a HolderSet, Geyser must store tags for the registry the HolderSet is for (see {@link JavaRegistryKey}).</p>
|
||||
*
|
||||
* <p>Use the {@link GeyserHolderSet#readHolderSet} method to easily read a HolderSet from NBT sent by a server. To turn the HolderSet into a list of network IDs, use the {@link GeyserHolderSet#resolveRaw} method.
|
||||
* To turn the HolderSet into a list of objects, use the {@link GeyserHolderSet#resolve} method.</p>
|
||||
*/
|
||||
@Data
|
||||
public final class GeyserHolderSet<T> {
|
||||
|
||||
private final JavaRegistryKey<T> registry;
|
||||
private final @Nullable Tag<T> tag;
|
||||
private final int @Nullable [] holders;
|
||||
|
||||
public GeyserHolderSet(JavaRegistryKey<T> registry, int @NonNull [] holders) {
|
||||
this.registry = registry;
|
||||
this.tag = null;
|
||||
this.holders = holders;
|
||||
}
|
||||
|
||||
public GeyserHolderSet(JavaRegistryKey<T> registry, @NonNull Tag<T> tagId) {
|
||||
this.registry = registry;
|
||||
this.tag = tagId;
|
||||
this.holders = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves the HolderSet, and automatically maps the network IDs to their respective object types. If the HolderSet is a list of IDs, this will be returned. If it is a tag, the tag will be resolved from the tag cache.
|
||||
*
|
||||
* @return the HolderSet turned into a list of objects.
|
||||
*/
|
||||
public List<T> resolve(GeyserSession session) {
|
||||
return TagCache.mapRawArray(session, resolveRaw(session.getTagCache()), registry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves the HolderSet. If the HolderSet is a list of IDs, this will be returned. If it is a tag, the tag will be resolved from the tag cache.
|
||||
*
|
||||
* @return the HolderSet turned into a list of objects.
|
||||
*/
|
||||
public int[] resolveRaw(TagCache tagCache) {
|
||||
if (holders != null) {
|
||||
return holders;
|
||||
}
|
||||
|
||||
return tagCache.getRaw(Objects.requireNonNull(tag, "HolderSet must have a tag if it doesn't have a list of IDs"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a HolderSet from an object from NBT.
|
||||
*
|
||||
* @param session session, only used for logging purposes.
|
||||
* @param registry the registry the HolderSet contains IDs from.
|
||||
* @param holderSet the HolderSet as an object from NBT.
|
||||
* @param keyIdMapping a function that maps resource location IDs in the HolderSet's registry to their network IDs.
|
||||
*/
|
||||
public static <T> GeyserHolderSet<T> readHolderSet(GeyserSession session, JavaRegistryKey<T> registry, @Nullable Object holderSet, ToIntFunction<Key> keyIdMapping) {
|
||||
if (holderSet == null) {
|
||||
return new GeyserHolderSet<>(registry, IntArrays.EMPTY_ARRAY);
|
||||
}
|
||||
|
||||
if (holderSet instanceof String stringTag) {
|
||||
if (stringTag.startsWith("#")) {
|
||||
// Tag
|
||||
return new GeyserHolderSet<>(registry, new Tag<>(registry, Key.key(stringTag.substring(1)))); // Remove '#' at beginning that indicates tag
|
||||
} else if (stringTag.isEmpty()) {
|
||||
return new GeyserHolderSet<>(registry, IntArrays.EMPTY_ARRAY);
|
||||
}
|
||||
return new GeyserHolderSet<>(registry, new int[]{keyIdMapping.applyAsInt(Key.key(stringTag))});
|
||||
} else if (holderSet instanceof List<?> list) {
|
||||
// Assume the list is a list of strings
|
||||
return new GeyserHolderSet<>(registry, list.stream().map(o -> (String) o).map(Key::key).mapToInt(keyIdMapping).toArray());
|
||||
}
|
||||
session.getGeyser().getLogger().warning("Failed parsing HolderSet for registry + " + registry + "! Expected either a tag, a string ID or a list of string IDs, found " + holderSet);
|
||||
return new GeyserHolderSet<>(registry, IntArrays.EMPTY_ARRAY);
|
||||
}
|
||||
}
|
@ -25,178 +25,166 @@
|
||||
|
||||
package org.geysermc.geyser.session.cache.tags;
|
||||
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.geysermc.geyser.item.type.Item;
|
||||
import org.geysermc.geyser.session.cache.registry.JavaRegistries;
|
||||
import org.geysermc.geyser.util.MinecraftKey;
|
||||
import org.geysermc.geyser.util.Ordered;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Lists vanilla item tags.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public final class ItemTag implements Ordered {
|
||||
public static final Map<Key, ItemTag> ALL_ITEM_TAGS = new HashMap<>();
|
||||
public final class ItemTag {
|
||||
public static final Tag<Item> WOOL = create("wool");
|
||||
public static final Tag<Item> PLANKS = create("planks");
|
||||
public static final Tag<Item> STONE_BRICKS = create("stone_bricks");
|
||||
public static final Tag<Item> WOODEN_BUTTONS = create("wooden_buttons");
|
||||
public static final Tag<Item> STONE_BUTTONS = create("stone_buttons");
|
||||
public static final Tag<Item> BUTTONS = create("buttons");
|
||||
public static final Tag<Item> WOOL_CARPETS = create("wool_carpets");
|
||||
public static final Tag<Item> WOODEN_DOORS = create("wooden_doors");
|
||||
public static final Tag<Item> WOODEN_STAIRS = create("wooden_stairs");
|
||||
public static final Tag<Item> WOODEN_SLABS = create("wooden_slabs");
|
||||
public static final Tag<Item> WOODEN_FENCES = create("wooden_fences");
|
||||
public static final Tag<Item> FENCE_GATES = create("fence_gates");
|
||||
public static final Tag<Item> WOODEN_PRESSURE_PLATES = create("wooden_pressure_plates");
|
||||
public static final Tag<Item> WOODEN_TRAPDOORS = create("wooden_trapdoors");
|
||||
public static final Tag<Item> DOORS = create("doors");
|
||||
public static final Tag<Item> SAPLINGS = create("saplings");
|
||||
public static final Tag<Item> LOGS_THAT_BURN = create("logs_that_burn");
|
||||
public static final Tag<Item> LOGS = create("logs");
|
||||
public static final Tag<Item> DARK_OAK_LOGS = create("dark_oak_logs");
|
||||
public static final Tag<Item> OAK_LOGS = create("oak_logs");
|
||||
public static final Tag<Item> BIRCH_LOGS = create("birch_logs");
|
||||
public static final Tag<Item> ACACIA_LOGS = create("acacia_logs");
|
||||
public static final Tag<Item> CHERRY_LOGS = create("cherry_logs");
|
||||
public static final Tag<Item> JUNGLE_LOGS = create("jungle_logs");
|
||||
public static final Tag<Item> SPRUCE_LOGS = create("spruce_logs");
|
||||
public static final Tag<Item> MANGROVE_LOGS = create("mangrove_logs");
|
||||
public static final Tag<Item> CRIMSON_STEMS = create("crimson_stems");
|
||||
public static final Tag<Item> WARPED_STEMS = create("warped_stems");
|
||||
public static final Tag<Item> BAMBOO_BLOCKS = create("bamboo_blocks");
|
||||
public static final Tag<Item> WART_BLOCKS = create("wart_blocks");
|
||||
public static final Tag<Item> BANNERS = create("banners");
|
||||
public static final Tag<Item> SAND = create("sand");
|
||||
public static final Tag<Item> SMELTS_TO_GLASS = create("smelts_to_glass");
|
||||
public static final Tag<Item> STAIRS = create("stairs");
|
||||
public static final Tag<Item> SLABS = create("slabs");
|
||||
public static final Tag<Item> WALLS = create("walls");
|
||||
public static final Tag<Item> ANVIL = create("anvil");
|
||||
public static final Tag<Item> RAILS = create("rails");
|
||||
public static final Tag<Item> LEAVES = create("leaves");
|
||||
public static final Tag<Item> TRAPDOORS = create("trapdoors");
|
||||
public static final Tag<Item> SMALL_FLOWERS = create("small_flowers");
|
||||
public static final Tag<Item> BEDS = create("beds");
|
||||
public static final Tag<Item> FENCES = create("fences");
|
||||
public static final Tag<Item> TALL_FLOWERS = create("tall_flowers");
|
||||
public static final Tag<Item> FLOWERS = create("flowers");
|
||||
public static final Tag<Item> PIGLIN_REPELLENTS = create("piglin_repellents");
|
||||
public static final Tag<Item> PIGLIN_LOVED = create("piglin_loved");
|
||||
public static final Tag<Item> IGNORED_BY_PIGLIN_BABIES = create("ignored_by_piglin_babies");
|
||||
public static final Tag<Item> MEAT = create("meat");
|
||||
public static final Tag<Item> SNIFFER_FOOD = create("sniffer_food");
|
||||
public static final Tag<Item> PIGLIN_FOOD = create("piglin_food");
|
||||
public static final Tag<Item> FOX_FOOD = create("fox_food");
|
||||
public static final Tag<Item> COW_FOOD = create("cow_food");
|
||||
public static final Tag<Item> GOAT_FOOD = create("goat_food");
|
||||
public static final Tag<Item> SHEEP_FOOD = create("sheep_food");
|
||||
public static final Tag<Item> WOLF_FOOD = create("wolf_food");
|
||||
public static final Tag<Item> CAT_FOOD = create("cat_food");
|
||||
public static final Tag<Item> HORSE_FOOD = create("horse_food");
|
||||
public static final Tag<Item> HORSE_TEMPT_ITEMS = create("horse_tempt_items");
|
||||
public static final Tag<Item> CAMEL_FOOD = create("camel_food");
|
||||
public static final Tag<Item> ARMADILLO_FOOD = create("armadillo_food");
|
||||
public static final Tag<Item> BEE_FOOD = create("bee_food");
|
||||
public static final Tag<Item> CHICKEN_FOOD = create("chicken_food");
|
||||
public static final Tag<Item> FROG_FOOD = create("frog_food");
|
||||
public static final Tag<Item> HOGLIN_FOOD = create("hoglin_food");
|
||||
public static final Tag<Item> LLAMA_FOOD = create("llama_food");
|
||||
public static final Tag<Item> LLAMA_TEMPT_ITEMS = create("llama_tempt_items");
|
||||
public static final Tag<Item> OCELOT_FOOD = create("ocelot_food");
|
||||
public static final Tag<Item> PANDA_FOOD = create("panda_food");
|
||||
public static final Tag<Item> PIG_FOOD = create("pig_food");
|
||||
public static final Tag<Item> RABBIT_FOOD = create("rabbit_food");
|
||||
public static final Tag<Item> STRIDER_FOOD = create("strider_food");
|
||||
public static final Tag<Item> STRIDER_TEMPT_ITEMS = create("strider_tempt_items");
|
||||
public static final Tag<Item> TURTLE_FOOD = create("turtle_food");
|
||||
public static final Tag<Item> PARROT_FOOD = create("parrot_food");
|
||||
public static final Tag<Item> PARROT_POISONOUS_FOOD = create("parrot_poisonous_food");
|
||||
public static final Tag<Item> AXOLOTL_FOOD = create("axolotl_food");
|
||||
public static final Tag<Item> GOLD_ORES = create("gold_ores");
|
||||
public static final Tag<Item> IRON_ORES = create("iron_ores");
|
||||
public static final Tag<Item> DIAMOND_ORES = create("diamond_ores");
|
||||
public static final Tag<Item> REDSTONE_ORES = create("redstone_ores");
|
||||
public static final Tag<Item> LAPIS_ORES = create("lapis_ores");
|
||||
public static final Tag<Item> COAL_ORES = create("coal_ores");
|
||||
public static final Tag<Item> EMERALD_ORES = create("emerald_ores");
|
||||
public static final Tag<Item> COPPER_ORES = create("copper_ores");
|
||||
public static final Tag<Item> NON_FLAMMABLE_WOOD = create("non_flammable_wood");
|
||||
public static final Tag<Item> SOUL_FIRE_BASE_BLOCKS = create("soul_fire_base_blocks");
|
||||
public static final Tag<Item> CANDLES = create("candles");
|
||||
public static final Tag<Item> DIRT = create("dirt");
|
||||
public static final Tag<Item> TERRACOTTA = create("terracotta");
|
||||
public static final Tag<Item> COMPLETES_FIND_TREE_TUTORIAL = create("completes_find_tree_tutorial");
|
||||
public static final Tag<Item> BOATS = create("boats");
|
||||
public static final Tag<Item> CHEST_BOATS = create("chest_boats");
|
||||
public static final Tag<Item> FISHES = create("fishes");
|
||||
public static final Tag<Item> SIGNS = create("signs");
|
||||
public static final Tag<Item> CREEPER_DROP_MUSIC_DISCS = create("creeper_drop_music_discs");
|
||||
public static final Tag<Item> COALS = create("coals");
|
||||
public static final Tag<Item> ARROWS = create("arrows");
|
||||
public static final Tag<Item> LECTERN_BOOKS = create("lectern_books");
|
||||
public static final Tag<Item> BOOKSHELF_BOOKS = create("bookshelf_books");
|
||||
public static final Tag<Item> BEACON_PAYMENT_ITEMS = create("beacon_payment_items");
|
||||
public static final Tag<Item> STONE_TOOL_MATERIALS = create("stone_tool_materials");
|
||||
public static final Tag<Item> STONE_CRAFTING_MATERIALS = create("stone_crafting_materials");
|
||||
public static final Tag<Item> FREEZE_IMMUNE_WEARABLES = create("freeze_immune_wearables");
|
||||
public static final Tag<Item> DAMPENS_VIBRATIONS = create("dampens_vibrations");
|
||||
public static final Tag<Item> CLUSTER_MAX_HARVESTABLES = create("cluster_max_harvestables");
|
||||
public static final Tag<Item> COMPASSES = create("compasses");
|
||||
public static final Tag<Item> HANGING_SIGNS = create("hanging_signs");
|
||||
public static final Tag<Item> CREEPER_IGNITERS = create("creeper_igniters");
|
||||
public static final Tag<Item> NOTEBLOCK_TOP_INSTRUMENTS = create("noteblock_top_instruments");
|
||||
public static final Tag<Item> FOOT_ARMOR = create("foot_armor");
|
||||
public static final Tag<Item> LEG_ARMOR = create("leg_armor");
|
||||
public static final Tag<Item> CHEST_ARMOR = create("chest_armor");
|
||||
public static final Tag<Item> HEAD_ARMOR = create("head_armor");
|
||||
public static final Tag<Item> SKULLS = create("skulls");
|
||||
public static final Tag<Item> TRIMMABLE_ARMOR = create("trimmable_armor");
|
||||
public static final Tag<Item> TRIM_MATERIALS = create("trim_materials");
|
||||
public static final Tag<Item> TRIM_TEMPLATES = create("trim_templates");
|
||||
public static final Tag<Item> DECORATED_POT_SHERDS = create("decorated_pot_sherds");
|
||||
public static final Tag<Item> DECORATED_POT_INGREDIENTS = create("decorated_pot_ingredients");
|
||||
public static final Tag<Item> SWORDS = create("swords");
|
||||
public static final Tag<Item> AXES = create("axes");
|
||||
public static final Tag<Item> HOES = create("hoes");
|
||||
public static final Tag<Item> PICKAXES = create("pickaxes");
|
||||
public static final Tag<Item> SHOVELS = create("shovels");
|
||||
public static final Tag<Item> BREAKS_DECORATED_POTS = create("breaks_decorated_pots");
|
||||
public static final Tag<Item> VILLAGER_PLANTABLE_SEEDS = create("villager_plantable_seeds");
|
||||
public static final Tag<Item> DYEABLE = create("dyeable");
|
||||
public static final Tag<Item> ENCHANTABLE_FOOT_ARMOR = create("enchantable/foot_armor");
|
||||
public static final Tag<Item> ENCHANTABLE_LEG_ARMOR = create("enchantable/leg_armor");
|
||||
public static final Tag<Item> ENCHANTABLE_CHEST_ARMOR = create("enchantable/chest_armor");
|
||||
public static final Tag<Item> ENCHANTABLE_HEAD_ARMOR = create("enchantable/head_armor");
|
||||
public static final Tag<Item> ENCHANTABLE_ARMOR = create("enchantable/armor");
|
||||
public static final Tag<Item> ENCHANTABLE_SWORD = create("enchantable/sword");
|
||||
public static final Tag<Item> ENCHANTABLE_FIRE_ASPECT = create("enchantable/fire_aspect");
|
||||
public static final Tag<Item> ENCHANTABLE_SHARP_WEAPON = create("enchantable/sharp_weapon");
|
||||
public static final Tag<Item> ENCHANTABLE_WEAPON = create("enchantable/weapon");
|
||||
public static final Tag<Item> ENCHANTABLE_MINING = create("enchantable/mining");
|
||||
public static final Tag<Item> ENCHANTABLE_MINING_LOOT = create("enchantable/mining_loot");
|
||||
public static final Tag<Item> ENCHANTABLE_FISHING = create("enchantable/fishing");
|
||||
public static final Tag<Item> ENCHANTABLE_TRIDENT = create("enchantable/trident");
|
||||
public static final Tag<Item> ENCHANTABLE_DURABILITY = create("enchantable/durability");
|
||||
public static final Tag<Item> ENCHANTABLE_BOW = create("enchantable/bow");
|
||||
public static final Tag<Item> ENCHANTABLE_EQUIPPABLE = create("enchantable/equippable");
|
||||
public static final Tag<Item> ENCHANTABLE_CROSSBOW = create("enchantable/crossbow");
|
||||
public static final Tag<Item> ENCHANTABLE_VANISHING = create("enchantable/vanishing");
|
||||
public static final Tag<Item> ENCHANTABLE_MACE = create("enchantable/mace");
|
||||
|
||||
public static final ItemTag WOOL = new ItemTag("wool");
|
||||
public static final ItemTag PLANKS = new ItemTag("planks");
|
||||
public static final ItemTag STONE_BRICKS = new ItemTag("stone_bricks");
|
||||
public static final ItemTag WOODEN_BUTTONS = new ItemTag("wooden_buttons");
|
||||
public static final ItemTag STONE_BUTTONS = new ItemTag("stone_buttons");
|
||||
public static final ItemTag BUTTONS = new ItemTag("buttons");
|
||||
public static final ItemTag WOOL_CARPETS = new ItemTag("wool_carpets");
|
||||
public static final ItemTag WOODEN_DOORS = new ItemTag("wooden_doors");
|
||||
public static final ItemTag WOODEN_STAIRS = new ItemTag("wooden_stairs");
|
||||
public static final ItemTag WOODEN_SLABS = new ItemTag("wooden_slabs");
|
||||
public static final ItemTag WOODEN_FENCES = new ItemTag("wooden_fences");
|
||||
public static final ItemTag FENCE_GATES = new ItemTag("fence_gates");
|
||||
public static final ItemTag WOODEN_PRESSURE_PLATES = new ItemTag("wooden_pressure_plates");
|
||||
public static final ItemTag WOODEN_TRAPDOORS = new ItemTag("wooden_trapdoors");
|
||||
public static final ItemTag DOORS = new ItemTag("doors");
|
||||
public static final ItemTag SAPLINGS = new ItemTag("saplings");
|
||||
public static final ItemTag LOGS_THAT_BURN = new ItemTag("logs_that_burn");
|
||||
public static final ItemTag LOGS = new ItemTag("logs");
|
||||
public static final ItemTag DARK_OAK_LOGS = new ItemTag("dark_oak_logs");
|
||||
public static final ItemTag OAK_LOGS = new ItemTag("oak_logs");
|
||||
public static final ItemTag BIRCH_LOGS = new ItemTag("birch_logs");
|
||||
public static final ItemTag ACACIA_LOGS = new ItemTag("acacia_logs");
|
||||
public static final ItemTag CHERRY_LOGS = new ItemTag("cherry_logs");
|
||||
public static final ItemTag JUNGLE_LOGS = new ItemTag("jungle_logs");
|
||||
public static final ItemTag SPRUCE_LOGS = new ItemTag("spruce_logs");
|
||||
public static final ItemTag MANGROVE_LOGS = new ItemTag("mangrove_logs");
|
||||
public static final ItemTag CRIMSON_STEMS = new ItemTag("crimson_stems");
|
||||
public static final ItemTag WARPED_STEMS = new ItemTag("warped_stems");
|
||||
public static final ItemTag BAMBOO_BLOCKS = new ItemTag("bamboo_blocks");
|
||||
public static final ItemTag WART_BLOCKS = new ItemTag("wart_blocks");
|
||||
public static final ItemTag BANNERS = new ItemTag("banners");
|
||||
public static final ItemTag SAND = new ItemTag("sand");
|
||||
public static final ItemTag SMELTS_TO_GLASS = new ItemTag("smelts_to_glass");
|
||||
public static final ItemTag STAIRS = new ItemTag("stairs");
|
||||
public static final ItemTag SLABS = new ItemTag("slabs");
|
||||
public static final ItemTag WALLS = new ItemTag("walls");
|
||||
public static final ItemTag ANVIL = new ItemTag("anvil");
|
||||
public static final ItemTag RAILS = new ItemTag("rails");
|
||||
public static final ItemTag LEAVES = new ItemTag("leaves");
|
||||
public static final ItemTag TRAPDOORS = new ItemTag("trapdoors");
|
||||
public static final ItemTag SMALL_FLOWERS = new ItemTag("small_flowers");
|
||||
public static final ItemTag BEDS = new ItemTag("beds");
|
||||
public static final ItemTag FENCES = new ItemTag("fences");
|
||||
public static final ItemTag TALL_FLOWERS = new ItemTag("tall_flowers");
|
||||
public static final ItemTag FLOWERS = new ItemTag("flowers");
|
||||
public static final ItemTag PIGLIN_REPELLENTS = new ItemTag("piglin_repellents");
|
||||
public static final ItemTag PIGLIN_LOVED = new ItemTag("piglin_loved");
|
||||
public static final ItemTag IGNORED_BY_PIGLIN_BABIES = new ItemTag("ignored_by_piglin_babies");
|
||||
public static final ItemTag MEAT = new ItemTag("meat");
|
||||
public static final ItemTag SNIFFER_FOOD = new ItemTag("sniffer_food");
|
||||
public static final ItemTag PIGLIN_FOOD = new ItemTag("piglin_food");
|
||||
public static final ItemTag FOX_FOOD = new ItemTag("fox_food");
|
||||
public static final ItemTag COW_FOOD = new ItemTag("cow_food");
|
||||
public static final ItemTag GOAT_FOOD = new ItemTag("goat_food");
|
||||
public static final ItemTag SHEEP_FOOD = new ItemTag("sheep_food");
|
||||
public static final ItemTag WOLF_FOOD = new ItemTag("wolf_food");
|
||||
public static final ItemTag CAT_FOOD = new ItemTag("cat_food");
|
||||
public static final ItemTag HORSE_FOOD = new ItemTag("horse_food");
|
||||
public static final ItemTag HORSE_TEMPT_ITEMS = new ItemTag("horse_tempt_items");
|
||||
public static final ItemTag CAMEL_FOOD = new ItemTag("camel_food");
|
||||
public static final ItemTag ARMADILLO_FOOD = new ItemTag("armadillo_food");
|
||||
public static final ItemTag BEE_FOOD = new ItemTag("bee_food");
|
||||
public static final ItemTag CHICKEN_FOOD = new ItemTag("chicken_food");
|
||||
public static final ItemTag FROG_FOOD = new ItemTag("frog_food");
|
||||
public static final ItemTag HOGLIN_FOOD = new ItemTag("hoglin_food");
|
||||
public static final ItemTag LLAMA_FOOD = new ItemTag("llama_food");
|
||||
public static final ItemTag LLAMA_TEMPT_ITEMS = new ItemTag("llama_tempt_items");
|
||||
public static final ItemTag OCELOT_FOOD = new ItemTag("ocelot_food");
|
||||
public static final ItemTag PANDA_FOOD = new ItemTag("panda_food");
|
||||
public static final ItemTag PIG_FOOD = new ItemTag("pig_food");
|
||||
public static final ItemTag RABBIT_FOOD = new ItemTag("rabbit_food");
|
||||
public static final ItemTag STRIDER_FOOD = new ItemTag("strider_food");
|
||||
public static final ItemTag STRIDER_TEMPT_ITEMS = new ItemTag("strider_tempt_items");
|
||||
public static final ItemTag TURTLE_FOOD = new ItemTag("turtle_food");
|
||||
public static final ItemTag PARROT_FOOD = new ItemTag("parrot_food");
|
||||
public static final ItemTag PARROT_POISONOUS_FOOD = new ItemTag("parrot_poisonous_food");
|
||||
public static final ItemTag AXOLOTL_FOOD = new ItemTag("axolotl_food");
|
||||
public static final ItemTag GOLD_ORES = new ItemTag("gold_ores");
|
||||
public static final ItemTag IRON_ORES = new ItemTag("iron_ores");
|
||||
public static final ItemTag DIAMOND_ORES = new ItemTag("diamond_ores");
|
||||
public static final ItemTag REDSTONE_ORES = new ItemTag("redstone_ores");
|
||||
public static final ItemTag LAPIS_ORES = new ItemTag("lapis_ores");
|
||||
public static final ItemTag COAL_ORES = new ItemTag("coal_ores");
|
||||
public static final ItemTag EMERALD_ORES = new ItemTag("emerald_ores");
|
||||
public static final ItemTag COPPER_ORES = new ItemTag("copper_ores");
|
||||
public static final ItemTag NON_FLAMMABLE_WOOD = new ItemTag("non_flammable_wood");
|
||||
public static final ItemTag SOUL_FIRE_BASE_BLOCKS = new ItemTag("soul_fire_base_blocks");
|
||||
public static final ItemTag CANDLES = new ItemTag("candles");
|
||||
public static final ItemTag DIRT = new ItemTag("dirt");
|
||||
public static final ItemTag TERRACOTTA = new ItemTag("terracotta");
|
||||
public static final ItemTag COMPLETES_FIND_TREE_TUTORIAL = new ItemTag("completes_find_tree_tutorial");
|
||||
public static final ItemTag BOATS = new ItemTag("boats");
|
||||
public static final ItemTag CHEST_BOATS = new ItemTag("chest_boats");
|
||||
public static final ItemTag FISHES = new ItemTag("fishes");
|
||||
public static final ItemTag SIGNS = new ItemTag("signs");
|
||||
public static final ItemTag CREEPER_DROP_MUSIC_DISCS = new ItemTag("creeper_drop_music_discs");
|
||||
public static final ItemTag COALS = new ItemTag("coals");
|
||||
public static final ItemTag ARROWS = new ItemTag("arrows");
|
||||
public static final ItemTag LECTERN_BOOKS = new ItemTag("lectern_books");
|
||||
public static final ItemTag BOOKSHELF_BOOKS = new ItemTag("bookshelf_books");
|
||||
public static final ItemTag BEACON_PAYMENT_ITEMS = new ItemTag("beacon_payment_items");
|
||||
public static final ItemTag STONE_TOOL_MATERIALS = new ItemTag("stone_tool_materials");
|
||||
public static final ItemTag STONE_CRAFTING_MATERIALS = new ItemTag("stone_crafting_materials");
|
||||
public static final ItemTag FREEZE_IMMUNE_WEARABLES = new ItemTag("freeze_immune_wearables");
|
||||
public static final ItemTag DAMPENS_VIBRATIONS = new ItemTag("dampens_vibrations");
|
||||
public static final ItemTag CLUSTER_MAX_HARVESTABLES = new ItemTag("cluster_max_harvestables");
|
||||
public static final ItemTag COMPASSES = new ItemTag("compasses");
|
||||
public static final ItemTag HANGING_SIGNS = new ItemTag("hanging_signs");
|
||||
public static final ItemTag CREEPER_IGNITERS = new ItemTag("creeper_igniters");
|
||||
public static final ItemTag NOTEBLOCK_TOP_INSTRUMENTS = new ItemTag("noteblock_top_instruments");
|
||||
public static final ItemTag FOOT_ARMOR = new ItemTag("foot_armor");
|
||||
public static final ItemTag LEG_ARMOR = new ItemTag("leg_armor");
|
||||
public static final ItemTag CHEST_ARMOR = new ItemTag("chest_armor");
|
||||
public static final ItemTag HEAD_ARMOR = new ItemTag("head_armor");
|
||||
public static final ItemTag SKULLS = new ItemTag("skulls");
|
||||
public static final ItemTag TRIMMABLE_ARMOR = new ItemTag("trimmable_armor");
|
||||
public static final ItemTag TRIM_MATERIALS = new ItemTag("trim_materials");
|
||||
public static final ItemTag TRIM_TEMPLATES = new ItemTag("trim_templates");
|
||||
public static final ItemTag DECORATED_POT_SHERDS = new ItemTag("decorated_pot_sherds");
|
||||
public static final ItemTag DECORATED_POT_INGREDIENTS = new ItemTag("decorated_pot_ingredients");
|
||||
public static final ItemTag SWORDS = new ItemTag("swords");
|
||||
public static final ItemTag AXES = new ItemTag("axes");
|
||||
public static final ItemTag HOES = new ItemTag("hoes");
|
||||
public static final ItemTag PICKAXES = new ItemTag("pickaxes");
|
||||
public static final ItemTag SHOVELS = new ItemTag("shovels");
|
||||
public static final ItemTag BREAKS_DECORATED_POTS = new ItemTag("breaks_decorated_pots");
|
||||
public static final ItemTag VILLAGER_PLANTABLE_SEEDS = new ItemTag("villager_plantable_seeds");
|
||||
public static final ItemTag DYEABLE = new ItemTag("dyeable");
|
||||
public static final ItemTag ENCHANTABLE_FOOT_ARMOR = new ItemTag("enchantable/foot_armor");
|
||||
public static final ItemTag ENCHANTABLE_LEG_ARMOR = new ItemTag("enchantable/leg_armor");
|
||||
public static final ItemTag ENCHANTABLE_CHEST_ARMOR = new ItemTag("enchantable/chest_armor");
|
||||
public static final ItemTag ENCHANTABLE_HEAD_ARMOR = new ItemTag("enchantable/head_armor");
|
||||
public static final ItemTag ENCHANTABLE_ARMOR = new ItemTag("enchantable/armor");
|
||||
public static final ItemTag ENCHANTABLE_SWORD = new ItemTag("enchantable/sword");
|
||||
public static final ItemTag ENCHANTABLE_FIRE_ASPECT = new ItemTag("enchantable/fire_aspect");
|
||||
public static final ItemTag ENCHANTABLE_SHARP_WEAPON = new ItemTag("enchantable/sharp_weapon");
|
||||
public static final ItemTag ENCHANTABLE_WEAPON = new ItemTag("enchantable/weapon");
|
||||
public static final ItemTag ENCHANTABLE_MINING = new ItemTag("enchantable/mining");
|
||||
public static final ItemTag ENCHANTABLE_MINING_LOOT = new ItemTag("enchantable/mining_loot");
|
||||
public static final ItemTag ENCHANTABLE_FISHING = new ItemTag("enchantable/fishing");
|
||||
public static final ItemTag ENCHANTABLE_TRIDENT = new ItemTag("enchantable/trident");
|
||||
public static final ItemTag ENCHANTABLE_DURABILITY = new ItemTag("enchantable/durability");
|
||||
public static final ItemTag ENCHANTABLE_BOW = new ItemTag("enchantable/bow");
|
||||
public static final ItemTag ENCHANTABLE_EQUIPPABLE = new ItemTag("enchantable/equippable");
|
||||
public static final ItemTag ENCHANTABLE_CROSSBOW = new ItemTag("enchantable/crossbow");
|
||||
public static final ItemTag ENCHANTABLE_VANISHING = new ItemTag("enchantable/vanishing");
|
||||
public static final ItemTag ENCHANTABLE_MACE = new ItemTag("enchantable/mace");
|
||||
private ItemTag() {}
|
||||
|
||||
private final int id;
|
||||
|
||||
private ItemTag(String identifier) {
|
||||
this.id = ALL_ITEM_TAGS.size();
|
||||
register(identifier, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int ordinal() {
|
||||
return id;
|
||||
}
|
||||
|
||||
private static void register(String name, ItemTag tag) {
|
||||
ALL_ITEM_TAGS.put(MinecraftKey.key(name), tag);
|
||||
private static Tag<Item> create(String name) {
|
||||
return new Tag<>(JavaRegistries.ITEM, MinecraftKey.key(name));
|
||||
}
|
||||
}
|
||||
|
35
core/src/main/java/org/geysermc/geyser/session/cache/tags/Tag.java
vendored
Normale Datei
35
core/src/main/java/org/geysermc/geyser/session/cache/tags/Tag.java
vendored
Normale Datei
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2024 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author GeyserMC
|
||||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.geyser.session.cache.tags;
|
||||
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.geysermc.geyser.session.cache.registry.JavaRegistryKey;
|
||||
|
||||
/**
|
||||
* A tag in any of the registries that tags are loaded for by Geyser.
|
||||
*/
|
||||
public record Tag<T>(JavaRegistryKey<T> registry, Key tag) {
|
||||
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren