From ce4866156d3ec6404549b9278308bb963e236142 Mon Sep 17 00:00:00 2001 From: RednedEpic Date: Tue, 9 May 2023 11:46:06 -0500 Subject: [PATCH] Add support for custom entities in the API Allows for creating custom entity definitions upon registration as well as modifying existing entity spawns to use custom entity identifiers. --- .../geyser/api/entity/EntityDefinition.java | 112 ++++ .../geyser/api/entity/EntityIdentifier.java | 97 ++++ .../bedrock/SessionDefineEntitiesEvent.java | 68 +++ .../event/java/ServerSpawnEntityEvent.java | 94 ++++ .../GeyserDefineCustomItemsEvent.java | 2 +- .../lifecycle/GeyserDefineEntitiesEvent.java | 58 ++ .../java/org/geysermc/geyser/GeyserImpl.java | 3 + .../geyser/entity/EntityDefinitions.java | 518 +++++++++--------- ...ition.java => GeyserEntityDefinition.java} | 117 +++- .../geyser/entity/GeyserEntityIdentifier.java | 85 +++ .../geyser/entity/factory/EntityFactory.java | 4 +- .../entity/type/AbstractArrowEntity.java | 4 +- .../entity/type/AreaEffectCloudEntity.java | 5 +- .../geyser/entity/type/BoatEntity.java | 4 +- .../geyser/entity/type/ChestBoatEntity.java | 4 +- .../type/CommandBlockMinecartEntity.java | 4 +- .../type/DefaultBlockMinecartEntity.java | 4 +- .../entity/type/EnderCrystalEntity.java | 4 +- .../geysermc/geyser/entity/type/Entity.java | 6 +- .../geyser/entity/type/EvokerFangsEntity.java | 4 +- .../geyser/entity/type/FireballEntity.java | 4 +- .../geyser/entity/type/FireworkEntity.java | 4 +- .../entity/type/FurnaceMinecartEntity.java | 4 +- .../geyser/entity/type/ItemEntity.java | 4 +- .../geyser/entity/type/ItemFrameEntity.java | 4 +- .../geyser/entity/type/LeashKnotEntity.java | 4 +- .../geyser/entity/type/LightningEntity.java | 4 +- .../geyser/entity/type/LivingEntity.java | 4 +- .../geyser/entity/type/MinecartEntity.java | 4 +- .../geyser/entity/type/PaintingEntity.java | 4 +- .../entity/type/SpawnerMinecartEntity.java | 4 +- .../geyser/entity/type/TNTEntity.java | 4 +- .../geyser/entity/type/TextDisplayEntity.java | 4 +- .../geyser/entity/type/ThrowableEntity.java | 4 +- .../entity/type/ThrowableItemEntity.java | 4 +- .../entity/type/ThrownPotionEntity.java | 4 +- .../geyser/entity/type/TippedArrowEntity.java | 4 +- .../geyser/entity/type/TridentEntity.java | 4 +- .../geyser/entity/type/WitherSkullEntity.java | 4 +- .../type/living/AbstractFishEntity.java | 4 +- .../entity/type/living/AgeableEntity.java | 4 +- .../entity/type/living/AllayEntity.java | 4 +- .../entity/type/living/AmbientEntity.java | 4 +- .../entity/type/living/ArmorStandEntity.java | 4 +- .../geyser/entity/type/living/BatEntity.java | 4 +- .../entity/type/living/CreatureEntity.java | 4 +- .../entity/type/living/DolphinEntity.java | 4 +- .../entity/type/living/FlyingEntity.java | 4 +- .../entity/type/living/GlowSquidEntity.java | 4 +- .../entity/type/living/GolemEntity.java | 4 +- .../entity/type/living/IronGolemEntity.java | 4 +- .../entity/type/living/MagmaCubeEntity.java | 4 +- .../geyser/entity/type/living/MobEntity.java | 4 +- .../entity/type/living/SlimeEntity.java | 4 +- .../entity/type/living/SnowGolemEntity.java | 4 +- .../entity/type/living/SquidEntity.java | 4 +- .../entity/type/living/TadpoleEntity.java | 4 +- .../entity/type/living/WaterEntity.java | 4 +- .../type/living/animal/AnimalEntity.java | 4 +- .../type/living/animal/AxolotlEntity.java | 4 +- .../entity/type/living/animal/BeeEntity.java | 4 +- .../type/living/animal/ChickenEntity.java | 4 +- .../entity/type/living/animal/CowEntity.java | 4 +- .../entity/type/living/animal/FoxEntity.java | 4 +- .../entity/type/living/animal/FrogEntity.java | 4 +- .../entity/type/living/animal/GoatEntity.java | 4 +- .../type/living/animal/HoglinEntity.java | 4 +- .../type/living/animal/MooshroomEntity.java | 4 +- .../type/living/animal/OcelotEntity.java | 4 +- .../type/living/animal/PandaEntity.java | 4 +- .../entity/type/living/animal/PigEntity.java | 4 +- .../type/living/animal/PolarBearEntity.java | 4 +- .../type/living/animal/PufferFishEntity.java | 4 +- .../type/living/animal/RabbitEntity.java | 4 +- .../type/living/animal/SheepEntity.java | 4 +- .../type/living/animal/StriderEntity.java | 4 +- .../living/animal/TropicalFishEntity.java | 4 +- .../type/living/animal/TurtleEntity.java | 4 +- .../animal/horse/AbstractHorseEntity.java | 4 +- .../type/living/animal/horse/CamelEntity.java | 4 +- .../animal/horse/ChestedHorseEntity.java | 4 +- .../type/living/animal/horse/HorseEntity.java | 4 +- .../type/living/animal/horse/LlamaEntity.java | 4 +- .../animal/horse/SkeletonHorseEntity.java | 4 +- .../animal/horse/TraderLlamaEntity.java | 4 +- .../animal/horse/ZombieHorseEntity.java | 4 +- .../living/animal/tameable/CatEntity.java | 4 +- .../living/animal/tameable/ParrotEntity.java | 4 +- .../animal/tameable/TameableEntity.java | 4 +- .../living/animal/tameable/WolfEntity.java | 4 +- .../merchant/AbstractMerchantEntity.java | 4 +- .../type/living/merchant/VillagerEntity.java | 4 +- .../monster/AbstractSkeletonEntity.java | 4 +- .../type/living/monster/BasePiglinEntity.java | 4 +- .../type/living/monster/BlazeEntity.java | 4 +- .../type/living/monster/CreeperEntity.java | 4 +- .../living/monster/ElderGuardianEntity.java | 4 +- .../living/monster/EnderDragonEntity.java | 4 +- .../type/living/monster/EndermanEntity.java | 4 +- .../type/living/monster/GhastEntity.java | 4 +- .../type/living/monster/GiantEntity.java | 4 +- .../type/living/monster/GuardianEntity.java | 4 +- .../type/living/monster/MonsterEntity.java | 4 +- .../type/living/monster/PhantomEntity.java | 4 +- .../type/living/monster/PiglinEntity.java | 4 +- .../type/living/monster/ShulkerEntity.java | 4 +- .../type/living/monster/SkeletonEntity.java | 4 +- .../type/living/monster/SpiderEntity.java | 4 +- .../entity/type/living/monster/VexEntity.java | 4 +- .../type/living/monster/WardenEntity.java | 4 +- .../type/living/monster/WitherEntity.java | 4 +- .../type/living/monster/ZoglinEntity.java | 4 +- .../type/living/monster/ZombieEntity.java | 4 +- .../living/monster/ZombieVillagerEntity.java | 4 +- .../living/monster/ZombifiedPiglinEntity.java | 4 +- .../monster/raid/AbstractIllagerEntity.java | 4 +- .../living/monster/raid/PillagerEntity.java | 4 +- .../monster/raid/RaidParticipantEntity.java | 4 +- .../raid/SpellcasterIllagerEntity.java | 4 +- .../living/monster/raid/VindicatorEntity.java | 4 +- .../type/GeyserDefineEntitiesEventImpl.java | 46 ++ .../geysermc/geyser/registry/Registries.java | 58 +- .../loader/ProviderRegistryLoader.java | 7 + .../geyser/session/GeyserSession.java | 41 +- .../entity/SpawnerBlockEntityTranslator.java | 4 +- .../protocol/java/JavaCommandsTranslator.java | 2 +- .../entity/JavaSetEntityDataTranslator.java | 6 +- .../entity/spawn/JavaAddEntityTranslator.java | 24 +- .../org/geysermc/geyser/util/EntityUtils.java | 30 + 129 files changed, 1292 insertions(+), 523 deletions(-) create mode 100644 api/src/main/java/org/geysermc/geyser/api/entity/EntityDefinition.java create mode 100644 api/src/main/java/org/geysermc/geyser/api/entity/EntityIdentifier.java create mode 100644 api/src/main/java/org/geysermc/geyser/api/event/bedrock/SessionDefineEntitiesEvent.java create mode 100644 api/src/main/java/org/geysermc/geyser/api/event/java/ServerSpawnEntityEvent.java create mode 100644 api/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserDefineEntitiesEvent.java rename core/src/main/java/org/geysermc/geyser/entity/{EntityDefinition.java => GeyserEntityDefinition.java} (51%) create mode 100644 core/src/main/java/org/geysermc/geyser/entity/GeyserEntityIdentifier.java create mode 100644 core/src/main/java/org/geysermc/geyser/event/type/GeyserDefineEntitiesEventImpl.java diff --git a/api/src/main/java/org/geysermc/geyser/api/entity/EntityDefinition.java b/api/src/main/java/org/geysermc/geyser/api/entity/EntityDefinition.java new file mode 100644 index 000000000..753e67f68 --- /dev/null +++ b/api/src/main/java/org/geysermc/geyser/api/entity/EntityDefinition.java @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2019-2023 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.api.entity; + +import org.checkerframework.checker.nullness.qual.NonNull; +import org.geysermc.geyser.api.GeyserApi; + +/** + * Holds information about an entity that remains constant no matter + * its properties. This is typically data such as its identifier, + * its height/width, offset, etc. + */ +public interface EntityDefinition { + + /** + * Gets the identifier of this entity. + * + * @return the identifier of this entity + */ + @NonNull + EntityIdentifier entityIdentifier(); + + /** + * Gets the width of this entity. + * + * @return the width of this entity + */ + float width(); + + /** + * Gets the height of this entity. + * + * @return the height of this entity + */ + float height(); + + /** + * Gets the offset of this entity. + * + * @return the offset of this entity + */ + float offset(); + + static Builder builder() { + return GeyserApi.api().provider(Builder.class); + } + + interface Builder { + + /** + * Sets the identifier of this entity. + * + * @param identifier the identifier of this entity + * @return the builder + */ + Builder identifier(@NonNull EntityIdentifier identifier); + + /** + * Sets the width of this entity. + * + * @param width the width of this entity + * @return the builder + */ + Builder width(float width); + + /** + * Sets the height of this entity. + * + * @param height the height of this entity + * @return the builder + */ + Builder height(float height); + + /** + * Sets the offset of this entity. + * + * @param offset the offset of this entity + * @return the builder + */ + Builder offset(float offset); + + /** + * Builds the entity definition. + * + * @return the entity definition + */ + EntityDefinition build(); + } +} \ No newline at end of file diff --git a/api/src/main/java/org/geysermc/geyser/api/entity/EntityIdentifier.java b/api/src/main/java/org/geysermc/geyser/api/entity/EntityIdentifier.java new file mode 100644 index 000000000..0b2851a11 --- /dev/null +++ b/api/src/main/java/org/geysermc/geyser/api/entity/EntityIdentifier.java @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2019-2023 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.api.entity; + +import org.checkerframework.checker.nullness.qual.NonNull; +import org.geysermc.geyser.api.GeyserApi; + +/** + * Represents the data sent over to a client regarding + * an entity's identifier. + */ +public interface EntityIdentifier { + + /** + * Gets whether this entity has a spawn egg or not. + * + * @return whether this entity has a spawn egg or not + */ + boolean hasSpawnEgg(); + + /** + * Gets the entity's identifier that is sent to the client. + * + * @return the entity's identifier that is sent to the client. + */ + @NonNull + String identifier(); + + /** + * Gets whether the entity is summonable or not. + * + * @return whether the entity is summonable or not + */ + boolean isSummonable(); + + @NonNull + static Builder builder() { + return GeyserApi.api().provider(Builder.class); + } + + interface Builder { + + /** + * Sets whether the entity has a spawn egg or not. + * + * @param spawnEgg whether the entity has a spawn egg or not + * @return the builder + */ + Builder spawnEgg(boolean spawnEgg); + + /** + * Sets the entity's identifier that is sent to the client. + * + * @param identifier the entity's identifier that is sent to the client + * @return the builder + */ + Builder identifier(String identifier); + + /** + * Sets whether the entity is summonable or not. + * + * @param summonable whether the entity is summonable or not + * @return the builder + */ + Builder summonable(boolean summonable); + + /** + * Builds the entity identifier. + * + * @return the entity identifier + */ + EntityIdentifier build(); + } +} \ No newline at end of file diff --git a/api/src/main/java/org/geysermc/geyser/api/event/bedrock/SessionDefineEntitiesEvent.java b/api/src/main/java/org/geysermc/geyser/api/event/bedrock/SessionDefineEntitiesEvent.java new file mode 100644 index 000000000..d83602f41 --- /dev/null +++ b/api/src/main/java/org/geysermc/geyser/api/event/bedrock/SessionDefineEntitiesEvent.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2019-2023 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.api.event.bedrock; + +import org.checkerframework.checker.nullness.qual.NonNull; +import org.geysermc.event.Event; +import org.geysermc.geyser.api.connection.GeyserConnection; +import org.geysermc.geyser.api.entity.EntityDefinition; +import org.geysermc.geyser.api.entity.EntityIdentifier; +import org.geysermc.geyser.api.event.connection.ConnectionEvent; + +import java.util.List; + +/** + * Called when Geyser sends a list of available entities to the + * Bedrock client. This will typically contain all the available + * entities within vanilla, but can be modified to include any custom + * entity defined through a resource pack. + */ +public abstract class SessionDefineEntitiesEvent extends ConnectionEvent { + private final List identifiers; + + public SessionDefineEntitiesEvent(@NonNull GeyserConnection connection, @NonNull List identifiers) { + super(connection); + this.identifiers = identifiers; + } + + /** + * Gets the list of entity identifiers. + * + * @return the list of entity identifiers + */ + @NonNull + public List entityIdentifiers() { + return this.identifiers; + } + + /** + * Registers a new entity identifier for the player. + * + * @param entityIdentifier the entity identifier to register + * @return {@code true} if the entity identifier was registered, {@code false} otherwise + */ + public abstract boolean register(@NonNull EntityIdentifier entityIdentifier); +} \ No newline at end of file diff --git a/api/src/main/java/org/geysermc/geyser/api/event/java/ServerSpawnEntityEvent.java b/api/src/main/java/org/geysermc/geyser/api/event/java/ServerSpawnEntityEvent.java new file mode 100644 index 000000000..812d2083e --- /dev/null +++ b/api/src/main/java/org/geysermc/geyser/api/event/java/ServerSpawnEntityEvent.java @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2019-2023 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.api.event.java; + +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.geysermc.geyser.api.connection.GeyserConnection; +import org.geysermc.geyser.api.entity.EntityDefinition; +import org.geysermc.geyser.api.event.connection.ConnectionEvent; + +import java.util.UUID; + +/** + * Called when the downstream server spawns an entity. + */ +public class ServerSpawnEntityEvent extends ConnectionEvent { + private final int entityId; + private final UUID uuid; + + private EntityDefinition entityDefinition; + + public ServerSpawnEntityEvent(@NonNull GeyserConnection connection, int entityId, @Nullable UUID uuid, + @NonNull EntityDefinition entityDefinition) { + super(connection); + this.entityId = entityId; + this.uuid = uuid; + this.entityDefinition = entityDefinition; + } + + /** + * Gets the entity id of the entity being spawned. + * + * @return the entity id of the entity being spawned + */ + public int entityId() { + return this.entityId; + } + + /** + * Gets the uuid of the entity being spawned. + * + * @return the uuid of the entity being spawned + */ + @Nullable + public UUID uuid() { + return this.uuid; + } + + /** + * Gets the entity definition sent to the connection + * when the entity is spawned. + * + * @return the entity definition sent to the connection + * when the entity is spawned + */ + @NonNull + public EntityDefinition entityDefinition() { + return this.entityDefinition; + } + + /** + * Sets the entity definition sent to the connection + * when the entity is spawned. + * + * @param entityDefinition the entity definition sent to the connection + * when the entity is spawned + */ + public void entityDefinition(@NonNull EntityDefinition entityDefinition) { + this.entityDefinition = entityDefinition; + } +} \ No newline at end of file diff --git a/api/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserDefineCustomItemsEvent.java b/api/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserDefineCustomItemsEvent.java index 0957b8551..bd14aaf43 100644 --- a/api/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserDefineCustomItemsEvent.java +++ b/api/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserDefineCustomItemsEvent.java @@ -36,7 +36,7 @@ import java.util.Map; /** * Called on Geyser's startup when looking for custom items. Custom items must be registered through this event. - * + *

* This event will not be called if the "add non-Bedrock items" setting is disabled in the Geyser config. */ public interface GeyserDefineCustomItemsEvent extends Event { diff --git a/api/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserDefineEntitiesEvent.java b/api/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserDefineEntitiesEvent.java new file mode 100644 index 000000000..4dce40d5f --- /dev/null +++ b/api/src/main/java/org/geysermc/geyser/api/event/lifecycle/GeyserDefineEntitiesEvent.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2019-2023 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.api.event.lifecycle; + +import org.checkerframework.checker.nullness.qual.NonNull; +import org.geysermc.event.Event; +import org.geysermc.geyser.api.entity.EntityDefinition; + +import java.util.List; + +/** + * Called when entities are defined within Geyser. + *

+ * This event can be used to add custom entities to Geyser. + * Entity definitions can be created using the builder provided + * inside of {@link EntityDefinition}. + */ +public interface GeyserDefineEntitiesEvent extends Event { + + /** + * Gets the list of entity definitions. + * + * @return the list of entity definitions + */ + @NonNull + List entityDefinitions(); + + /** + * Registers a new entity definition. + * + * @param entityDefinition the entity definition to register + * @return {@code true} if the entity definition was registered, {@code false} otherwise + */ + boolean register(@NonNull EntityDefinition entityDefinition); +} \ No newline at end of file diff --git a/core/src/main/java/org/geysermc/geyser/GeyserImpl.java b/core/src/main/java/org/geysermc/geyser/GeyserImpl.java index 8204cfd3b..344fb7663 100644 --- a/core/src/main/java/org/geysermc/geyser/GeyserImpl.java +++ b/core/src/main/java/org/geysermc/geyser/GeyserImpl.java @@ -213,6 +213,9 @@ public class GeyserImpl implements GeyserApi { CompletableFuture.runAsync(AssetUtils::downloadAndRunClientJarTasks); }); + /* Call Registry events */ + Registries.callRegistryEvents(); + startInstance(); GeyserConfiguration config = bootstrap.getGeyserConfig(); diff --git a/core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java b/core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java index 9c7e19853..5c79e6426 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java +++ b/core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java @@ -51,137 +51,137 @@ import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.translator.text.MessageTranslator; public final class EntityDefinitions { - public static final EntityDefinition ALLAY; - public static final EntityDefinition AREA_EFFECT_CLOUD; - public static final EntityDefinition ARMOR_STAND; - public static final EntityDefinition ARROW; - public static final EntityDefinition AXOLOTL; - public static final EntityDefinition BAT; - public static final EntityDefinition BEE; - public static final EntityDefinition BLAZE; - public static final EntityDefinition BOAT; - public static final EntityDefinition CAMEL; - public static final EntityDefinition CAT; - public static final EntityDefinition CAVE_SPIDER; - public static final EntityDefinition CHEST_MINECART; - public static final EntityDefinition CHICKEN; - public static final EntityDefinition CHEST_BOAT; - public static final EntityDefinition COD; - public static final EntityDefinition COMMAND_BLOCK_MINECART; - public static final EntityDefinition COW; - public static final EntityDefinition CREEPER; - public static final EntityDefinition DOLPHIN; - public static final EntityDefinition DONKEY; - public static final EntityDefinition DRAGON_FIREBALL; - public static final EntityDefinition DROWNED; - public static final EntityDefinition EGG; - public static final EntityDefinition ELDER_GUARDIAN; - public static final EntityDefinition ENDERMAN; - public static final EntityDefinition ENDERMITE; - public static final EntityDefinition ENDER_DRAGON; - public static final EntityDefinition ENDER_PEARL; - public static final EntityDefinition END_CRYSTAL; - public static final EntityDefinition EVOKER; - public static final EntityDefinition EVOKER_FANGS; - public static final EntityDefinition EXPERIENCE_BOTTLE; - public static final EntityDefinition EXPERIENCE_ORB; - public static final EntityDefinition EYE_OF_ENDER; - public static final EntityDefinition FALLING_BLOCK; - public static final EntityDefinition FIREBALL; - public static final EntityDefinition FIREWORK_ROCKET; - public static final EntityDefinition FISHING_BOBBER; - public static final EntityDefinition FOX; - public static final EntityDefinition FROG; - public static final EntityDefinition FURNACE_MINECART; // Not present on Bedrock - public static final EntityDefinition GHAST; - public static final EntityDefinition GIANT; - public static final EntityDefinition GLOW_ITEM_FRAME; - public static final EntityDefinition GLOW_SQUID; - public static final EntityDefinition GOAT; - public static final EntityDefinition GUARDIAN; - public static final EntityDefinition HOGLIN; - public static final EntityDefinition HOPPER_MINECART; - public static final EntityDefinition HORSE; - public static final EntityDefinition HUSK; - public static final EntityDefinition ILLUSIONER; // Not present on Bedrock - public static final EntityDefinition IRON_GOLEM; - public static final EntityDefinition ITEM; - public static final EntityDefinition ITEM_FRAME; - public static final EntityDefinition LEASH_KNOT; - public static final EntityDefinition LIGHTNING_BOLT; - public static final EntityDefinition LLAMA; - public static final EntityDefinition LLAMA_SPIT; - public static final EntityDefinition MAGMA_CUBE; - public static final EntityDefinition MINECART; - public static final EntityDefinition MOOSHROOM; - public static final EntityDefinition MULE; - public static final EntityDefinition OCELOT; - public static final EntityDefinition PAINTING; - public static final EntityDefinition PANDA; - public static final EntityDefinition PARROT; - public static final EntityDefinition PHANTOM; - public static final EntityDefinition PIG; - public static final EntityDefinition PIGLIN; - public static final EntityDefinition PIGLIN_BRUTE; - public static final EntityDefinition PILLAGER; - public static final EntityDefinition PLAYER; - public static final EntityDefinition POLAR_BEAR; - public static final EntityDefinition POTION; - public static final EntityDefinition PUFFERFISH; - public static final EntityDefinition RABBIT; - public static final EntityDefinition RAVAGER; - public static final EntityDefinition SALMON; - public static final EntityDefinition SHEEP; - public static final EntityDefinition SHULKER; - public static final EntityDefinition SHULKER_BULLET; - public static final EntityDefinition SILVERFISH; - public static final EntityDefinition SKELETON; - public static final EntityDefinition SKELETON_HORSE; - public static final EntityDefinition SLIME; - public static final EntityDefinition SMALL_FIREBALL; - public static final EntityDefinition SNOWBALL; - public static final EntityDefinition SNOW_GOLEM; - public static final EntityDefinition SPAWNER_MINECART; // Not present on Bedrock - public static final EntityDefinition SPECTRAL_ARROW; - public static final EntityDefinition SPIDER; - public static final EntityDefinition SQUID; - public static final EntityDefinition STRAY; - public static final EntityDefinition STRIDER; - public static final EntityDefinition TADPOLE; - public static final EntityDefinition TEXT_DISPLAY; - public static final EntityDefinition TNT; - public static final EntityDefinition TNT_MINECART; - public static final EntityDefinition TRADER_LLAMA; - public static final EntityDefinition TRIDENT; - public static final EntityDefinition TROPICAL_FISH; - public static final EntityDefinition TURTLE; - public static final EntityDefinition VEX; - public static final EntityDefinition VILLAGER; - public static final EntityDefinition VINDICATOR; - public static final EntityDefinition WANDERING_TRADER; - public static final EntityDefinition WARDEN; - public static final EntityDefinition WITCH; - public static final EntityDefinition WITHER; - public static final EntityDefinition WITHER_SKELETON; - public static final EntityDefinition WITHER_SKULL; - public static final EntityDefinition WOLF; - public static final EntityDefinition ZOGLIN; - public static final EntityDefinition ZOMBIE; - public static final EntityDefinition ZOMBIE_HORSE; - public static final EntityDefinition ZOMBIE_VILLAGER; - public static final EntityDefinition ZOMBIFIED_PIGLIN; + public static final GeyserEntityDefinition ALLAY; + public static final GeyserEntityDefinition AREA_EFFECT_CLOUD; + public static final GeyserEntityDefinition ARMOR_STAND; + public static final GeyserEntityDefinition ARROW; + public static final GeyserEntityDefinition AXOLOTL; + public static final GeyserEntityDefinition BAT; + public static final GeyserEntityDefinition BEE; + public static final GeyserEntityDefinition BLAZE; + public static final GeyserEntityDefinition BOAT; + public static final GeyserEntityDefinition CAMEL; + public static final GeyserEntityDefinition CAT; + public static final GeyserEntityDefinition CAVE_SPIDER; + public static final GeyserEntityDefinition CHEST_MINECART; + public static final GeyserEntityDefinition CHICKEN; + public static final GeyserEntityDefinition CHEST_BOAT; + public static final GeyserEntityDefinition COD; + public static final GeyserEntityDefinition COMMAND_BLOCK_MINECART; + public static final GeyserEntityDefinition COW; + public static final GeyserEntityDefinition CREEPER; + public static final GeyserEntityDefinition DOLPHIN; + public static final GeyserEntityDefinition DONKEY; + public static final GeyserEntityDefinition DRAGON_FIREBALL; + public static final GeyserEntityDefinition DROWNED; + public static final GeyserEntityDefinition EGG; + public static final GeyserEntityDefinition ELDER_GUARDIAN; + public static final GeyserEntityDefinition ENDERMAN; + public static final GeyserEntityDefinition ENDERMITE; + public static final GeyserEntityDefinition ENDER_DRAGON; + public static final GeyserEntityDefinition ENDER_PEARL; + public static final GeyserEntityDefinition END_CRYSTAL; + public static final GeyserEntityDefinition EVOKER; + public static final GeyserEntityDefinition EVOKER_FANGS; + public static final GeyserEntityDefinition EXPERIENCE_BOTTLE; + public static final GeyserEntityDefinition EXPERIENCE_ORB; + public static final GeyserEntityDefinition EYE_OF_ENDER; + public static final GeyserEntityDefinition FALLING_BLOCK; + public static final GeyserEntityDefinition FIREBALL; + public static final GeyserEntityDefinition FIREWORK_ROCKET; + public static final GeyserEntityDefinition FISHING_BOBBER; + public static final GeyserEntityDefinition FOX; + public static final GeyserEntityDefinition FROG; + public static final GeyserEntityDefinition FURNACE_MINECART; // Not present on Bedrock + public static final GeyserEntityDefinition GHAST; + public static final GeyserEntityDefinition GIANT; + public static final GeyserEntityDefinition GLOW_ITEM_FRAME; + public static final GeyserEntityDefinition GLOW_SQUID; + public static final GeyserEntityDefinition GOAT; + public static final GeyserEntityDefinition GUARDIAN; + public static final GeyserEntityDefinition HOGLIN; + public static final GeyserEntityDefinition HOPPER_MINECART; + public static final GeyserEntityDefinition HORSE; + public static final GeyserEntityDefinition HUSK; + public static final GeyserEntityDefinition ILLUSIONER; // Not present on Bedrock + public static final GeyserEntityDefinition IRON_GOLEM; + public static final GeyserEntityDefinition ITEM; + public static final GeyserEntityDefinition ITEM_FRAME; + public static final GeyserEntityDefinition LEASH_KNOT; + public static final GeyserEntityDefinition LIGHTNING_BOLT; + public static final GeyserEntityDefinition LLAMA; + public static final GeyserEntityDefinition LLAMA_SPIT; + public static final GeyserEntityDefinition MAGMA_CUBE; + public static final GeyserEntityDefinition MINECART; + public static final GeyserEntityDefinition MOOSHROOM; + public static final GeyserEntityDefinition MULE; + public static final GeyserEntityDefinition OCELOT; + public static final GeyserEntityDefinition PAINTING; + public static final GeyserEntityDefinition PANDA; + public static final GeyserEntityDefinition PARROT; + public static final GeyserEntityDefinition PHANTOM; + public static final GeyserEntityDefinition PIG; + public static final GeyserEntityDefinition PIGLIN; + public static final GeyserEntityDefinition PIGLIN_BRUTE; + public static final GeyserEntityDefinition PILLAGER; + public static final GeyserEntityDefinition PLAYER; + public static final GeyserEntityDefinition POLAR_BEAR; + public static final GeyserEntityDefinition POTION; + public static final GeyserEntityDefinition PUFFERFISH; + public static final GeyserEntityDefinition RABBIT; + public static final GeyserEntityDefinition RAVAGER; + public static final GeyserEntityDefinition SALMON; + public static final GeyserEntityDefinition SHEEP; + public static final GeyserEntityDefinition SHULKER; + public static final GeyserEntityDefinition SHULKER_BULLET; + public static final GeyserEntityDefinition SILVERFISH; + public static final GeyserEntityDefinition SKELETON; + public static final GeyserEntityDefinition SKELETON_HORSE; + public static final GeyserEntityDefinition SLIME; + public static final GeyserEntityDefinition SMALL_FIREBALL; + public static final GeyserEntityDefinition SNOWBALL; + public static final GeyserEntityDefinition SNOW_GOLEM; + public static final GeyserEntityDefinition SPAWNER_MINECART; // Not present on Bedrock + public static final GeyserEntityDefinition SPECTRAL_ARROW; + public static final GeyserEntityDefinition SPIDER; + public static final GeyserEntityDefinition SQUID; + public static final GeyserEntityDefinition STRAY; + public static final GeyserEntityDefinition STRIDER; + public static final GeyserEntityDefinition TADPOLE; + public static final GeyserEntityDefinition TEXT_DISPLAY; + public static final GeyserEntityDefinition TNT; + public static final GeyserEntityDefinition TNT_MINECART; + public static final GeyserEntityDefinition TRADER_LLAMA; + public static final GeyserEntityDefinition TRIDENT; + public static final GeyserEntityDefinition TROPICAL_FISH; + public static final GeyserEntityDefinition TURTLE; + public static final GeyserEntityDefinition VEX; + public static final GeyserEntityDefinition VILLAGER; + public static final GeyserEntityDefinition VINDICATOR; + public static final GeyserEntityDefinition WANDERING_TRADER; + public static final GeyserEntityDefinition WARDEN; + public static final GeyserEntityDefinition WITCH; + public static final GeyserEntityDefinition WITHER; + public static final GeyserEntityDefinition WITHER_SKELETON; + public static final GeyserEntityDefinition WITHER_SKULL; + public static final GeyserEntityDefinition WOLF; + public static final GeyserEntityDefinition ZOGLIN; + public static final GeyserEntityDefinition ZOMBIE; + public static final GeyserEntityDefinition ZOMBIE_HORSE; + public static final GeyserEntityDefinition ZOMBIE_VILLAGER; + public static final GeyserEntityDefinition ZOMBIFIED_PIGLIN; /** * Is not sent over the network */ - public static final EntityDefinition ENDER_DRAGON_PART; + public static final GeyserEntityDefinition ENDER_DRAGON_PART; /** * Special Bedrock type */ - public static final EntityDefinition WITHER_SKULL_DANGEROUS; + public static final GeyserEntityDefinition WITHER_SKULL_DANGEROUS; static { - EntityDefinition entityBase = EntityDefinition.builder(Entity::new) + GeyserEntityDefinition entityBase = GeyserEntityDefinition.builder(Entity::new) .addTranslator(MetadataType.BYTE, Entity::setFlags) .addTranslator(MetadataType.INT, Entity::setAir) // Air/bubbles .addTranslator(MetadataType.OPTIONAL_CHAT, Entity::setDisplayName) @@ -194,7 +194,7 @@ public final class EntityDefinitions { // Extends entity { - AREA_EFFECT_CLOUD = EntityDefinition.inherited(AreaEffectCloudEntity::new, entityBase) + AREA_EFFECT_CLOUD = GeyserEntityDefinition.inherited(AreaEffectCloudEntity::new, entityBase) .type(EntityType.AREA_EFFECT_CLOUD) .height(0.5f).width(1.0f) .addTranslator(MetadataType.FLOAT, AreaEffectCloudEntity::setRadius) @@ -202,7 +202,7 @@ public final class EntityDefinitions { .addTranslator(null) // Waiting .addTranslator(MetadataType.PARTICLE, AreaEffectCloudEntity::setParticle) .build(); - BOAT = EntityDefinition.inherited(BoatEntity::new, entityBase) + BOAT = GeyserEntityDefinition.inherited(BoatEntity::new, entityBase) .type(EntityType.BOAT) .height(0.6f).width(1.6f) .offset(0.35f) @@ -216,14 +216,14 @@ public final class EntityDefinitions { .addTranslator(MetadataType.BOOLEAN, BoatEntity::setPaddlingRight) .addTranslator(MetadataType.INT, (boatEntity, entityMetadata) -> boatEntity.getDirtyMetadata().put(EntityDataTypes.BOAT_BUBBLE_TIME, entityMetadata.getValue())) // May not actually do anything .build(); - CHEST_BOAT = EntityDefinition.inherited(ChestBoatEntity::new, BOAT) + CHEST_BOAT = GeyserEntityDefinition.inherited(ChestBoatEntity::new, BOAT) .type(EntityType.CHEST_BOAT) .build(); - DRAGON_FIREBALL = EntityDefinition.inherited(FireballEntity::new, entityBase) + DRAGON_FIREBALL = GeyserEntityDefinition.inherited(FireballEntity::new, entityBase) .type(EntityType.DRAGON_FIREBALL) .heightAndWidth(1.0f) .build(); - END_CRYSTAL = EntityDefinition.inherited(EnderCrystalEntity::new, entityBase) + END_CRYSTAL = GeyserEntityDefinition.inherited(EnderCrystalEntity::new, entityBase) .type(EntityType.END_CRYSTAL) .heightAndWidth(2.0f) .identifier("minecraft:ender_crystal") @@ -231,27 +231,27 @@ public final class EntityDefinitions { .addTranslator(MetadataType.BOOLEAN, (enderCrystalEntity, entityMetadata) -> enderCrystalEntity.setFlag(EntityFlag.SHOW_BOTTOM, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) // There is a base located on the ender crystal .build(); - EXPERIENCE_ORB = EntityDefinition.inherited(null, entityBase) + EXPERIENCE_ORB = GeyserEntityDefinition.inherited(null, entityBase) .type(EntityType.EXPERIENCE_ORB) .identifier("minecraft:xp_orb") .build(); - EVOKER_FANGS = EntityDefinition.builder(EvokerFangsEntity::new) // No entity metadata to listen to as of 1.18.1 + EVOKER_FANGS = GeyserEntityDefinition.builder(EvokerFangsEntity::new) // No entity metadata to listen to as of 1.18.1 .type(EntityType.EVOKER_FANGS) .height(0.8f).width(0.5f) .identifier("minecraft:evocation_fang") .build(); - EYE_OF_ENDER = EntityDefinition.inherited(Entity::new, entityBase) + EYE_OF_ENDER = GeyserEntityDefinition.inherited(Entity::new, entityBase) .type(EntityType.EYE_OF_ENDER) .heightAndWidth(0.25f) .identifier("minecraft:eye_of_ender_signal") .addTranslator(null) // Item .build(); - FALLING_BLOCK = EntityDefinition.inherited(null, entityBase) + FALLING_BLOCK = GeyserEntityDefinition.inherited(null, entityBase) .type(EntityType.FALLING_BLOCK) .heightAndWidth(0.98f) .addTranslator(null) // "start block position" .build(); - FIREWORK_ROCKET = EntityDefinition.inherited(FireworkEntity::new, entityBase) + FIREWORK_ROCKET = GeyserEntityDefinition.inherited(FireworkEntity::new, entityBase) .type(EntityType.FIREWORK_ROCKET) .heightAndWidth(0.25f) .identifier("minecraft:fireworks_rocket") @@ -259,44 +259,44 @@ public final class EntityDefinitions { .addTranslator(MetadataType.OPTIONAL_VARINT, FireworkEntity::setPlayerGliding) .addTranslator(null) // Shot at angle .build(); - FISHING_BOBBER = EntityDefinition.inherited(null, entityBase) + FISHING_BOBBER = GeyserEntityDefinition.inherited(null, entityBase) .type(EntityType.FISHING_BOBBER) .identifier("minecraft:fishing_hook") .addTranslator(MetadataType.INT, FishingHookEntity::setHookedEntity) .addTranslator(null) // Biting TODO check .build(); - ITEM = EntityDefinition.inherited(ItemEntity::new, entityBase) + ITEM = GeyserEntityDefinition.inherited(ItemEntity::new, entityBase) .type(EntityType.ITEM) .heightAndWidth(0.25f) .offset(0.125f) .addTranslator(MetadataType.ITEM, ItemEntity::setItem) .build(); - LEASH_KNOT = EntityDefinition.inherited(LeashKnotEntity::new, entityBase) + LEASH_KNOT = GeyserEntityDefinition.inherited(LeashKnotEntity::new, entityBase) .type(EntityType.LEASH_KNOT) .height(0.5f).width(0.375f) .build(); - LIGHTNING_BOLT = EntityDefinition.inherited(LightningEntity::new, entityBase) + LIGHTNING_BOLT = GeyserEntityDefinition.inherited(LightningEntity::new, entityBase) .type(EntityType.LIGHTNING_BOLT) .build(); - LLAMA_SPIT = EntityDefinition.inherited(ThrowableEntity::new, entityBase) + LLAMA_SPIT = GeyserEntityDefinition.inherited(ThrowableEntity::new, entityBase) .type(EntityType.LLAMA_SPIT) .heightAndWidth(0.25f) .build(); - PAINTING = EntityDefinition.inherited(null, entityBase) + PAINTING = GeyserEntityDefinition.inherited(null, entityBase) .type(EntityType.PAINTING) .addTranslator(MetadataType.PAINTING_VARIANT, PaintingEntity::setPaintingType) .build(); - SHULKER_BULLET = EntityDefinition.inherited(ThrowableEntity::new, entityBase) + SHULKER_BULLET = GeyserEntityDefinition.inherited(ThrowableEntity::new, entityBase) .type(EntityType.SHULKER_BULLET) .heightAndWidth(0.3125f) .build(); - TNT = EntityDefinition.inherited(TNTEntity::new, entityBase) + TNT = GeyserEntityDefinition.inherited(TNTEntity::new, entityBase) .type(EntityType.TNT) .heightAndWidth(0.98f) .addTranslator(MetadataType.INT, TNTEntity::setFuseLength) .build(); - EntityDefinition displayBase = EntityDefinition.inherited(entityBase.factory(), entityBase) + GeyserEntityDefinition displayBase = GeyserEntityDefinition.inherited(entityBase.factory(), entityBase) .addTranslator(null) // Interpolation start ticks .addTranslator(null) // Interpolation duration ID .addTranslator(null) // Translation @@ -312,65 +312,65 @@ public final class EntityDefinitions { .addTranslator(null) // Height .addTranslator(null) // Glow color override .build(); - TEXT_DISPLAY = EntityDefinition.inherited(TextDisplayEntity::new, displayBase) + TEXT_DISPLAY = GeyserEntityDefinition.inherited(TextDisplayEntity::new, displayBase) .type(EntityType.TEXT_DISPLAY) .identifier("minecraft:armor_stand") .addTranslator(MetadataType.CHAT, TextDisplayEntity::setText) .build(); - EntityDefinition fireballBase = EntityDefinition.inherited(FireballEntity::new, entityBase) + GeyserEntityDefinition fireballBase = GeyserEntityDefinition.inherited(FireballEntity::new, entityBase) .addTranslator(null) // Item .build(); - FIREBALL = EntityDefinition.inherited(FireballEntity::new, fireballBase) + FIREBALL = GeyserEntityDefinition.inherited(FireballEntity::new, fireballBase) .type(EntityType.FIREBALL) .heightAndWidth(1.0f) .build(); - SMALL_FIREBALL = EntityDefinition.inherited(FireballEntity::new, fireballBase) + SMALL_FIREBALL = GeyserEntityDefinition.inherited(FireballEntity::new, fireballBase) .type(EntityType.SMALL_FIREBALL) .heightAndWidth(0.3125f) .build(); - EntityDefinition throwableItemBase = EntityDefinition.inherited(ThrowableItemEntity::new, entityBase) + GeyserEntityDefinition throwableItemBase = GeyserEntityDefinition.inherited(ThrowableItemEntity::new, entityBase) .addTranslator(MetadataType.ITEM, ThrowableItemEntity::setItem) .build(); - EGG = EntityDefinition.inherited(ThrowableItemEntity::new, throwableItemBase) + EGG = GeyserEntityDefinition.inherited(ThrowableItemEntity::new, throwableItemBase) .type(EntityType.EGG) .heightAndWidth(0.25f) .build(); - ENDER_PEARL = EntityDefinition.inherited(ThrowableItemEntity::new, throwableItemBase) + ENDER_PEARL = GeyserEntityDefinition.inherited(ThrowableItemEntity::new, throwableItemBase) .type(EntityType.ENDER_PEARL) .heightAndWidth(0.25f) .build(); - EXPERIENCE_BOTTLE = EntityDefinition.inherited(ThrowableItemEntity::new, throwableItemBase) + EXPERIENCE_BOTTLE = GeyserEntityDefinition.inherited(ThrowableItemEntity::new, throwableItemBase) .type(EntityType.EXPERIENCE_BOTTLE) .heightAndWidth(0.25f) .identifier("minecraft:xp_bottle") .build(); - POTION = EntityDefinition.inherited(ThrownPotionEntity::new, throwableItemBase) + POTION = GeyserEntityDefinition.inherited(ThrownPotionEntity::new, throwableItemBase) .type(EntityType.POTION) .heightAndWidth(0.25f) .identifier("minecraft:splash_potion") .build(); - SNOWBALL = EntityDefinition.inherited(ThrowableItemEntity::new, throwableItemBase) + SNOWBALL = GeyserEntityDefinition.inherited(ThrowableItemEntity::new, throwableItemBase) .type(EntityType.SNOWBALL) .heightAndWidth(0.25f) .build(); - EntityDefinition abstractArrowBase = EntityDefinition.inherited(AbstractArrowEntity::new, entityBase) + GeyserEntityDefinition abstractArrowBase = GeyserEntityDefinition.inherited(AbstractArrowEntity::new, entityBase) .addTranslator(MetadataType.BYTE, AbstractArrowEntity::setArrowFlags) .addTranslator(null) // "Piercing level" .build(); - ARROW = EntityDefinition.inherited(TippedArrowEntity::new, abstractArrowBase) + ARROW = GeyserEntityDefinition.inherited(TippedArrowEntity::new, abstractArrowBase) .type(EntityType.ARROW) .heightAndWidth(0.25f) .addTranslator(MetadataType.INT, TippedArrowEntity::setPotionEffectColor) .build(); - SPECTRAL_ARROW = EntityDefinition.inherited(abstractArrowBase.factory(), abstractArrowBase) + SPECTRAL_ARROW = GeyserEntityDefinition.inherited(abstractArrowBase.factory(), abstractArrowBase) .type(EntityType.SPECTRAL_ARROW) .heightAndWidth(0.25f) .identifier("minecraft:arrow") .build(); - TRIDENT = EntityDefinition.inherited(TridentEntity::new, abstractArrowBase) // TODO remove class + TRIDENT = GeyserEntityDefinition.inherited(TridentEntity::new, abstractArrowBase) // TODO remove class .type(EntityType.TRIDENT) .identifier("minecraft:thrown_trident") .addTranslator(null) // Loyalty @@ -378,16 +378,16 @@ public final class EntityDefinitions { .build(); // Item frames are handled differently as they are blocks, not items, in Bedrock - ITEM_FRAME = EntityDefinition.inherited(null, entityBase) + ITEM_FRAME = GeyserEntityDefinition.inherited(null, entityBase) .type(EntityType.ITEM_FRAME) .addTranslator(MetadataType.ITEM, ItemFrameEntity::setItemInFrame) .addTranslator(MetadataType.INT, ItemFrameEntity::setItemRotation) .build(); - GLOW_ITEM_FRAME = EntityDefinition.inherited(ITEM_FRAME.factory(), ITEM_FRAME) + GLOW_ITEM_FRAME = GeyserEntityDefinition.inherited(ITEM_FRAME.factory(), ITEM_FRAME) .type(EntityType.GLOW_ITEM_FRAME) .build(); - MINECART = EntityDefinition.inherited(MinecartEntity::new, entityBase) + MINECART = GeyserEntityDefinition.inherited(MinecartEntity::new, entityBase) .type(EntityType.MINECART) .height(0.7f).width(0.98f) .offset(0.35f) @@ -400,40 +400,40 @@ public final class EntityDefinitions { .addTranslator(MetadataType.INT, MinecartEntity::setCustomBlockOffset) .addTranslator(MetadataType.BOOLEAN, MinecartEntity::setShowCustomBlock) .build(); - CHEST_MINECART = EntityDefinition.inherited(MINECART.factory(), MINECART) + CHEST_MINECART = GeyserEntityDefinition.inherited(MINECART.factory(), MINECART) .type(EntityType.CHEST_MINECART) .build(); - COMMAND_BLOCK_MINECART = EntityDefinition.inherited(CommandBlockMinecartEntity::new, MINECART) + COMMAND_BLOCK_MINECART = GeyserEntityDefinition.inherited(CommandBlockMinecartEntity::new, MINECART) .type(EntityType.COMMAND_BLOCK_MINECART) .addTranslator(MetadataType.STRING, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityDataTypes.COMMAND_BLOCK_NAME, entityMetadata.getValue())) .addTranslator(MetadataType.CHAT, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityDataTypes.COMMAND_BLOCK_LAST_OUTPUT, MessageTranslator.convertMessage(entityMetadata.getValue()))) .build(); - FURNACE_MINECART = EntityDefinition.inherited(FurnaceMinecartEntity::new, MINECART) + FURNACE_MINECART = GeyserEntityDefinition.inherited(FurnaceMinecartEntity::new, MINECART) .type(EntityType.FURNACE_MINECART) .identifier("minecraft:minecart") .addTranslator(MetadataType.BOOLEAN, FurnaceMinecartEntity::setHasFuel) .build(); - HOPPER_MINECART = EntityDefinition.inherited(MINECART.factory(), MINECART) + HOPPER_MINECART = GeyserEntityDefinition.inherited(MINECART.factory(), MINECART) .type(EntityType.HOPPER_MINECART) .build(); - SPAWNER_MINECART = EntityDefinition.inherited(SpawnerMinecartEntity::new, MINECART) + SPAWNER_MINECART = GeyserEntityDefinition.inherited(SpawnerMinecartEntity::new, MINECART) .type(EntityType.SPAWNER_MINECART) .identifier("minecraft:minecart") .build(); - TNT_MINECART = EntityDefinition.inherited(MINECART.factory(), MINECART) + TNT_MINECART = GeyserEntityDefinition.inherited(MINECART.factory(), MINECART) .type(EntityType.TNT_MINECART) .build(); - WITHER_SKULL = EntityDefinition.inherited(WitherSkullEntity::new, entityBase) + WITHER_SKULL = GeyserEntityDefinition.inherited(WitherSkullEntity::new, entityBase) .type(EntityType.WITHER_SKULL) .heightAndWidth(0.3125f) .addTranslator(MetadataType.BOOLEAN, WitherSkullEntity::setDangerous) .build(); - WITHER_SKULL_DANGEROUS = EntityDefinition.inherited(WITHER_SKULL.factory(), WITHER_SKULL) + WITHER_SKULL_DANGEROUS = GeyserEntityDefinition.inherited(WITHER_SKULL.factory(), WITHER_SKULL) .build(false); } - EntityDefinition livingEntityBase = EntityDefinition.inherited(LivingEntity::new, entityBase) + GeyserEntityDefinition livingEntityBase = GeyserEntityDefinition.inherited(LivingEntity::new, entityBase) .addTranslator(MetadataType.BYTE, LivingEntity::setLivingEntityFlags) .addTranslator(MetadataType.FLOAT, LivingEntity::setHealth) .addTranslator(MetadataType.INT, @@ -445,7 +445,7 @@ public final class EntityDefinitions { .addTranslator(MetadataType.OPTIONAL_POSITION, LivingEntity::setBedPosition) .build(); - ARMOR_STAND = EntityDefinition.inherited(ArmorStandEntity::new, livingEntityBase) + ARMOR_STAND = GeyserEntityDefinition.inherited(ArmorStandEntity::new, livingEntityBase) .type(EntityType.ARMOR_STAND) .height(1.975f).width(0.5f) .addTranslator(MetadataType.BYTE, ArmorStandEntity::setArmorStandFlags) @@ -456,7 +456,7 @@ public final class EntityDefinitions { .addTranslator(MetadataType.ROTATION, ArmorStandEntity::setLeftLegRotation) .addTranslator(MetadataType.ROTATION, ArmorStandEntity::setRightLegRotation) .build(); - PLAYER = EntityDefinition.inherited(null, livingEntityBase) + PLAYER = GeyserEntityDefinition.inherited(null, livingEntityBase) .type(EntityType.PLAYER) .height(1.8f).width(0.6f) .offset(1.62f) @@ -468,29 +468,29 @@ public final class EntityDefinitions { .addTranslator(MetadataType.NBT_TAG, PlayerEntity::setRightParrot) .build(); - EntityDefinition mobEntityBase = EntityDefinition.inherited(MobEntity::new, livingEntityBase) + GeyserEntityDefinition mobEntityBase = GeyserEntityDefinition.inherited(MobEntity::new, livingEntityBase) .addTranslator(MetadataType.BYTE, MobEntity::setMobFlags) .build(); // Extends mob { - ALLAY = EntityDefinition.inherited(AllayEntity::new, mobEntityBase) + ALLAY = GeyserEntityDefinition.inherited(AllayEntity::new, mobEntityBase) .type(EntityType.ALLAY) .height(0.6f).width(0.35f) .addTranslator(MetadataType.BOOLEAN, AllayEntity::setDancing) .addTranslator(MetadataType.BOOLEAN, AllayEntity::setCanDuplicate) .build(); - BAT = EntityDefinition.inherited(BatEntity::new, mobEntityBase) + BAT = GeyserEntityDefinition.inherited(BatEntity::new, mobEntityBase) .type(EntityType.BAT) .height(0.9f).width(0.5f) .addTranslator(MetadataType.BYTE, BatEntity::setBatFlags) .build(); - BLAZE = EntityDefinition.inherited(BlazeEntity::new, mobEntityBase) + BLAZE = GeyserEntityDefinition.inherited(BlazeEntity::new, mobEntityBase) .type(EntityType.BLAZE) .height(1.8f).width(0.6f) .addTranslator(MetadataType.BYTE, BlazeEntity::setBlazeFlags) .build(); - CREEPER = EntityDefinition.inherited(CreeperEntity::new, mobEntityBase) + CREEPER = GeyserEntityDefinition.inherited(CreeperEntity::new, mobEntityBase) .type(EntityType.CREEPER) .height(1.7f).width(0.6f) .offset(1.62f) @@ -498,7 +498,7 @@ public final class EntityDefinitions { .addTranslator(MetadataType.BOOLEAN, (entity, entityMetadata) -> entity.setFlag(EntityFlag.POWERED, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) .addTranslator(MetadataType.BOOLEAN, CreeperEntity::setIgnited) .build(); - DOLPHIN = EntityDefinition.inherited(DolphinEntity::new, mobEntityBase) + DOLPHIN = GeyserEntityDefinition.inherited(DolphinEntity::new, mobEntityBase) .type(EntityType.DOLPHIN) .height(0.6f).width(0.9f) //TODO check @@ -506,95 +506,95 @@ public final class EntityDefinitions { .addTranslator(null) // "got fish" .addTranslator(null) // "moistness level" .build(); - ENDERMAN = EntityDefinition.inherited(EndermanEntity::new, mobEntityBase) + ENDERMAN = GeyserEntityDefinition.inherited(EndermanEntity::new, mobEntityBase) .type(EntityType.ENDERMAN) .height(2.9f).width(0.6f) .addTranslator(MetadataType.OPTIONAL_BLOCK_STATE, EndermanEntity::setCarriedBlock) .addTranslator(MetadataType.BOOLEAN, EndermanEntity::setScreaming) .addTranslator(MetadataType.BOOLEAN, EndermanEntity::setAngry) .build(); - ENDERMITE = EntityDefinition.inherited(MonsterEntity::new, mobEntityBase) + ENDERMITE = GeyserEntityDefinition.inherited(MonsterEntity::new, mobEntityBase) .type(EntityType.ENDERMITE) .height(0.3f).width(0.4f) .build(); - ENDER_DRAGON = EntityDefinition.inherited(EnderDragonEntity::new, mobEntityBase) + ENDER_DRAGON = GeyserEntityDefinition.inherited(EnderDragonEntity::new, mobEntityBase) .type(EntityType.ENDER_DRAGON) .addTranslator(MetadataType.INT, EnderDragonEntity::setPhase) .build(); - GHAST = EntityDefinition.inherited(GhastEntity::new, mobEntityBase) + GHAST = GeyserEntityDefinition.inherited(GhastEntity::new, mobEntityBase) .type(EntityType.GHAST) .heightAndWidth(4.0f) .addTranslator(MetadataType.BOOLEAN, GhastEntity::setGhastAttacking) .build(); - GIANT = EntityDefinition.inherited(GiantEntity::new, mobEntityBase) + GIANT = GeyserEntityDefinition.inherited(GiantEntity::new, mobEntityBase) .type(EntityType.GIANT) .height(1.8f).width(1.6f) .offset(1.62f) .identifier("minecraft:zombie") .build(); - IRON_GOLEM = EntityDefinition.inherited(IronGolemEntity::new, mobEntityBase) + IRON_GOLEM = GeyserEntityDefinition.inherited(IronGolemEntity::new, mobEntityBase) .type(EntityType.IRON_GOLEM) .height(2.7f).width(1.4f) .addTranslator(null) // "is player created", which doesn't seem to do anything clientside .build(); - PHANTOM = EntityDefinition.inherited(PhantomEntity::new, mobEntityBase) + PHANTOM = GeyserEntityDefinition.inherited(PhantomEntity::new, mobEntityBase) .type(EntityType.PHANTOM) .height(0.5f).width(0.9f) .offset(0.6f) .addTranslator(MetadataType.INT, PhantomEntity::setPhantomScale) .build(); - SILVERFISH = EntityDefinition.inherited(MonsterEntity::new, mobEntityBase) + SILVERFISH = GeyserEntityDefinition.inherited(MonsterEntity::new, mobEntityBase) .type(EntityType.SILVERFISH) .height(0.3f).width(0.4f) .build(); - SHULKER = EntityDefinition.inherited(ShulkerEntity::new, mobEntityBase) + SHULKER = GeyserEntityDefinition.inherited(ShulkerEntity::new, mobEntityBase) .type(EntityType.SHULKER) .heightAndWidth(1f) .addTranslator(MetadataType.DIRECTION, ShulkerEntity::setAttachedFace) .addTranslator(MetadataType.BYTE, ShulkerEntity::setShulkerHeight) .addTranslator(MetadataType.BYTE, ShulkerEntity::setShulkerColor) .build(); - SKELETON = EntityDefinition.inherited(SkeletonEntity::new, mobEntityBase) + SKELETON = GeyserEntityDefinition.inherited(SkeletonEntity::new, mobEntityBase) .type(EntityType.SKELETON) .height(1.8f).width(0.6f) .offset(1.62f) .addTranslator(MetadataType.BOOLEAN, SkeletonEntity::setConvertingToStray) .build(); - SNOW_GOLEM = EntityDefinition.inherited(SnowGolemEntity::new, mobEntityBase) + SNOW_GOLEM = GeyserEntityDefinition.inherited(SnowGolemEntity::new, mobEntityBase) .type(EntityType.SNOW_GOLEM) .height(1.9f).width(0.7f) .addTranslator(MetadataType.BYTE, SnowGolemEntity::setSnowGolemFlags) .build(); - SPIDER = EntityDefinition.inherited(SpiderEntity::new, mobEntityBase) + SPIDER = GeyserEntityDefinition.inherited(SpiderEntity::new, mobEntityBase) .type(EntityType.SPIDER) .height(0.9f).width(1.4f) .offset(1f) .addTranslator(MetadataType.BYTE, SpiderEntity::setSpiderFlags) .build(); - CAVE_SPIDER = EntityDefinition.inherited(SpiderEntity::new, SPIDER) + CAVE_SPIDER = GeyserEntityDefinition.inherited(SpiderEntity::new, SPIDER) .type(EntityType.CAVE_SPIDER) .height(0.5f).width(0.7f) .build(); - SQUID = EntityDefinition.inherited(SquidEntity::new, mobEntityBase) + SQUID = GeyserEntityDefinition.inherited(SquidEntity::new, mobEntityBase) .type(EntityType.SQUID) .heightAndWidth(0.8f) .build(); - STRAY = EntityDefinition.inherited(AbstractSkeletonEntity::new, mobEntityBase) + STRAY = GeyserEntityDefinition.inherited(AbstractSkeletonEntity::new, mobEntityBase) .type(EntityType.STRAY) .height(1.8f).width(0.6f) .offset(1.62f) .build(); - VEX = EntityDefinition.inherited(VexEntity::new, mobEntityBase) + VEX = GeyserEntityDefinition.inherited(VexEntity::new, mobEntityBase) .type(EntityType.VEX) .height(0.8f).width(0.4f) .addTranslator(MetadataType.BYTE, VexEntity::setVexFlags) .build(); - WARDEN = EntityDefinition.inherited(WardenEntity::new, mobEntityBase) + WARDEN = GeyserEntityDefinition.inherited(WardenEntity::new, mobEntityBase) .type(EntityType.WARDEN) .height(2.9f).width(0.9f) .addTranslator(MetadataType.INT, WardenEntity::setAngerLevel) .build(); - WITHER = EntityDefinition.inherited(WitherEntity::new, mobEntityBase) + WITHER = GeyserEntityDefinition.inherited(WitherEntity::new, mobEntityBase) .type(EntityType.WITHER) .height(3.5f).width(0.9f) .addTranslator(MetadataType.INT, WitherEntity::setTarget1) @@ -602,16 +602,16 @@ public final class EntityDefinitions { .addTranslator(MetadataType.INT, WitherEntity::setTarget3) .addTranslator(MetadataType.INT, WitherEntity::setInvulnerableTicks) .build(); - WITHER_SKELETON = EntityDefinition.inherited(AbstractSkeletonEntity::new, mobEntityBase) + WITHER_SKELETON = GeyserEntityDefinition.inherited(AbstractSkeletonEntity::new, mobEntityBase) .type(EntityType.WITHER_SKELETON) .height(2.4f).width(0.7f) .build(); - ZOGLIN = EntityDefinition.inherited(ZoglinEntity::new, mobEntityBase) + ZOGLIN = GeyserEntityDefinition.inherited(ZoglinEntity::new, mobEntityBase) .type(EntityType.ZOGLIN) .height(1.4f).width(1.3965f) .addTranslator(MetadataType.BOOLEAN, ZoglinEntity::setBaby) .build(); - ZOMBIE = EntityDefinition.inherited(ZombieEntity::new, mobEntityBase) + ZOMBIE = GeyserEntityDefinition.inherited(ZombieEntity::new, mobEntityBase) .type(EntityType.ZOMBIE) .height(1.8f).width(0.6f) .offset(1.62f) @@ -619,7 +619,7 @@ public final class EntityDefinitions { .addTranslator(null) // "set special type", doesn't do anything .addTranslator(MetadataType.BOOLEAN, ZombieEntity::setConvertingToDrowned) .build(); - ZOMBIE_VILLAGER = EntityDefinition.inherited(ZombieVillagerEntity::new, ZOMBIE) + ZOMBIE_VILLAGER = GeyserEntityDefinition.inherited(ZombieVillagerEntity::new, ZOMBIE) .type(EntityType.ZOMBIE_VILLAGER) .height(1.8f).width(0.6f) .offset(1.62f) @@ -627,120 +627,120 @@ public final class EntityDefinitions { .addTranslator(MetadataType.BOOLEAN, ZombieVillagerEntity::setTransforming) .addTranslator(MetadataType.VILLAGER_DATA, ZombieVillagerEntity::setZombieVillagerData) .build(); - ZOMBIFIED_PIGLIN = EntityDefinition.inherited(ZombifiedPiglinEntity::new, ZOMBIE) //TODO test how zombie entity metadata is handled? + ZOMBIFIED_PIGLIN = GeyserEntityDefinition.inherited(ZombifiedPiglinEntity::new, ZOMBIE) //TODO test how zombie entity metadata is handled? .type(EntityType.ZOMBIFIED_PIGLIN) .height(1.95f).width(0.6f) .offset(1.62f) .identifier("minecraft:zombie_pigman") .build(); - DROWNED = EntityDefinition.inherited(ZOMBIE.factory(), ZOMBIE) + DROWNED = GeyserEntityDefinition.inherited(ZOMBIE.factory(), ZOMBIE) .type(EntityType.DROWNED) .height(1.95f).width(0.6f) .build(); - HUSK = EntityDefinition.inherited(ZOMBIE.factory(), ZOMBIE) + HUSK = GeyserEntityDefinition.inherited(ZOMBIE.factory(), ZOMBIE) .type(EntityType.HUSK) .build(); - GUARDIAN = EntityDefinition.inherited(GuardianEntity::new, mobEntityBase) + GUARDIAN = GeyserEntityDefinition.inherited(GuardianEntity::new, mobEntityBase) .type(EntityType.GUARDIAN) .heightAndWidth(0.85f) .addTranslator(null) // Moving //TODO .addTranslator(MetadataType.INT, GuardianEntity::setGuardianTarget) .build(); - ELDER_GUARDIAN = EntityDefinition.inherited(ElderGuardianEntity::new, GUARDIAN) + ELDER_GUARDIAN = GeyserEntityDefinition.inherited(ElderGuardianEntity::new, GUARDIAN) .type(EntityType.ELDER_GUARDIAN) .heightAndWidth(1.9975f) .build(); - SLIME = EntityDefinition.inherited(SlimeEntity::new, mobEntityBase) + SLIME = GeyserEntityDefinition.inherited(SlimeEntity::new, mobEntityBase) .type(EntityType.SLIME) .heightAndWidth(0.51f) .addTranslator(MetadataType.INT, SlimeEntity::setScale) .build(); - MAGMA_CUBE = EntityDefinition.inherited(MagmaCubeEntity::new, SLIME) + MAGMA_CUBE = GeyserEntityDefinition.inherited(MagmaCubeEntity::new, SLIME) .type(EntityType.MAGMA_CUBE) .build(); - EntityDefinition abstractFishEntityBase = EntityDefinition.inherited(AbstractFishEntity::new, mobEntityBase) + GeyserEntityDefinition abstractFishEntityBase = GeyserEntityDefinition.inherited(AbstractFishEntity::new, mobEntityBase) .addTranslator(null) // From bucket .build(); - COD = EntityDefinition.inherited(abstractFishEntityBase.factory(), abstractFishEntityBase) + COD = GeyserEntityDefinition.inherited(abstractFishEntityBase.factory(), abstractFishEntityBase) .type(EntityType.COD) .height(0.25f).width(0.5f) .build(); - PUFFERFISH = EntityDefinition.inherited(PufferFishEntity::new, abstractFishEntityBase) + PUFFERFISH = GeyserEntityDefinition.inherited(PufferFishEntity::new, abstractFishEntityBase) .type(EntityType.PUFFERFISH) .heightAndWidth(0.7f) .addTranslator(MetadataType.INT, PufferFishEntity::setPufferfishSize) .build(); - SALMON = EntityDefinition.inherited(abstractFishEntityBase.factory(), abstractFishEntityBase) + SALMON = GeyserEntityDefinition.inherited(abstractFishEntityBase.factory(), abstractFishEntityBase) .type(EntityType.SALMON) .height(0.5f).width(0.7f) .build(); - TADPOLE = EntityDefinition.inherited(TadpoleEntity::new, abstractFishEntityBase) + TADPOLE = GeyserEntityDefinition.inherited(TadpoleEntity::new, abstractFishEntityBase) .type(EntityType.TADPOLE) .height(0.3f).width(0.4f) .build(); - TROPICAL_FISH = EntityDefinition.inherited(TropicalFishEntity::new, abstractFishEntityBase) + TROPICAL_FISH = GeyserEntityDefinition.inherited(TropicalFishEntity::new, abstractFishEntityBase) .type(EntityType.TROPICAL_FISH) .heightAndWidth(0.6f) .identifier("minecraft:tropicalfish") .addTranslator(MetadataType.INT, TropicalFishEntity::setFishVariant) .build(); - EntityDefinition abstractPiglinEntityBase = EntityDefinition.inherited(BasePiglinEntity::new, mobEntityBase) + GeyserEntityDefinition abstractPiglinEntityBase = GeyserEntityDefinition.inherited(BasePiglinEntity::new, mobEntityBase) .addTranslator(MetadataType.BOOLEAN, BasePiglinEntity::setImmuneToZombification) .build(); - PIGLIN = EntityDefinition.inherited(PiglinEntity::new, abstractPiglinEntityBase) + PIGLIN = GeyserEntityDefinition.inherited(PiglinEntity::new, abstractPiglinEntityBase) .type(EntityType.PIGLIN) .height(1.95f).width(0.6f) .addTranslator(MetadataType.BOOLEAN, PiglinEntity::setBaby) .addTranslator(MetadataType.BOOLEAN, PiglinEntity::setChargingCrossbow) .addTranslator(MetadataType.BOOLEAN, PiglinEntity::setDancing) .build(); - PIGLIN_BRUTE = EntityDefinition.inherited(abstractPiglinEntityBase.factory(), abstractPiglinEntityBase) + PIGLIN_BRUTE = GeyserEntityDefinition.inherited(abstractPiglinEntityBase.factory(), abstractPiglinEntityBase) .type(EntityType.PIGLIN_BRUTE) .height(1.95f).width(0.6f) .build(); - GLOW_SQUID = EntityDefinition.inherited(GlowSquidEntity::new, SQUID) + GLOW_SQUID = GeyserEntityDefinition.inherited(GlowSquidEntity::new, SQUID) .type(EntityType.GLOW_SQUID) .addTranslator(null) // Set dark ticks remaining, possible TODO .build(); - EntityDefinition raidParticipantEntityBase = EntityDefinition.inherited(RaidParticipantEntity::new, mobEntityBase) + GeyserEntityDefinition raidParticipantEntityBase = GeyserEntityDefinition.inherited(RaidParticipantEntity::new, mobEntityBase) .addTranslator(null) // Celebrating //TODO .build(); - EntityDefinition spellcasterEntityBase = EntityDefinition.inherited(SpellcasterIllagerEntity::new, raidParticipantEntityBase) + GeyserEntityDefinition spellcasterEntityBase = GeyserEntityDefinition.inherited(SpellcasterIllagerEntity::new, raidParticipantEntityBase) .addTranslator(MetadataType.BYTE, SpellcasterIllagerEntity::setSpellType) .build(); - EVOKER = EntityDefinition.inherited(spellcasterEntityBase.factory(), spellcasterEntityBase) + EVOKER = GeyserEntityDefinition.inherited(spellcasterEntityBase.factory(), spellcasterEntityBase) .type(EntityType.EVOKER) .height(1.95f).width(0.6f) .identifier("minecraft:evocation_illager") .build(); - ILLUSIONER = EntityDefinition.inherited(spellcasterEntityBase.factory(), spellcasterEntityBase) + ILLUSIONER = GeyserEntityDefinition.inherited(spellcasterEntityBase.factory(), spellcasterEntityBase) .type(EntityType.ILLUSIONER) .height(1.95f).width(0.6f) .identifier("minecraft:evocation_illager") .build(); - PILLAGER = EntityDefinition.inherited(PillagerEntity::new, raidParticipantEntityBase) + PILLAGER = GeyserEntityDefinition.inherited(PillagerEntity::new, raidParticipantEntityBase) .type(EntityType.PILLAGER) .height(1.8f).width(0.6f) .offset(1.62f) .addTranslator(null) // Charging; doesn't have an equivalent on Bedrock //TODO check .build(); - RAVAGER = EntityDefinition.inherited(raidParticipantEntityBase.factory(), raidParticipantEntityBase) + RAVAGER = GeyserEntityDefinition.inherited(raidParticipantEntityBase.factory(), raidParticipantEntityBase) .type(EntityType.RAVAGER) .height(1.9f).width(1.2f) .build(); - VINDICATOR = EntityDefinition.inherited(VindicatorEntity::new, raidParticipantEntityBase) + VINDICATOR = GeyserEntityDefinition.inherited(VindicatorEntity::new, raidParticipantEntityBase) .type(EntityType.VINDICATOR) .height(1.8f).width(0.6f) .offset(1.62f) .build(); - WITCH = EntityDefinition.inherited(raidParticipantEntityBase.factory(), raidParticipantEntityBase) + WITCH = GeyserEntityDefinition.inherited(raidParticipantEntityBase.factory(), raidParticipantEntityBase) .type(EntityType.WITCH) .height(1.8f).width(0.6f) .offset(1.62f) @@ -748,34 +748,34 @@ public final class EntityDefinitions { .build(); } - EntityDefinition ageableEntityBase = EntityDefinition.inherited(AgeableEntity::new, mobEntityBase) + GeyserEntityDefinition ageableEntityBase = GeyserEntityDefinition.inherited(AgeableEntity::new, mobEntityBase) .addTranslator(MetadataType.BOOLEAN, AgeableEntity::setBaby) .build(); // Extends ageable { - AXOLOTL = EntityDefinition.inherited(AxolotlEntity::new, ageableEntityBase) + AXOLOTL = GeyserEntityDefinition.inherited(AxolotlEntity::new, ageableEntityBase) .type(EntityType.AXOLOTL) .height(0.42f).width(0.7f) .addTranslator(MetadataType.INT, AxolotlEntity::setVariant) .addTranslator(MetadataType.BOOLEAN, AxolotlEntity::setPlayingDead) .addTranslator(null) // From bucket .build(); - BEE = EntityDefinition.inherited(BeeEntity::new, ageableEntityBase) + BEE = GeyserEntityDefinition.inherited(BeeEntity::new, ageableEntityBase) .type(EntityType.BEE) .heightAndWidth(0.6f) .addTranslator(MetadataType.BYTE, BeeEntity::setBeeFlags) .addTranslator(MetadataType.INT, BeeEntity::setAngerTime) .build(); - CHICKEN = EntityDefinition.inherited(ChickenEntity::new, ageableEntityBase) + CHICKEN = GeyserEntityDefinition.inherited(ChickenEntity::new, ageableEntityBase) .type(EntityType.CHICKEN) .height(0.7f).width(0.4f) .build(); - COW = EntityDefinition.inherited(CowEntity::new, ageableEntityBase) + COW = GeyserEntityDefinition.inherited(CowEntity::new, ageableEntityBase) .type(EntityType.COW) .height(1.4f).width(0.9f) .build(); - FOX = EntityDefinition.inherited(FoxEntity::new, ageableEntityBase) + FOX = GeyserEntityDefinition.inherited(FoxEntity::new, ageableEntityBase) .type(EntityType.FOX) .height(0.5f).width(1.25f) .addTranslator(MetadataType.INT, FoxEntity::setFoxVariant) @@ -783,35 +783,35 @@ public final class EntityDefinitions { .addTranslator(null) // Trusted player 1 .addTranslator(null) // Trusted player 2 .build(); - FROG = EntityDefinition.inherited(FrogEntity::new, ageableEntityBase) + FROG = GeyserEntityDefinition.inherited(FrogEntity::new, ageableEntityBase) .type(EntityType.FROG) .heightAndWidth(0.5f) .addTranslator(MetadataType.FROG_VARIANT, FrogEntity::setFrogVariant) .addTranslator(MetadataType.OPTIONAL_VARINT, FrogEntity::setTongueTarget) .build(); - HOGLIN = EntityDefinition.inherited(HoglinEntity::new, ageableEntityBase) + HOGLIN = GeyserEntityDefinition.inherited(HoglinEntity::new, ageableEntityBase) .type(EntityType.HOGLIN) .height(1.4f).width(1.3965f) .addTranslator(MetadataType.BOOLEAN, HoglinEntity::setImmuneToZombification) .build(); - GOAT = EntityDefinition.inherited(GoatEntity::new, ageableEntityBase) + GOAT = GeyserEntityDefinition.inherited(GoatEntity::new, ageableEntityBase) .type(EntityType.GOAT) .height(1.3f).width(0.9f) .addTranslator(MetadataType.BOOLEAN, GoatEntity::setScreamer) .addTranslator(MetadataType.BOOLEAN, GoatEntity::setHasLeftHorn) .addTranslator(MetadataType.BOOLEAN, GoatEntity::setHasRightHorn) .build(); - MOOSHROOM = EntityDefinition.inherited(MooshroomEntity::new, ageableEntityBase) + MOOSHROOM = GeyserEntityDefinition.inherited(MooshroomEntity::new, ageableEntityBase) .type(EntityType.MOOSHROOM) .height(1.4f).width(0.9f) .addTranslator(MetadataType.STRING, MooshroomEntity::setVariant) .build(); - OCELOT = EntityDefinition.inherited(OcelotEntity::new, ageableEntityBase) + OCELOT = GeyserEntityDefinition.inherited(OcelotEntity::new, ageableEntityBase) .type(EntityType.OCELOT) .height(0.7f).width(0.6f) .addTranslator(MetadataType.BOOLEAN, (ocelotEntity, entityMetadata) -> ocelotEntity.setFlag(EntityFlag.TRUSTING, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) .build(); - PANDA = EntityDefinition.inherited(PandaEntity::new, ageableEntityBase) + PANDA = GeyserEntityDefinition.inherited(PandaEntity::new, ageableEntityBase) .type(EntityType.PANDA) .height(1.25f).width(1.125f) .addTranslator(null) // Unhappy counter @@ -821,35 +821,35 @@ public final class EntityDefinitions { .addTranslator(MetadataType.BYTE, PandaEntity::setHiddenGene) .addTranslator(MetadataType.BYTE, PandaEntity::setPandaFlags) .build(); - PIG = EntityDefinition.inherited(PigEntity::new, ageableEntityBase) + PIG = GeyserEntityDefinition.inherited(PigEntity::new, ageableEntityBase) .type(EntityType.PIG) .heightAndWidth(0.9f) .addTranslator(MetadataType.BOOLEAN, (pigEntity, entityMetadata) -> pigEntity.setFlag(EntityFlag.SADDLED, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) .addTranslator(null) // Boost time .build(); - POLAR_BEAR = EntityDefinition.inherited(PolarBearEntity::new, ageableEntityBase) + POLAR_BEAR = GeyserEntityDefinition.inherited(PolarBearEntity::new, ageableEntityBase) .type(EntityType.POLAR_BEAR) .height(1.4f).width(1.3f) .addTranslator(MetadataType.BOOLEAN, (entity, entityMetadata) -> entity.setFlag(EntityFlag.STANDING, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) .build(); - RABBIT = EntityDefinition.inherited(RabbitEntity::new, ageableEntityBase) + RABBIT = GeyserEntityDefinition.inherited(RabbitEntity::new, ageableEntityBase) .type(EntityType.RABBIT) .height(0.5f).width(0.4f) .addTranslator(MetadataType.INT, RabbitEntity::setRabbitVariant) .build(); - SHEEP = EntityDefinition.inherited(SheepEntity::new, ageableEntityBase) + SHEEP = GeyserEntityDefinition.inherited(SheepEntity::new, ageableEntityBase) .type(EntityType.SHEEP) .height(1.3f).width(0.9f) .addTranslator(MetadataType.BYTE, SheepEntity::setSheepFlags) .build(); - STRIDER = EntityDefinition.inherited(StriderEntity::new, ageableEntityBase) + STRIDER = GeyserEntityDefinition.inherited(StriderEntity::new, ageableEntityBase) .type(EntityType.STRIDER) .height(1.7f).width(0.9f) .addTranslator(null) // Boost time .addTranslator(MetadataType.BOOLEAN, StriderEntity::setCold) .addTranslator(MetadataType.BOOLEAN, StriderEntity::setSaddled) .build(); - TURTLE = EntityDefinition.inherited(TurtleEntity::new, ageableEntityBase) + TURTLE = GeyserEntityDefinition.inherited(TurtleEntity::new, ageableEntityBase) .type(EntityType.TURTLE) .height(0.4f).width(1.2f) .addTranslator(null) // Home position @@ -860,17 +860,17 @@ public final class EntityDefinitions { .addTranslator(null) // Travelling .build(); - EntityDefinition abstractVillagerEntityBase = EntityDefinition.inherited(AbstractMerchantEntity::new, ageableEntityBase) + GeyserEntityDefinition abstractVillagerEntityBase = GeyserEntityDefinition.inherited(AbstractMerchantEntity::new, ageableEntityBase) .addTranslator(null) // Unhappy ticks .build(); - VILLAGER = EntityDefinition.inherited(VillagerEntity::new, abstractVillagerEntityBase) + VILLAGER = GeyserEntityDefinition.inherited(VillagerEntity::new, abstractVillagerEntityBase) .type(EntityType.VILLAGER) .height(1.8f).width(0.6f) .offset(1.62f) .identifier("minecraft:villager_v2") .addTranslator(MetadataType.VILLAGER_DATA, VillagerEntity::setVillagerData) .build(); - WANDERING_TRADER = EntityDefinition.inherited(abstractVillagerEntityBase.factory(), abstractVillagerEntityBase) + WANDERING_TRADER = GeyserEntityDefinition.inherited(abstractVillagerEntityBase.factory(), abstractVillagerEntityBase) .type(EntityType.WANDERING_TRADER) .height(1.8f).width(0.6f) .offset(1.62f) @@ -879,58 +879,58 @@ public final class EntityDefinitions { // Horses { - EntityDefinition abstractHorseEntityBase = EntityDefinition.inherited(AbstractHorseEntity::new, ageableEntityBase) + GeyserEntityDefinition abstractHorseEntityBase = GeyserEntityDefinition.inherited(AbstractHorseEntity::new, ageableEntityBase) .addTranslator(MetadataType.BYTE, AbstractHorseEntity::setHorseFlags) .build(); - CAMEL = EntityDefinition.inherited(CamelEntity::new, abstractHorseEntityBase) + CAMEL = GeyserEntityDefinition.inherited(CamelEntity::new, abstractHorseEntityBase) .type(EntityType.CAMEL) .identifier("minecraft:llama") // todo 1.20 .height(2.375f).width(1.7f) .addTranslator(MetadataType.BOOLEAN, CamelEntity::setDashing) .addTranslator(null) // Last pose change tick .build(); - HORSE = EntityDefinition.inherited(HorseEntity::new, abstractHorseEntityBase) + HORSE = GeyserEntityDefinition.inherited(HorseEntity::new, abstractHorseEntityBase) .type(EntityType.HORSE) .height(1.6f).width(1.3965f) .addTranslator(MetadataType.INT, HorseEntity::setHorseVariant) .build(); - SKELETON_HORSE = EntityDefinition.inherited(SkeletonHorseEntity::new, abstractHorseEntityBase) + SKELETON_HORSE = GeyserEntityDefinition.inherited(SkeletonHorseEntity::new, abstractHorseEntityBase) .type(EntityType.SKELETON_HORSE) .height(1.6f).width(1.3965f) .build(); - ZOMBIE_HORSE = EntityDefinition.inherited(ZombieHorseEntity::new, abstractHorseEntityBase) + ZOMBIE_HORSE = GeyserEntityDefinition.inherited(ZombieHorseEntity::new, abstractHorseEntityBase) .type(EntityType.ZOMBIE_HORSE) .height(1.6f).width(1.3965f) .build(); - EntityDefinition chestedHorseEntityBase = EntityDefinition.inherited(ChestedHorseEntity::new, abstractHorseEntityBase) + GeyserEntityDefinition chestedHorseEntityBase = GeyserEntityDefinition.inherited(ChestedHorseEntity::new, abstractHorseEntityBase) .addTranslator(MetadataType.BOOLEAN, (horseEntity, entityMetadata) -> horseEntity.setFlag(EntityFlag.CHESTED, ((BooleanEntityMetadata) entityMetadata).getPrimitiveValue())) .build(); - DONKEY = EntityDefinition.inherited(chestedHorseEntityBase.factory(), chestedHorseEntityBase) + DONKEY = GeyserEntityDefinition.inherited(chestedHorseEntityBase.factory(), chestedHorseEntityBase) .type(EntityType.DONKEY) .height(1.6f).width(1.3965f) .build(); - MULE = EntityDefinition.inherited(chestedHorseEntityBase.factory(), chestedHorseEntityBase) + MULE = GeyserEntityDefinition.inherited(chestedHorseEntityBase.factory(), chestedHorseEntityBase) .type(EntityType.MULE) .height(1.6f).width(1.3965f) .build(); - LLAMA = EntityDefinition.inherited(LlamaEntity::new, chestedHorseEntityBase) + LLAMA = GeyserEntityDefinition.inherited(LlamaEntity::new, chestedHorseEntityBase) .type(EntityType.LLAMA) .height(1.87f).width(0.9f) .addTranslator(MetadataType.INT, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityDataTypes.STRENGTH, entityMetadata.getValue())) .addTranslator(MetadataType.INT, LlamaEntity::setCarpetedColor) .addTranslator(MetadataType.INT, (entity, entityMetadata) -> entity.getDirtyMetadata().put(EntityDataTypes.VARIANT, entityMetadata.getValue())) .build(); - TRADER_LLAMA = EntityDefinition.inherited(TraderLlamaEntity::new, LLAMA) + TRADER_LLAMA = GeyserEntityDefinition.inherited(TraderLlamaEntity::new, LLAMA) .type(EntityType.TRADER_LLAMA) .identifier("minecraft:llama") .build(); } - EntityDefinition tameableEntityBase = EntityDefinition.inherited(TameableEntity::new, ageableEntityBase) + GeyserEntityDefinition tameableEntityBase = GeyserEntityDefinition.inherited(TameableEntity::new, ageableEntityBase) .addTranslator(MetadataType.BYTE, TameableEntity::setTameableFlags) .addTranslator(MetadataType.OPTIONAL_UUID, TameableEntity::setOwner) .build(); - CAT = EntityDefinition.inherited(CatEntity::new, tameableEntityBase) + CAT = GeyserEntityDefinition.inherited(CatEntity::new, tameableEntityBase) .type(EntityType.CAT) .height(0.35f).width(0.3f) .addTranslator(MetadataType.CAT_VARIANT, CatEntity::setCatVariant) @@ -938,12 +938,12 @@ public final class EntityDefinitions { .addTranslator(null) // "resting state one" //TODO .addTranslator(MetadataType.INT, CatEntity::setCollarColor) .build(); - PARROT = EntityDefinition.inherited(ParrotEntity::new, tameableEntityBase) + PARROT = GeyserEntityDefinition.inherited(ParrotEntity::new, tameableEntityBase) .type(EntityType.PARROT) .height(0.9f).width(0.5f) .addTranslator(MetadataType.INT, (parrotEntity, entityMetadata) -> parrotEntity.getDirtyMetadata().put(EntityDataTypes.VARIANT, entityMetadata.getValue())) // Parrot color .build(); - WOLF = EntityDefinition.inherited(WolfEntity::new, tameableEntityBase) + WOLF = GeyserEntityDefinition.inherited(WolfEntity::new, tameableEntityBase) .type(EntityType.WOLF) .height(0.85f).width(0.6f) // "Begging" on wiki.vg, "Interested" in Nukkit - the tilt of the head @@ -953,11 +953,11 @@ public final class EntityDefinitions { .build(); // As of 1.18 these don't track entity data at all - ENDER_DRAGON_PART = EntityDefinition.builder(null) + ENDER_DRAGON_PART = GeyserEntityDefinition.builder(null) .identifier("minecraft:armor_stand") // Emulated .build(false); // Never sent over the network - Registries.JAVA_ENTITY_IDENTIFIERS.get().put("minecraft:marker", null); // We don't need an entity definition for this as it is never sent over the network + Registries.ENTITY_IDENTIFIERS.get().put("minecraft:marker", null); // We don't need an entity definition for this as it is never sent over the network } public static void init() { diff --git a/core/src/main/java/org/geysermc/geyser/entity/EntityDefinition.java b/core/src/main/java/org/geysermc/geyser/entity/GeyserEntityDefinition.java similarity index 51% rename from core/src/main/java/org/geysermc/geyser/entity/EntityDefinition.java rename to core/src/main/java/org/geysermc/geyser/entity/GeyserEntityDefinition.java index 566b3daff..0529116a7 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/EntityDefinition.java +++ b/core/src/main/java/org/geysermc/geyser/entity/GeyserEntityDefinition.java @@ -31,14 +31,21 @@ import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import lombok.Setter; import lombok.experimental.Accessors; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtType; import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.api.entity.EntityDefinition; +import org.geysermc.geyser.api.entity.EntityIdentifier; import org.geysermc.geyser.entity.factory.EntityFactory; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.registry.Registries; import org.geysermc.geyser.translator.entity.EntityMetadataTranslator; +import org.geysermc.geyser.util.EntityUtils; +import java.util.ArrayList; import java.util.List; import java.util.Locale; +import java.util.Optional; import java.util.function.BiConsumer; /** @@ -48,15 +55,15 @@ import java.util.function.BiConsumer; * * @param the entity type this definition represents */ -public record EntityDefinition(EntityFactory factory, EntityType entityType, String identifier, - float width, float height, float offset, List> translators) { +public record GeyserEntityDefinition(EntityFactory factory, EntityType entityType, EntityIdentifier entityIdentifier, + float width, float height, float offset, List> translators, boolean custom) implements EntityDefinition { - public static Builder inherited(EntityFactory factory, EntityDefinition parent) { - return new Builder<>(factory, parent.entityType, parent.identifier, parent.width, parent.height, parent.offset, new ObjectArrayList<>(parent.translators)); + public static EntityDefinitionBuilder inherited(EntityFactory factory, GeyserEntityDefinition parent) { + return new EntityDefinitionBuilder<>(factory, parent.entityType, parent.entityIdentifier, parent.width, parent.height, parent.offset, new ObjectArrayList<>(parent.translators)); } - public static Builder builder(EntityFactory factory) { - return new Builder<>(factory); + public static EntityDefinitionBuilder builder(EntityFactory factory) { + return new EntityDefinitionBuilder<>(factory); } public void translateMetadata(T entity, EntityMetadata> metadata) { @@ -77,23 +84,52 @@ public record EntityDefinition(EntityFactory factory, Entit translator.translate(entity, metadata); } + public String identifier() { + return this.entityIdentifier.identifier(); + } + + public boolean isRegistered() { + return Registries.ENTITY_DEFINITIONS.get().containsValue(this); + } + + public EntityDefinitionBuilder toBuilder() { + return new EntityDefinitionBuilder<>(this); + } + @Setter @Accessors(fluent = true, chain = true) - public static class Builder { + public static class EntityDefinitionBuilder implements EntityDefinition.Builder { private final EntityFactory factory; private EntityType type; - private String identifier; + private EntityIdentifier identifier; private float width; private float height; private float offset = 0.00001f; private final List> translators; + private final boolean custom; - private Builder(EntityFactory factory) { - this.factory = factory; - translators = new ObjectArrayList<>(); + private EntityDefinitionBuilder(GeyserEntityDefinition definition) { + this.factory = definition.factory; + this.type = definition.entityType; + this.identifier = definition.entityIdentifier; + this.width = definition.width; + this.height = definition.height; + this.offset = definition.offset; + this.translators = new ArrayList<>(definition.translators); + this.custom = definition.custom; } - public Builder(EntityFactory factory, EntityType type, String identifier, float width, float height, float offset, List> translators) { + private EntityDefinitionBuilder(EntityFactory factory) { + this(factory, false); + } + + public EntityDefinitionBuilder(EntityFactory factory, boolean custom) { + this.factory = factory; + this.translators = new ObjectArrayList<>(); + this.custom = custom; + } + + public EntityDefinitionBuilder(EntityFactory factory, EntityType type, EntityIdentifier identifier, float width, float height, float offset, List> translators) { this.factory = factory; this.type = type; this.identifier = identifier; @@ -101,18 +137,46 @@ public record EntityDefinition(EntityFactory factory, Entit this.height = height; this.offset = offset; this.translators = translators; + this.custom = false; + } + + @Override + public EntityDefinitionBuilder identifier(EntityIdentifier identifier) { + this.identifier = identifier; + return this; + } + + public EntityDefinitionBuilder identifier(String identifier) { + NbtMap nbt = Registries.BEDROCK_ENTITY_IDENTIFIERS.get(); + List idlist = nbt.getList("idlist", NbtType.COMPOUND); + Optional entityIdentifier = idlist.stream().filter(tag -> tag.getString("id").equals(identifier)).findFirst(); + + // Create a fake entity identifier for entities which are + // in Java but may not be in Bedrock (e.g. item frames). + if (entityIdentifier.isEmpty()) { + this.identifier = new GeyserEntityIdentifier(NbtMap.builder() + .putString("id", identifier) + .putBoolean("hasspawnegg", false) + .putBoolean("summonable", false) + .build()); + + return this; + } + + this.identifier = new GeyserEntityIdentifier(entityIdentifier.get()); + return this; } /** * Sets the height and width as one value */ - public Builder heightAndWidth(float value) { + public EntityDefinitionBuilder heightAndWidth(float value) { height = value; width = value; return this; } - public Builder offset(float offset) { + public EntityDefinitionBuilder offset(float offset) { this.offset = offset + 0.00001f; return this; } @@ -120,23 +184,23 @@ public record EntityDefinition(EntityFactory factory, Entit /** * Resets the identifier as well */ - public Builder type(EntityType type) { + public EntityDefinitionBuilder type(EntityType type) { this.type = type; identifier = null; return this; } - public >> Builder addTranslator(MetadataType type, BiConsumer translateFunction) { + public >> EntityDefinitionBuilder addTranslator(MetadataType type, BiConsumer translateFunction) { translators.add(new EntityMetadataTranslator<>(type, translateFunction)); return this; } - public Builder addTranslator(EntityMetadataTranslator translator) { + public EntityDefinitionBuilder addTranslator(EntityMetadataTranslator translator) { translators.add(translator); return this; } - public EntityDefinition build() { + public GeyserEntityDefinition build() { return build(true); } @@ -144,15 +208,20 @@ public record EntityDefinition(EntityFactory factory, Entit * @param register whether to register this entity in the Registries for entity types. Generally this should be * set to false if we're not expecting this entity to spawn from the network. */ - public EntityDefinition build(boolean register) { - if (identifier == null && type != null) { + public GeyserEntityDefinition build(boolean register) { + String identifier = null; + if (this.identifier == null && type != null) { identifier = "minecraft:" + type.name().toLowerCase(Locale.ROOT); + this.identifier(identifier); + } else if (this.identifier != null && type == null) { + identifier = this.identifier.identifier(); } - EntityDefinition definition = new EntityDefinition<>(factory, type, identifier, width, height, offset, translators); - if (register && definition.entityType() != null) { - Registries.ENTITY_DEFINITIONS.get().putIfAbsent(definition.entityType(), definition); - Registries.JAVA_ENTITY_IDENTIFIERS.get().putIfAbsent("minecraft:" + type.name().toLowerCase(Locale.ROOT), definition); + + GeyserEntityDefinition definition = new GeyserEntityDefinition<>(factory, type, this.identifier, width, height, offset, translators, custom); + if (register && identifier != null) { + EntityUtils.registerEntity(identifier, definition); } + return definition; } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/GeyserEntityIdentifier.java b/core/src/main/java/org/geysermc/geyser/entity/GeyserEntityIdentifier.java new file mode 100644 index 000000000..56172bc96 --- /dev/null +++ b/core/src/main/java/org/geysermc/geyser/entity/GeyserEntityIdentifier.java @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2019-2023 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.entity; + +import org.checkerframework.checker.nullness.qual.NonNull; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMapBuilder; +import org.geysermc.geyser.api.entity.EntityIdentifier; + +import java.util.concurrent.atomic.AtomicInteger; + +public record GeyserEntityIdentifier(NbtMap nbt) implements EntityIdentifier { + private static final AtomicInteger RUNTIME_ID_ALLOCATOR = new AtomicInteger(100000); + + @Override + public boolean hasSpawnEgg() { + return this.nbt.getBoolean("hasspawnegg"); + } + + @NonNull + @Override + public String identifier() { + return this.nbt.getString("id"); + } + + @Override + public boolean isSummonable() { + return this.nbt.getBoolean("summonable"); + } + + public static class EntityIdentifierBuilder implements EntityIdentifier.Builder { + private final NbtMapBuilder nbt = NbtMap.builder(); + + @Override + public Builder spawnEgg(boolean spawnEgg) { + this.nbt.putBoolean("hasspawnegg", spawnEgg); + return this; + } + + @Override + public Builder identifier(String identifier) { + this.nbt.putString("id", identifier); + return this; + } + + @Override + public Builder summonable(boolean summonable) { + this.nbt.putBoolean("summonable", summonable); + return this; + } + + @Override + public EntityIdentifier build() { + // Vanilla registry information + this.nbt.putString("bid", ""); + this.nbt.putInt("rid", RUNTIME_ID_ALLOCATOR.getAndIncrement()); + this.nbt.putBoolean("experimental", false); + + return new GeyserEntityIdentifier(this.nbt.build()); + } + } +} \ No newline at end of file diff --git a/core/src/main/java/org/geysermc/geyser/entity/factory/EntityFactory.java b/core/src/main/java/org/geysermc/geyser/entity/factory/EntityFactory.java index 7675ea8fd..fec4804cd 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/factory/EntityFactory.java +++ b/core/src/main/java/org/geysermc/geyser/entity/factory/EntityFactory.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.entity.factory; import org.cloudburstmc.math.vector.Vector3f; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.session.GeyserSession; @@ -37,5 +37,5 @@ import java.util.UUID; */ public interface EntityFactory { - T create(GeyserSession session, int javaId, long bedrockId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw); + T create(GeyserSession session, int javaId, long bedrockId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/AbstractArrowEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/AbstractArrowEntity.java index 6828d1020..e48d89a16 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/AbstractArrowEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/AbstractArrowEntity.java @@ -29,14 +29,14 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEnti import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class AbstractArrowEntity extends Entity { - public AbstractArrowEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AbstractArrowEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); // Set the correct texture if using the resource pack diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/AreaEffectCloudEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/AreaEffectCloudEntity.java index fcd4f2160..fae2e434b 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/AreaEffectCloudEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/AreaEffectCloudEntity.java @@ -32,16 +32,15 @@ import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.ParticleType; 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.GeyserEntityDefinition; import org.geysermc.geyser.registry.Registries; -import org.geysermc.geyser.registry.type.ParticleMapping; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class AreaEffectCloudEntity extends Entity { - public AreaEffectCloudEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AreaEffectCloudEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/BoatEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/BoatEntity.java index 1bf6e581e..8909ebc67 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/BoatEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/BoatEntity.java @@ -33,7 +33,7 @@ import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; import org.cloudburstmc.protocol.bedrock.packet.AnimatePacket; import org.cloudburstmc.protocol.bedrock.packet.MoveEntityAbsolutePacket; import lombok.Getter; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.util.InteractionResult; @@ -68,7 +68,7 @@ public class BoatEntity extends Entity { // Looks too fast and too choppy with 0.1f, which is how I believe the Microsoftian client handles it private final float ROWING_SPEED = 0.05f; - public BoatEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public BoatEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { // Initial rotation is incorrect super(session, entityId, geyserId, uuid, definition, position.add(0d, definition.offset(), 0d), motion, yaw + 90, 0, yaw + 90); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ChestBoatEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ChestBoatEntity.java index 675e9517d..df86f8cee 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ChestBoatEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ChestBoatEntity.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import org.cloudburstmc.math.vector.Vector3f; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.util.InteractionResult; import org.geysermc.geyser.util.InteractiveTag; @@ -35,7 +35,7 @@ import org.geysermc.geyser.util.InteractiveTag; import java.util.UUID; public class ChestBoatEntity extends BoatEntity { - public ChestBoatEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ChestBoatEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/CommandBlockMinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/CommandBlockMinecartEntity.java index 9c7a28f6e..1b56ef106 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/CommandBlockMinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/CommandBlockMinecartEntity.java @@ -31,7 +31,7 @@ import org.cloudburstmc.math.vector.Vector3i; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; import org.cloudburstmc.protocol.bedrock.data.inventory.ContainerType; import org.cloudburstmc.protocol.bedrock.packet.ContainerOpenPacket; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.util.InteractionResult; import org.geysermc.geyser.util.InteractiveTag; @@ -40,7 +40,7 @@ import java.util.UUID; public class CommandBlockMinecartEntity extends DefaultBlockMinecartEntity { - public CommandBlockMinecartEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public CommandBlockMinecartEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/DefaultBlockMinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/DefaultBlockMinecartEntity.java index 63b5ff2ab..2d647fc20 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/DefaultBlockMinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/DefaultBlockMinecartEntity.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanE import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; @@ -43,7 +43,7 @@ public class DefaultBlockMinecartEntity extends MinecartEntity { public int customBlockOffset = 0; public boolean showCustomBlock = false; - public DefaultBlockMinecartEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public DefaultBlockMinecartEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); dirtyMetadata.put(EntityDataTypes.CUSTOM_DISPLAY, (byte) 1); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/EnderCrystalEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/EnderCrystalEntity.java index 86436f82b..716c6f6cf 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/EnderCrystalEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/EnderCrystalEntity.java @@ -30,7 +30,7 @@ import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.math.vector.Vector3i; 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.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.Optional; @@ -38,7 +38,7 @@ import java.util.UUID; public class EnderCrystalEntity extends Entity { - public EnderCrystalEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public EnderCrystalEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java b/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java index e0f8c5a49..3fbe3d2a7 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/Entity.java @@ -47,7 +47,7 @@ import org.cloudburstmc.protocol.bedrock.packet.MoveEntityDeltaPacket; import org.cloudburstmc.protocol.bedrock.packet.RemoveEntityPacket; import org.cloudburstmc.protocol.bedrock.packet.SetEntityDataPacket; import org.geysermc.geyser.api.entity.type.GeyserEntity; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.entity.GeyserDirtyMetadata; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.text.MessageTranslator; @@ -86,7 +86,7 @@ public class Entity implements GeyserEntity { */ protected boolean onGround; - protected EntityDefinition definition; + protected GeyserEntityDefinition definition; /** * Indicates if the entity has been initialized and spawned @@ -124,7 +124,7 @@ public class Entity implements GeyserEntity { @Setter(AccessLevel.PROTECTED) // For players private boolean flagsDirty = false; - public Entity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public Entity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { this.session = session; this.entityId = entityId; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/EvokerFangsEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/EvokerFangsEntity.java index 56d761afd..102a8e270 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/EvokerFangsEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/EvokerFangsEntity.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.entity.type; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; import org.cloudburstmc.protocol.bedrock.packet.PlaySoundPacket; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; @@ -38,7 +38,7 @@ public class EvokerFangsEntity extends Entity implements Tickable { private int limitedLife = 22; private boolean attackStarted = false; - public EvokerFangsEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public EvokerFangsEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); // As of 1.18.2 Bedrock, this line is required for the entity to be visible // 22 is the starting number on Java Edition diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/FireballEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/FireballEntity.java index 3db032f0f..f2041cdfb 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/FireballEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/FireballEntity.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.entity.type; import org.cloudburstmc.math.vector.Vector3f; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; @@ -39,7 +39,7 @@ public class FireballEntity extends ThrowableEntity { */ protected int futureTicks = 3; - public FireballEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public FireballEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, Vector3f.ZERO, yaw, pitch, headYaw); float magnitude = motion.length(); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/FireworkEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/FireworkEntity.java index 7a544f23c..b79f8c13b 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/FireworkEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/FireworkEntity.java @@ -37,7 +37,7 @@ import org.cloudburstmc.nbt.NbtType; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; import org.cloudburstmc.protocol.bedrock.packet.SetEntityMotionPacket; import org.geysermc.floodgate.util.DeviceOs; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.entity.type.player.PlayerEntity; import org.geysermc.geyser.level.FireworkColor; import org.geysermc.geyser.session.GeyserSession; @@ -50,7 +50,7 @@ import java.util.UUID; public class FireworkEntity extends Entity { - public FireworkEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public FireworkEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/FurnaceMinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/FurnaceMinecartEntity.java index a7a117fff..c87ec661f 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/FurnaceMinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/FurnaceMinecartEntity.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanE import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.util.InteractionResult; @@ -39,7 +39,7 @@ import java.util.UUID; public class FurnaceMinecartEntity extends DefaultBlockMinecartEntity { private boolean hasFuel = false; - public FurnaceMinecartEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public FurnaceMinecartEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ItemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ItemEntity.java index bb67a60f6..5db2801a2 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ItemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ItemEntity.java @@ -34,7 +34,7 @@ import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; import org.cloudburstmc.protocol.bedrock.packet.AddItemEntityPacket; import org.cloudburstmc.protocol.bedrock.packet.EntityEventPacket; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.item.ItemTranslator; @@ -47,7 +47,7 @@ public class ItemEntity extends ThrowableEntity { private CompletableFuture waterLevel = CompletableFuture.completedFuture(-1); - public ItemEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ItemEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ItemFrameEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ItemFrameEntity.java index 378385cfa..633450b4f 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ItemFrameEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ItemFrameEntity.java @@ -40,7 +40,7 @@ import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; import org.cloudburstmc.protocol.bedrock.packet.BlockEntityDataPacket; import org.cloudburstmc.protocol.bedrock.packet.UpdateBlockPacket; import lombok.Getter; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.inventory.item.ItemTranslator; import org.geysermc.geyser.util.InteractionResult; @@ -79,7 +79,7 @@ public class ItemFrameEntity extends Entity { */ private boolean changed = true; - public ItemFrameEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw, Direction direction) { + public ItemFrameEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw, Direction direction) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); NbtMapBuilder blockBuilder = NbtMap.builder() diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/LeashKnotEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/LeashKnotEntity.java index 3f0d2ee68..c079c4c09 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/LeashKnotEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/LeashKnotEntity.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import org.cloudburstmc.math.vector.Vector3f; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.util.InteractionResult; @@ -35,7 +35,7 @@ import java.util.UUID; public class LeashKnotEntity extends Entity { - public LeashKnotEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public LeashKnotEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { // Position is incorrect by default super(session, entityId, geyserId, uuid, definition, position.add(0.5f, 0.25f, 0.5f), motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/LightningEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/LightningEntity.java index 6db486f03..a1f9ef4df 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/LightningEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/LightningEntity.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.entity.type; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.packet.PlaySoundPacket; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; @@ -35,7 +35,7 @@ import java.util.concurrent.ThreadLocalRandom; public class LightningEntity extends Entity { - public LightningEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public LightningEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java index 43fe555b0..9e0d16a18 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/LivingEntity.java @@ -49,7 +49,7 @@ import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; import org.cloudburstmc.protocol.bedrock.packet.MobArmorEquipmentPacket; import org.cloudburstmc.protocol.bedrock.packet.MobEquipmentPacket; import org.cloudburstmc.protocol.bedrock.packet.UpdateAttributesPacket; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.item.Items; @@ -81,7 +81,7 @@ public class LivingEntity extends Entity { */ private boolean isMaxFrozenState = false; - public LivingEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public LivingEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/MinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/MinecartEntity.java index ecf67052b..dc0195d95 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/MinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/MinecartEntity.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntit import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.util.InteractionResult; @@ -40,7 +40,7 @@ import java.util.UUID; public class MinecartEntity extends Entity { - public MinecartEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public MinecartEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position.add(0d, definition.offset(), 0d), motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/PaintingEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/PaintingEntity.java index 4e5fe9d59..7df2c9954 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/PaintingEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/PaintingEntity.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ObjectEn import com.github.steveice10.mc.protocol.data.game.entity.object.Direction; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.packet.AddPaintingPacket; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.level.PaintingType; import org.geysermc.geyser.session.GeyserSession; @@ -39,7 +39,7 @@ public class PaintingEntity extends Entity { private static final double OFFSET = -0.46875; private final Direction direction; - public PaintingEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw, Direction direction) { + public PaintingEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw, Direction direction) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); this.direction = direction; } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/SpawnerMinecartEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/SpawnerMinecartEntity.java index 49cfc0081..46d58a763 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/SpawnerMinecartEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/SpawnerMinecartEntity.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.entity.type; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.session.GeyserSession; @@ -35,7 +35,7 @@ import java.util.UUID; public class SpawnerMinecartEntity extends DefaultBlockMinecartEntity { - public SpawnerMinecartEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public SpawnerMinecartEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/TNTEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/TNTEntity.java index 98c2edd00..a925b96d0 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/TNTEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/TNTEntity.java @@ -30,7 +30,7 @@ import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.packet.SetEntityDataPacket; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; @@ -38,7 +38,7 @@ import java.util.UUID; public class TNTEntity extends Entity implements Tickable { private int currentTick; - public TNTEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public TNTEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/TextDisplayEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/TextDisplayEntity.java index f2671f7a9..310201d54 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/TextDisplayEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/TextDisplayEntity.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadat import net.kyori.adventure.text.Component; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.translator.text.MessageTranslator; @@ -37,7 +37,7 @@ import java.util.UUID; // Note: 1.19.4 requires that the billboard is set to something in order to show, on Java Edition public class TextDisplayEntity extends Entity { - public TextDisplayEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public TextDisplayEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableEntity.java index 72ae88310..96e51028d 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableEntity.java @@ -31,7 +31,7 @@ import org.cloudburstmc.protocol.bedrock.data.LevelEvent; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.packet.LevelEventPacket; import org.cloudburstmc.protocol.bedrock.packet.MoveEntityDeltaPacket; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.session.GeyserSession; @@ -44,7 +44,7 @@ public class ThrowableEntity extends Entity implements Tickable { protected Vector3f lastJavaPosition; - public ThrowableEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ThrowableEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); this.lastJavaPosition = position; } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableItemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableItemEntity.java index 39c8386bd..0024f729e 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableItemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ThrowableItemEntity.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadat import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; @@ -44,7 +44,7 @@ public class ThrowableItemEntity extends ThrowableEntity { private int age; private boolean invisible; - public ThrowableItemEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ThrowableItemEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); setFlag(EntityFlag.INVISIBLE, true); invisible = false; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/ThrownPotionEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/ThrownPotionEntity.java index 1b5c1d2d0..60a726155 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/ThrownPotionEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/ThrownPotionEntity.java @@ -33,7 +33,7 @@ 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.GeyserImpl; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.inventory.item.Potion; import org.geysermc.geyser.item.Items; import org.geysermc.geyser.registry.Registries; @@ -45,7 +45,7 @@ import java.util.UUID; public class ThrownPotionEntity extends ThrowableItemEntity { private static final EnumSet NON_ENCHANTED_POTIONS = EnumSet.of(Potion.WATER, Potion.MUNDANE, Potion.THICK, Potion.AWKWARD); - public ThrownPotionEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ThrownPotionEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/TippedArrowEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/TippedArrowEntity.java index 856c4cc66..b8c1f2ebe 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/TippedArrowEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/TippedArrowEntity.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.inventory.item.TippedArrowPotion; import org.geysermc.geyser.session.GeyserSession; @@ -39,7 +39,7 @@ import java.util.UUID; */ public class TippedArrowEntity extends AbstractArrowEntity { - public TippedArrowEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public TippedArrowEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/TridentEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/TridentEntity.java index 2167f2c4d..94c1d0492 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/TridentEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/TridentEntity.java @@ -26,14 +26,14 @@ package org.geysermc.geyser.entity.type; import org.cloudburstmc.math.vector.Vector3f; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class TridentEntity extends AbstractArrowEntity { - public TridentEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public TridentEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/WitherSkullEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/WitherSkullEntity.java index 637ca4139..04ea4d7a4 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/WitherSkullEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/WitherSkullEntity.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.entity.type; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import org.cloudburstmc.math.vector.Vector3f; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.session.GeyserSession; @@ -36,7 +36,7 @@ import java.util.UUID; public class WitherSkullEntity extends FireballEntity { private boolean isCharged; - public WitherSkullEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public WitherSkullEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); this.futureTicks = 1; diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/AbstractFishEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/AbstractFishEntity.java index ec0caac33..d109ce279 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/AbstractFishEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/AbstractFishEntity.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.entity.type.living; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.util.EntityUtils; @@ -39,7 +39,7 @@ import java.util.UUID; public class AbstractFishEntity extends WaterEntity { - public AbstractFishEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AbstractFishEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); setFlag(EntityFlag.CAN_SWIM, true); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/AgeableEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/AgeableEntity.java index 6e2e7a407..f69de0059 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/AgeableEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/AgeableEntity.java @@ -29,14 +29,14 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanE 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.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class AgeableEntity extends CreatureEntity { - public AgeableEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AgeableEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/AllayEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/AllayEntity.java index f39200eed..da2c44831 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/AllayEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/AllayEntity.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanE import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.item.Items; import org.geysermc.geyser.session.GeyserSession; @@ -42,7 +42,7 @@ import java.util.UUID; public class AllayEntity extends MobEntity { private boolean canDuplicate; - public AllayEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AllayEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/AmbientEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/AmbientEntity.java index 8f81125d0..5642d7314 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/AmbientEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/AmbientEntity.java @@ -26,14 +26,14 @@ package org.geysermc.geyser.entity.type.living; import org.cloudburstmc.math.vector.Vector3f; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class AmbientEntity extends MobEntity { - public AmbientEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AmbientEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/ArmorStandEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/ArmorStandEntity.java index 903f08b64..8a1e958e4 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/ArmorStandEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/ArmorStandEntity.java @@ -36,7 +36,7 @@ import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataType; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.LivingEntity; import org.geysermc.geyser.item.Items; @@ -85,7 +85,7 @@ public class ArmorStandEntity extends LivingEntity { */ private boolean positionUpdateRequired = false; - public ArmorStandEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ArmorStandEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/BatEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/BatEntity.java index 644054e72..7093f75eb 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/BatEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/BatEntity.java @@ -28,14 +28,14 @@ package org.geysermc.geyser.entity.type.living; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class BatEntity extends AmbientEntity { - public BatEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public BatEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/CreatureEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/CreatureEntity.java index fd38bf666..8b042ea6e 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/CreatureEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/CreatureEntity.java @@ -26,14 +26,14 @@ package org.geysermc.geyser.entity.type.living; import org.cloudburstmc.math.vector.Vector3f; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class CreatureEntity extends MobEntity { - public CreatureEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public CreatureEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/DolphinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/DolphinEntity.java index 7c1d8efc7..9c6075bac 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/DolphinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/DolphinEntity.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.entity.type.living; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import org.cloudburstmc.math.vector.Vector3f; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.util.InteractionResult; @@ -37,7 +37,7 @@ import javax.annotation.Nonnull; import java.util.UUID; public class DolphinEntity extends WaterEntity { - public DolphinEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public DolphinEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/FlyingEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/FlyingEntity.java index 472a9b3dc..fc86ece2b 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/FlyingEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/FlyingEntity.java @@ -26,14 +26,14 @@ package org.geysermc.geyser.entity.type.living; import org.cloudburstmc.math.vector.Vector3f; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class FlyingEntity extends MobEntity { - public FlyingEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public FlyingEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/GlowSquidEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/GlowSquidEntity.java index 58c2f6082..148310ca2 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/GlowSquidEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/GlowSquidEntity.java @@ -26,13 +26,13 @@ package org.geysermc.geyser.entity.type.living; import org.cloudburstmc.math.vector.Vector3f; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class GlowSquidEntity extends SquidEntity { - public GlowSquidEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public GlowSquidEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/GolemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/GolemEntity.java index 12b2ca91d..77734823c 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/GolemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/GolemEntity.java @@ -26,14 +26,14 @@ package org.geysermc.geyser.entity.type.living; import org.cloudburstmc.math.vector.Vector3f; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class GolemEntity extends CreatureEntity { - public GolemEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public GolemEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/IronGolemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/IronGolemEntity.java index 1f653decd..e82bacc23 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/IronGolemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/IronGolemEntity.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; 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.entity.GeyserEntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.item.Items; import org.geysermc.geyser.session.GeyserSession; @@ -40,7 +40,7 @@ import java.util.UUID; public class IronGolemEntity extends GolemEntity { - public IronGolemEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public IronGolemEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); // Indicate that we should show cracks through a resource pack setFlag(EntityFlag.BRIBED, true); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/MagmaCubeEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/MagmaCubeEntity.java index 5a66ef36e..0837f104f 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/MagmaCubeEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/MagmaCubeEntity.java @@ -27,14 +27,14 @@ package org.geysermc.geyser.entity.type.living; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class MagmaCubeEntity extends SlimeEntity { - public MagmaCubeEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public MagmaCubeEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/MobEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/MobEntity.java index 60a9a1474..3ec4c6c2d 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/MobEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/MobEntity.java @@ -31,7 +31,7 @@ import lombok.Getter; 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.entity.GeyserEntityDefinition; import org.geysermc.geyser.entity.type.LivingEntity; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.item.Items; @@ -50,7 +50,7 @@ public class MobEntity extends LivingEntity { @Getter private long leashHolderBedrockId; - public MobEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public MobEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/SlimeEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/SlimeEntity.java index 1d2eb95bc..bb5cb30ef 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/SlimeEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/SlimeEntity.java @@ -28,14 +28,14 @@ package org.geysermc.geyser.entity.type.living; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class SlimeEntity extends MobEntity { - public SlimeEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public SlimeEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/SnowGolemEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/SnowGolemEntity.java index ced274185..c9838a82e 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/SnowGolemEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/SnowGolemEntity.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEnti import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.item.Items; import org.geysermc.geyser.session.GeyserSession; @@ -41,7 +41,7 @@ import java.util.UUID; public class SnowGolemEntity extends GolemEntity { - public SnowGolemEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public SnowGolemEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/SquidEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/SquidEntity.java index 80a5af442..fb309da8a 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/SquidEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/SquidEntity.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.entity.type.living; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.packet.MoveEntityDeltaPacket; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.entity.type.Tickable; import org.geysermc.geyser.level.block.BlockStateValues; import org.geysermc.geyser.session.GeyserSession; @@ -42,7 +42,7 @@ public class SquidEntity extends WaterEntity implements Tickable { private CompletableFuture inWater = CompletableFuture.completedFuture(Boolean.FALSE); - public SquidEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public SquidEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/TadpoleEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/TadpoleEntity.java index 47ddb9126..272c8ebd3 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/TadpoleEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/TadpoleEntity.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.entity.type.living; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import org.cloudburstmc.math.vector.Vector3f; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.item.Items; import org.geysermc.geyser.session.GeyserSession; @@ -38,7 +38,7 @@ import javax.annotation.Nonnull; import java.util.UUID; public class TadpoleEntity extends AbstractFishEntity { - public TadpoleEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public TadpoleEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/WaterEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/WaterEntity.java index a847c4cd7..d95909a90 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/WaterEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/WaterEntity.java @@ -26,14 +26,14 @@ package org.geysermc.geyser.entity.type.living; import org.cloudburstmc.math.vector.Vector3f; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class WaterEntity extends CreatureEntity { - public WaterEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public WaterEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AnimalEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AnimalEntity.java index 2c46da13b..56cbf5813 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AnimalEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AnimalEntity.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityEventType; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.entity.type.living.AgeableEntity; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.item.Items; @@ -43,7 +43,7 @@ import java.util.UUID; public class AnimalEntity extends AgeableEntity { - public AnimalEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AnimalEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AxolotlEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AxolotlEntity.java index 06eb0791b..32dd63f85 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AxolotlEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/AxolotlEntity.java @@ -31,7 +31,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; 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.entity.GeyserEntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.item.type.Item; import org.geysermc.geyser.session.GeyserSession; @@ -42,7 +42,7 @@ import javax.annotation.Nonnull; import java.util.UUID; public class AxolotlEntity extends AnimalEntity { - public AxolotlEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AxolotlEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/BeeEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/BeeEntity.java index e05b44cf0..53bd964a5 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/BeeEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/BeeEntity.java @@ -32,7 +32,7 @@ import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; 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.entity.GeyserEntityDefinition; import org.geysermc.geyser.item.type.Item; import org.geysermc.geyser.session.GeyserSession; @@ -40,7 +40,7 @@ import java.util.UUID; public class BeeEntity extends AnimalEntity { - public BeeEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public BeeEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/ChickenEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/ChickenEntity.java index 164fb1b6c..b776fa0e7 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/ChickenEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/ChickenEntity.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.entity.type.living.animal; import org.cloudburstmc.math.vector.Vector3f; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.item.Items; import org.geysermc.geyser.item.type.Item; import org.geysermc.geyser.session.GeyserSession; @@ -37,7 +37,7 @@ import java.util.UUID; public class ChickenEntity extends AnimalEntity { private static final Set VALID_FOOD = Set.of(Items.WHEAT_SEEDS, Items.MELON_SEEDS, Items.PUMPKIN_SEEDS, Items.BEETROOT_SEEDS); - public ChickenEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ChickenEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/CowEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/CowEntity.java index 01641c8c3..351803b7f 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/CowEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/CowEntity.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.SoundEvent; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.item.Items; import org.geysermc.geyser.session.GeyserSession; @@ -40,7 +40,7 @@ import javax.annotation.Nonnull; import java.util.UUID; public class CowEntity extends AnimalEntity { - public CowEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public CowEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/FoxEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/FoxEntity.java index 98c73cbce..8fd3ad0e6 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/FoxEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/FoxEntity.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntit 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.entity.GeyserEntityDefinition; import org.geysermc.geyser.item.type.Item; import org.geysermc.geyser.session.GeyserSession; @@ -38,7 +38,7 @@ import java.util.UUID; public class FoxEntity extends AnimalEntity { - public FoxEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public FoxEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/FrogEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/FrogEntity.java index 039ef5bf9..4ec7eb803 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/FrogEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/FrogEntity.java @@ -31,7 +31,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ObjectEn 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.entity.GeyserEntityDefinition; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.item.Items; import org.geysermc.geyser.item.type.Item; @@ -41,7 +41,7 @@ import java.util.OptionalInt; import java.util.UUID; public class FrogEntity extends AnimalEntity { - public FrogEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public FrogEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/GoatEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/GoatEntity.java index 20b8f5ccf..a3ebf06b7 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/GoatEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/GoatEntity.java @@ -32,7 +32,7 @@ import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.SoundEvent; 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.GeyserEntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.item.Items; import org.geysermc.geyser.session.GeyserSession; @@ -49,7 +49,7 @@ public class GoatEntity extends AnimalEntity { private boolean hasLeftHorn; private boolean hasRightHorn; - public GoatEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public GoatEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/HoglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/HoglinEntity.java index 154c2f688..f69b7d2c8 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/HoglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/HoglinEntity.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.entity.type.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.item.Items; import org.geysermc.geyser.item.type.Item; import org.geysermc.geyser.session.GeyserSession; @@ -38,7 +38,7 @@ import java.util.UUID; public class HoglinEntity extends AnimalEntity { private boolean isImmuneToZombification; - public HoglinEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public HoglinEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/MooshroomEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/MooshroomEntity.java index 2d136a169..13274fb67 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/MooshroomEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/MooshroomEntity.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ObjectEn import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.item.Items; import org.geysermc.geyser.item.type.FlowerItem; @@ -43,7 +43,7 @@ import java.util.UUID; public class MooshroomEntity extends AnimalEntity { private boolean isBrown = false; - public MooshroomEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public MooshroomEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/OcelotEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/OcelotEntity.java index c81ddd52e..8ea755101 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/OcelotEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/OcelotEntity.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.entity.type.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.item.Items; import org.geysermc.geyser.item.type.Item; @@ -41,7 +41,7 @@ import java.util.UUID; public class OcelotEntity extends AnimalEntity { - public OcelotEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public OcelotEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PandaEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PandaEntity.java index 212eaa91e..cca39b928 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PandaEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PandaEntity.java @@ -33,7 +33,7 @@ import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; 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.entity.GeyserEntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.item.Items; import org.geysermc.geyser.item.type.Item; @@ -49,7 +49,7 @@ public class PandaEntity extends AnimalEntity { private Gene mainGene = Gene.NORMAL; private Gene hiddenGene = Gene.NORMAL; - public PandaEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public PandaEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PigEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PigEntity.java index 91e94321c..850a1069a 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PigEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PigEntity.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.entity.type.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.item.Items; import org.geysermc.geyser.item.type.Item; @@ -42,7 +42,7 @@ import java.util.UUID; public class PigEntity extends AnimalEntity { - public PigEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public PigEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PolarBearEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PolarBearEntity.java index 1d7777cdb..9c1fa18d0 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PolarBearEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PolarBearEntity.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.entity.type.living.animal; import org.cloudburstmc.math.vector.Vector3f; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.item.type.Item; import org.geysermc.geyser.session.GeyserSession; @@ -34,7 +34,7 @@ import java.util.UUID; public class PolarBearEntity extends AnimalEntity { - public PolarBearEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public PolarBearEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PufferFishEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PufferFishEntity.java index d0d119593..4aeb632ed 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PufferFishEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/PufferFishEntity.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.entity.type.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.entity.type.living.AbstractFishEntity; import org.geysermc.geyser.session.GeyserSession; @@ -36,7 +36,7 @@ import java.util.UUID; public class PufferFishEntity extends AbstractFishEntity { - public PufferFishEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public PufferFishEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/RabbitEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/RabbitEntity.java index 1efa87ec8..d96e42776 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/RabbitEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/RabbitEntity.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntit 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.entity.GeyserEntityDefinition; import org.geysermc.geyser.item.Items; import org.geysermc.geyser.item.type.Item; import org.geysermc.geyser.session.GeyserSession; @@ -38,7 +38,7 @@ import java.util.UUID; public class RabbitEntity extends AnimalEntity { - public RabbitEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public RabbitEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/SheepEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/SheepEntity.java index 8c9458012..e1b941718 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/SheepEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/SheepEntity.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; 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.entity.GeyserEntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.item.Items; import org.geysermc.geyser.item.type.DyeItem; @@ -44,7 +44,7 @@ import java.util.UUID; public class SheepEntity extends AnimalEntity { private int color; - public SheepEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public SheepEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/StriderEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/StriderEntity.java index e58fa5aca..9a5f6f2d9 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/StriderEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/StriderEntity.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanE import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.item.Items; @@ -46,7 +46,7 @@ public class StriderEntity extends AnimalEntity { private boolean isCold = false; - public StriderEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public StriderEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); setFlag(EntityFlag.FIRE_IMMUNE, true); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TropicalFishEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TropicalFishEntity.java index b18e55a48..0fb85c278 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TropicalFishEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TropicalFishEntity.java @@ -30,7 +30,7 @@ import com.google.common.collect.ImmutableList; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; import it.unimi.dsi.fastutil.ints.IntList; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.entity.type.living.AbstractFishEntity; import org.geysermc.geyser.session.GeyserSession; @@ -48,7 +48,7 @@ public class TropicalFishEntity extends AbstractFishEntity { private static final List VARIANT_NAMES = ImmutableList.of("kob", "sunstreak", "snooper", "dasher", "brinely", "spotty", "flopper", "stripey", "glitter", "blockfish", "betty", "clayfish"); private static final List COLOR_NAMES = ImmutableList.of("white", "orange", "magenta", "light_blue", "yellow", "lime", "pink", "gray", "light_gray", "cyan", "purple", "blue", "brown", "green", "red", "black"); - public TropicalFishEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public TropicalFishEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TurtleEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TurtleEntity.java index 870ded193..e56a14173 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TurtleEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/TurtleEntity.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.entity.type.living.animal; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.item.Items; import org.geysermc.geyser.item.type.Item; import org.geysermc.geyser.session.GeyserSession; @@ -37,7 +37,7 @@ import java.util.UUID; public class TurtleEntity extends AnimalEntity { - public TurtleEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public TurtleEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/AbstractHorseEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/AbstractHorseEntity.java index 872f72190..ab8fbe99a 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/AbstractHorseEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/AbstractHorseEntity.java @@ -34,7 +34,7 @@ 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.cloudburstmc.protocol.bedrock.packet.UpdateAttributesPacket; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; import org.geysermc.geyser.entity.type.living.animal.AnimalEntity; import org.geysermc.geyser.inventory.GeyserItemStack; @@ -56,7 +56,7 @@ public class AbstractHorseEntity extends AnimalEntity { private static final Set DONKEY_AND_HORSE_FOODS = Set.of(Items.GOLDEN_APPLE, Items.ENCHANTED_GOLDEN_APPLE, Items.GOLDEN_CARROT, Items.SUGAR, Items.APPLE, Items.WHEAT, Items.HAY_BLOCK); - public AbstractHorseEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AbstractHorseEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); // Specifies the size of the entity's inventory. Required to place slots in the entity. diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/CamelEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/CamelEntity.java index ed46cfc2a..eee4663b0 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/CamelEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/CamelEntity.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.item.Items; import org.geysermc.geyser.item.type.Item; import org.geysermc.geyser.session.GeyserSession; @@ -40,7 +40,7 @@ public class CamelEntity extends AbstractHorseEntity { private static final float SITTING_HEIGHT_DIFFERENCE = 1.43F; - public CamelEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public CamelEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/ChestedHorseEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/ChestedHorseEntity.java index 0fb9438d2..0a7cdbdba 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/ChestedHorseEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/ChestedHorseEntity.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.entity.type.living.animal.horse; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.item.Items; import org.geysermc.geyser.session.GeyserSession; @@ -37,7 +37,7 @@ import java.util.UUID; public class ChestedHorseEntity extends AbstractHorseEntity { - public ChestedHorseEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ChestedHorseEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/HorseEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/HorseEntity.java index dfa6ef30a..d9b0ffc11 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/HorseEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/HorseEntity.java @@ -28,14 +28,14 @@ package org.geysermc.geyser.entity.type.living.animal.horse; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class HorseEntity extends AbstractHorseEntity { - public HorseEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public HorseEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/LlamaEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/LlamaEntity.java index a32d7b1b5..0f2212ef4 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/LlamaEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/LlamaEntity.java @@ -30,7 +30,7 @@ import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; import org.cloudburstmc.protocol.bedrock.data.inventory.ItemData; import org.cloudburstmc.protocol.bedrock.packet.MobArmorEquipmentPacket; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.item.Items; import org.geysermc.geyser.item.type.Item; import org.geysermc.geyser.session.GeyserSession; @@ -39,7 +39,7 @@ import java.util.UUID; public class LlamaEntity extends ChestedHorseEntity { - public LlamaEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public LlamaEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); dirtyMetadata.put(EntityDataTypes.CONTAINER_STRENGTH_MODIFIER, 3); // Presumably 3 slots for every 1 strength diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/SkeletonHorseEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/SkeletonHorseEntity.java index 43c76202c..6e53f2d46 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/SkeletonHorseEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/SkeletonHorseEntity.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.entity.type.living.animal.horse; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import org.cloudburstmc.math.vector.Vector3f; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.util.InteractionResult; @@ -37,7 +37,7 @@ import javax.annotation.Nonnull; import java.util.UUID; public class SkeletonHorseEntity extends AbstractHorseEntity { - public SkeletonHorseEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public SkeletonHorseEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/TraderLlamaEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/TraderLlamaEntity.java index 4be0ef5e2..69183630d 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/TraderLlamaEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/TraderLlamaEntity.java @@ -27,14 +27,14 @@ package org.geysermc.geyser.entity.type.living.animal.horse; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class TraderLlamaEntity extends LlamaEntity { - public TraderLlamaEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public TraderLlamaEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/ZombieHorseEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/ZombieHorseEntity.java index 423537496..8baa23fbc 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/ZombieHorseEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/horse/ZombieHorseEntity.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.entity.type.living.animal.horse; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import org.cloudburstmc.math.vector.Vector3f; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.util.InteractionResult; @@ -37,7 +37,7 @@ import javax.annotation.Nonnull; import java.util.UUID; public class ZombieHorseEntity extends AbstractHorseEntity { - public ZombieHorseEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ZombieHorseEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/CatEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/CatEntity.java index 7903d85ca..7a01d854a 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/CatEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/CatEntity.java @@ -32,7 +32,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; 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.entity.GeyserEntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.item.Items; import org.geysermc.geyser.item.type.Item; @@ -47,7 +47,7 @@ public class CatEntity extends TameableEntity { private byte collarColor; - public CatEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public CatEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/ParrotEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/ParrotEntity.java index 43f379de8..35f3cdd93 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/ParrotEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/ParrotEntity.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.entity.type.living.animal.tameable; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.item.Items; import org.geysermc.geyser.item.type.Item; @@ -44,7 +44,7 @@ public class ParrotEntity extends TameableEntity { // Note: is the same as chicken. Reuse? private static final Set TAMING_FOOD = Set.of(Items.WHEAT_SEEDS, Items.MELON_SEEDS, Items.PUMPKIN_SEEDS, Items.BEETROOT_SEEDS); - public ParrotEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ParrotEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/TameableEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/TameableEntity.java index 5fc8c459d..f80045bda 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/TameableEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/TameableEntity.java @@ -31,7 +31,7 @@ import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import lombok.Getter; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.living.animal.AnimalEntity; import org.geysermc.geyser.session.GeyserSession; @@ -46,7 +46,7 @@ public class TameableEntity extends AnimalEntity { @Getter protected long ownerBedrockId; - public TameableEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public TameableEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/WolfEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/WolfEntity.java index ecf0736a3..503537fdf 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/WolfEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/animal/tameable/WolfEntity.java @@ -31,7 +31,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; 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.entity.GeyserEntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.item.Items; import org.geysermc.geyser.item.type.DyeItem; @@ -56,7 +56,7 @@ public class WolfEntity extends TameableEntity { private byte collarColor; - public WolfEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public WolfEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/AbstractMerchantEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/AbstractMerchantEntity.java index b8465f9ca..d725719c3 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/AbstractMerchantEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/AbstractMerchantEntity.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.entity.type.living.merchant; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.entity.type.living.AgeableEntity; import org.geysermc.geyser.inventory.GeyserItemStack; @@ -42,7 +42,7 @@ import java.util.UUID; public class AbstractMerchantEntity extends AgeableEntity { - public AbstractMerchantEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AbstractMerchantEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/VillagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/VillagerEntity.java index 84b8b5143..5d491c2d8 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/VillagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/merchant/VillagerEntity.java @@ -33,7 +33,7 @@ import org.cloudburstmc.math.vector.Vector3i; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.packet.MoveEntityAbsolutePacket; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.registry.BlockRegistries; import org.geysermc.geyser.registry.type.BlockMapping; import org.geysermc.geyser.session.GeyserSession; @@ -85,7 +85,7 @@ public class VillagerEntity extends AbstractMerchantEntity { @Getter private boolean canTradeWith; - public VillagerEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public VillagerEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/AbstractSkeletonEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/AbstractSkeletonEntity.java index 04b3bba1b..485a09b91 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/AbstractSkeletonEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/AbstractSkeletonEntity.java @@ -28,14 +28,14 @@ package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class AbstractSkeletonEntity extends MonsterEntity { - public AbstractSkeletonEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AbstractSkeletonEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BasePiglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BasePiglinEntity.java index 5f2647b7a..b7e1adb84 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BasePiglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BasePiglinEntity.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; @@ -36,7 +36,7 @@ import java.util.UUID; public class BasePiglinEntity extends MonsterEntity { private boolean isImmuneToZombification; - public BasePiglinEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public BasePiglinEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BlazeEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BlazeEntity.java index 43d78f468..ffd1d0cff 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BlazeEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/BlazeEntity.java @@ -28,14 +28,14 @@ package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class BlazeEntity extends MonsterEntity { - public BlazeEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public BlazeEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/CreeperEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/CreeperEntity.java index e50722681..9415fab55 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/CreeperEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/CreeperEntity.java @@ -31,7 +31,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.SoundEvent; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.util.InteractionResult; @@ -47,7 +47,7 @@ public class CreeperEntity extends MonsterEntity { */ private boolean ignitedByFlintAndSteel = false; - public CreeperEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public CreeperEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ElderGuardianEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ElderGuardianEntity.java index 8890e72a9..422fe3977 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ElderGuardianEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ElderGuardianEntity.java @@ -27,14 +27,14 @@ package org.geysermc.geyser.entity.type.living.monster; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class ElderGuardianEntity extends GuardianEntity { - public ElderGuardianEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ElderGuardianEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonEntity.java index bb09a23f4..2825ed4b8 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EnderDragonEntity.java @@ -37,7 +37,7 @@ import org.cloudburstmc.protocol.bedrock.packet.EntityEventPacket; import org.cloudburstmc.protocol.bedrock.packet.LevelEventPacket; import org.cloudburstmc.protocol.bedrock.packet.PlaySoundPacket; import org.cloudburstmc.protocol.bedrock.packet.SpawnParticleEffectPacket; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.entity.type.Tickable; import org.geysermc.geyser.entity.type.living.MobEntity; import org.geysermc.geyser.session.GeyserSession; @@ -84,7 +84,7 @@ public class EnderDragonEntity extends MobEntity implements Tickable { private float wingPosition; private float lastWingPosition; - public EnderDragonEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public EnderDragonEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EndermanEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EndermanEntity.java index 0d52b7a35..1acbd2cb5 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EndermanEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/EndermanEntity.java @@ -33,14 +33,14 @@ import org.cloudburstmc.protocol.bedrock.data.defintions.BlockDefinition; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.packet.LevelSoundEvent2Packet; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class EndermanEntity extends MonsterEntity { - public EndermanEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public EndermanEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GhastEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GhastEntity.java index f7b9d17b8..87a685faf 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GhastEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GhastEntity.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.entity.type.living.FlyingEntity; import org.geysermc.geyser.session.GeyserSession; @@ -36,7 +36,7 @@ import java.util.UUID; public class GhastEntity extends FlyingEntity { - public GhastEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public GhastEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GiantEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GiantEntity.java index e98c8f120..0fc67ed08 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GiantEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GiantEntity.java @@ -27,14 +27,14 @@ package org.geysermc.geyser.entity.type.living.monster; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class GiantEntity extends MonsterEntity { - public GiantEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public GiantEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); dirtyMetadata.put(EntityDataTypes.SCALE, 6f); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GuardianEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GuardianEntity.java index 92e50d207..036838f6f 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GuardianEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/GuardianEntity.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.session.GeyserSession; @@ -36,7 +36,7 @@ import java.util.UUID; public class GuardianEntity extends MonsterEntity { - public GuardianEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public GuardianEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/MonsterEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/MonsterEntity.java index c0edc448c..fde75df9a 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/MonsterEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/MonsterEntity.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.entity.type.living.monster; import org.cloudburstmc.math.vector.Vector3f; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.entity.type.living.CreatureEntity; import org.geysermc.geyser.session.GeyserSession; @@ -34,7 +34,7 @@ import java.util.UUID; public class MonsterEntity extends CreatureEntity { - public MonsterEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public MonsterEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PhantomEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PhantomEntity.java index 915e34e79..4d610d200 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PhantomEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PhantomEntity.java @@ -28,14 +28,14 @@ package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.entity.type.living.FlyingEntity; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class PhantomEntity extends FlyingEntity { - public PhantomEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public PhantomEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PiglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PiglinEntity.java index 25fe7f802..2a85eb7a1 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PiglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/PiglinEntity.java @@ -30,7 +30,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; 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.entity.GeyserEntityDefinition; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.item.Items; import org.geysermc.geyser.session.GeyserSession; @@ -42,7 +42,7 @@ import java.util.UUID; public class PiglinEntity extends BasePiglinEntity { - public PiglinEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public PiglinEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ShulkerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ShulkerEntity.java index 27dd45f40..666c94b76 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ShulkerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ShulkerEntity.java @@ -31,7 +31,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.object.Direction; 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.entity.GeyserEntityDefinition; import org.geysermc.geyser.entity.type.living.GolemEntity; import org.geysermc.geyser.session.GeyserSession; @@ -39,7 +39,7 @@ import java.util.UUID; public class ShulkerEntity extends GolemEntity { - public ShulkerEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ShulkerEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); // Indicate that invisibility should be fixed through the resource pack setFlag(EntityFlag.BRIBED, true); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SkeletonEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SkeletonEntity.java index da11b2759..024067fd6 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SkeletonEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SkeletonEntity.java @@ -28,7 +28,7 @@ package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; @@ -36,7 +36,7 @@ import java.util.UUID; public class SkeletonEntity extends AbstractSkeletonEntity { private boolean convertingToStray = false; - public SkeletonEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public SkeletonEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SpiderEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SpiderEntity.java index 03e234911..e7eba5baf 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SpiderEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/SpiderEntity.java @@ -28,14 +28,14 @@ package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class SpiderEntity extends MonsterEntity { - public SpiderEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public SpiderEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/VexEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/VexEntity.java index 56a0975ae..8021d879e 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/VexEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/VexEntity.java @@ -28,14 +28,14 @@ package org.geysermc.geyser.entity.type.living.monster; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class VexEntity extends MonsterEntity { - public VexEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public VexEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/WardenEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/WardenEntity.java index 7a0c5e040..b4800d070 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/WardenEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/WardenEntity.java @@ -32,7 +32,7 @@ import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; import org.cloudburstmc.protocol.bedrock.packet.PlaySoundPacket; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.entity.type.Tickable; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.util.MathUtils; @@ -46,7 +46,7 @@ public class WardenEntity extends MonsterEntity implements Tickable { private int sonicBoomTickDuration; - public WardenEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public WardenEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/WitherEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/WitherEntity.java index 3abb7f122..fe9f7d810 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/WitherEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/WitherEntity.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntit import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataType; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.session.GeyserSession; @@ -37,7 +37,7 @@ import java.util.UUID; public class WitherEntity extends MonsterEntity { - public WitherEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public WitherEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZoglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZoglinEntity.java index 6e40573ba..4127b1324 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZoglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZoglinEntity.java @@ -29,14 +29,14 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanE 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.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class ZoglinEntity extends MonsterEntity { - public ZoglinEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ZoglinEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieEntity.java index af6a30a10..ecde11e21 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieEntity.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanE 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.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; @@ -37,7 +37,7 @@ import java.util.UUID; public class ZombieEntity extends MonsterEntity { private boolean convertingToDrowned = false; - public ZombieEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ZombieEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieVillagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieVillagerEntity.java index fbac8663f..121290e78 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieVillagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombieVillagerEntity.java @@ -32,7 +32,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; 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.entity.GeyserEntityDefinition; import org.geysermc.geyser.entity.type.living.merchant.VillagerEntity; import org.geysermc.geyser.inventory.GeyserItemStack; import org.geysermc.geyser.item.Items; @@ -45,7 +45,7 @@ import java.util.UUID; public class ZombieVillagerEntity extends ZombieEntity { - public ZombieVillagerEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ZombieVillagerEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombifiedPiglinEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombifiedPiglinEntity.java index 0a0fe6306..5a83be0fc 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombifiedPiglinEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/ZombifiedPiglinEntity.java @@ -27,14 +27,14 @@ package org.geysermc.geyser.entity.type.living.monster; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class ZombifiedPiglinEntity extends ZombieEntity { - public ZombifiedPiglinEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public ZombifiedPiglinEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); setFlag(EntityFlag.FIRE_IMMUNE, true); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/AbstractIllagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/AbstractIllagerEntity.java index 90138742f..de10b636f 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/AbstractIllagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/AbstractIllagerEntity.java @@ -26,14 +26,14 @@ package org.geysermc.geyser.entity.type.living.monster.raid; import org.cloudburstmc.math.vector.Vector3f; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class AbstractIllagerEntity extends RaidParticipantEntity { - public AbstractIllagerEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public AbstractIllagerEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/PillagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/PillagerEntity.java index d2f8377d3..94d1fff34 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/PillagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/PillagerEntity.java @@ -27,7 +27,7 @@ package org.geysermc.geyser.entity.type.living.monster.raid; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.session.GeyserSession; @@ -35,7 +35,7 @@ import java.util.UUID; public class PillagerEntity extends AbstractIllagerEntity { - public PillagerEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public PillagerEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/RaidParticipantEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/RaidParticipantEntity.java index 05becf490..dbc4771a2 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/RaidParticipantEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/RaidParticipantEntity.java @@ -26,7 +26,7 @@ package org.geysermc.geyser.entity.type.living.monster.raid; import org.cloudburstmc.math.vector.Vector3f; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.entity.type.living.monster.MonsterEntity; import org.geysermc.geyser.session.GeyserSession; @@ -34,7 +34,7 @@ import java.util.UUID; public class RaidParticipantEntity extends MonsterEntity { - public RaidParticipantEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public RaidParticipantEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/SpellcasterIllagerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/SpellcasterIllagerEntity.java index f083437ae..b13f66652 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/SpellcasterIllagerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/SpellcasterIllagerEntity.java @@ -29,7 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEnti 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.entity.GeyserEntityDefinition; import org.geysermc.geyser.entity.EntityDefinitions; import org.geysermc.geyser.session.GeyserSession; @@ -40,7 +40,7 @@ public class SpellcasterIllagerEntity extends AbstractIllagerEntity { private static final int ATTACK_PARTICLE_COLOR = (102 << 16) | (77 << 8) | 89; private static final int WOLOLO_PARTICLE_COLOR = (179 << 16) | (128 << 8) | 51; - public SpellcasterIllagerEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public SpellcasterIllagerEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); // OptionalPack usage setFlag(EntityFlag.BRIBED, this.definition == EntityDefinitions.ILLUSIONER); diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/VindicatorEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/VindicatorEntity.java index ad99dda50..73f688325 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/VindicatorEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/living/monster/raid/VindicatorEntity.java @@ -28,14 +28,14 @@ package org.geysermc.geyser.entity.type.living.monster.raid; import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata; import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; public class VindicatorEntity extends AbstractIllagerEntity { - public VindicatorEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { + public VindicatorEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, GeyserEntityDefinition definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) { super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw); } diff --git a/core/src/main/java/org/geysermc/geyser/event/type/GeyserDefineEntitiesEventImpl.java b/core/src/main/java/org/geysermc/geyser/event/type/GeyserDefineEntitiesEventImpl.java new file mode 100644 index 000000000..06ee78986 --- /dev/null +++ b/core/src/main/java/org/geysermc/geyser/event/type/GeyserDefineEntitiesEventImpl.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2019-2023 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.event.type; + +import org.checkerframework.checker.nullness.qual.NonNull; +import org.geysermc.geyser.api.entity.EntityDefinition; +import org.geysermc.geyser.api.event.lifecycle.GeyserDefineEntitiesEvent; + +import java.util.List; + +public abstract class GeyserDefineEntitiesEventImpl implements GeyserDefineEntitiesEvent { + private final List entityDefinitions; + + public GeyserDefineEntitiesEventImpl(List entityDefinitions) { + this.entityDefinitions = entityDefinitions; + } + + @NonNull + @Override + public List entityDefinitions() { + return this.entityDefinitions; + } +} diff --git a/core/src/main/java/org/geysermc/geyser/registry/Registries.java b/core/src/main/java/org/geysermc/geyser/registry/Registries.java index 0bf6ae078..f746e8bac 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/Registries.java +++ b/core/src/main/java/org/geysermc/geyser/registry/Registries.java @@ -36,16 +36,31 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import org.checkerframework.checker.nullness.qual.NonNull; import org.cloudburstmc.nbt.NbtMap; import org.cloudburstmc.nbt.NbtMapBuilder; import org.cloudburstmc.protocol.bedrock.data.inventory.crafting.PotionMixData; import org.cloudburstmc.protocol.bedrock.data.inventory.crafting.recipe.RecipeData; import org.cloudburstmc.protocol.bedrock.packet.BedrockPacket; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.api.entity.EntityDefinition; +import org.geysermc.geyser.api.event.lifecycle.GeyserDefineEntitiesEvent; +import org.geysermc.geyser.entity.GeyserEntityDefinition; +import org.geysermc.geyser.event.type.GeyserDefineEntitiesEventImpl; import org.geysermc.geyser.inventory.item.Enchantment.JavaEnchantment; import org.geysermc.geyser.inventory.recipe.GeyserRecipe; import org.geysermc.geyser.item.type.Item; -import org.geysermc.geyser.registry.loader.*; +import org.geysermc.geyser.registry.loader.BiomeIdentifierRegistryLoader; +import org.geysermc.geyser.registry.loader.BlockEntityRegistryLoader; +import org.geysermc.geyser.registry.loader.CollisionRegistryLoader; +import org.geysermc.geyser.registry.loader.EnchantmentRegistryLoader; +import org.geysermc.geyser.registry.loader.ParticleTypesRegistryLoader; +import org.geysermc.geyser.registry.loader.PotionMixRegistryLoader; +import org.geysermc.geyser.registry.loader.ProviderRegistryLoader; +import org.geysermc.geyser.registry.loader.RegistryLoaders; +import org.geysermc.geyser.registry.loader.SoundEventsRegistryLoader; +import org.geysermc.geyser.registry.loader.SoundRegistryLoader; +import org.geysermc.geyser.registry.loader.SoundTranslatorRegistryLoader; import org.geysermc.geyser.registry.populator.ItemRegistryPopulator; import org.geysermc.geyser.registry.populator.PacketRegistryPopulator; import org.geysermc.geyser.registry.populator.RecipeRegistryPopulator; @@ -59,8 +74,16 @@ import org.geysermc.geyser.translator.level.block.entity.BlockEntityTranslator; import org.geysermc.geyser.translator.level.event.LevelEventTranslator; import org.geysermc.geyser.translator.sound.SoundInteractionTranslator; import org.geysermc.geyser.translator.sound.SoundTranslator; +import org.geysermc.geyser.util.EntityUtils; -import java.util.*; +import java.util.ArrayList; +import java.util.EnumMap; +import java.util.IdentityHashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; /** * Holds all the common registries in Geyser. @@ -109,12 +132,12 @@ public final class Registries { /** * A map containing all entity types and their respective Geyser definitions */ - public static final SimpleMappedRegistry> ENTITY_DEFINITIONS = SimpleMappedRegistry.create(RegistryLoaders.empty(() -> new EnumMap<>(EntityType.class))); + public static final SimpleMappedRegistry> ENTITY_DEFINITIONS = SimpleMappedRegistry.create(RegistryLoaders.empty(() -> new EnumMap<>(EntityType.class))); /** - * A map containing all Java entity identifiers and their respective Geyser definitions + * A map containing all entity identifiers and their respective Geyser definitions */ - public static final SimpleMappedRegistry> JAVA_ENTITY_IDENTIFIERS = SimpleMappedRegistry.create(RegistryLoaders.empty(Object2ObjectOpenHashMap::new)); + public static final SimpleMappedRegistry> ENTITY_IDENTIFIERS = SimpleMappedRegistry.create(RegistryLoaders.empty(Object2ObjectOpenHashMap::new)); /** * A registry containing all the Java packet translators. @@ -199,4 +222,27 @@ public final class Registries { } BIOMES_NBT.set(biomesNbt.build()); } + + public static void callRegistryEvents() { + // Call registry events + List definitions = ENTITY_IDENTIFIERS.get().values().stream() + .map(def -> (EntityDefinition) def) + .filter(Objects::nonNull) + .collect(Collectors.toList()); + + GeyserDefineEntitiesEvent defineEntitiesEvent = new GeyserDefineEntitiesEventImpl(definitions) { + @Override + public boolean register(@NonNull EntityDefinition entityDefinition) { + GeyserEntityDefinition geyserDefinition = (GeyserEntityDefinition) entityDefinition; + if (!geyserDefinition.custom()) { + return false; + } + + EntityUtils.registerEntity(geyserDefinition.identifier(), geyserDefinition); + return true; + } + }; + + GeyserImpl.getInstance().eventBus().fire(defineEntitiesEvent); + } } diff --git a/core/src/main/java/org/geysermc/geyser/registry/loader/ProviderRegistryLoader.java b/core/src/main/java/org/geysermc/geyser/registry/loader/ProviderRegistryLoader.java index 99a9213fe..4f73691fd 100644 --- a/core/src/main/java/org/geysermc/geyser/registry/loader/ProviderRegistryLoader.java +++ b/core/src/main/java/org/geysermc/geyser/registry/loader/ProviderRegistryLoader.java @@ -26,12 +26,17 @@ package org.geysermc.geyser.registry.loader; import org.geysermc.geyser.api.command.Command; +import org.geysermc.geyser.api.entity.EntityDefinition; +import org.geysermc.geyser.api.entity.EntityIdentifier; import org.geysermc.geyser.api.event.EventRegistrar; import org.geysermc.geyser.api.extension.Extension; import org.geysermc.geyser.api.item.custom.CustomItemData; import org.geysermc.geyser.api.item.custom.CustomItemOptions; import org.geysermc.geyser.api.item.custom.NonVanillaCustomItemData; import org.geysermc.geyser.command.GeyserCommandManager; +import org.geysermc.geyser.entity.GeyserEntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityIdentifier; +import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.event.GeyserEventRegistrar; import org.geysermc.geyser.item.GeyserCustomItemData; import org.geysermc.geyser.item.GeyserCustomItemOptions; @@ -52,6 +57,8 @@ public class ProviderRegistryLoader implements RegistryLoader, Prov providers.put(CustomItemOptions.Builder.class, args -> new GeyserCustomItemOptions.CustomItemOptionsBuilder()); providers.put(NonVanillaCustomItemData.Builder.class, args -> new GeyserNonVanillaCustomItemData.NonVanillaCustomItemDataBuilder()); providers.put(EventRegistrar.class, args -> new GeyserEventRegistrar(args[0])); + providers.put(EntityIdentifier.Builder.class, args -> new GeyserEntityIdentifier.EntityIdentifierBuilder()); + providers.put(EntityDefinition.Builder.class, args -> new GeyserEntityDefinition.EntityDefinitionBuilder<>(Entity::new, true)); return providers; } diff --git a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java index e841dd43c..58a9680c3 100644 --- a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java +++ b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java @@ -82,6 +82,8 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.common.value.qual.IntRange; import org.cloudburstmc.math.vector.*; import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtMapBuilder; +import org.cloudburstmc.nbt.NbtType; import org.cloudburstmc.protocol.bedrock.BedrockServerSession; import org.cloudburstmc.protocol.bedrock.data.*; import org.cloudburstmc.protocol.bedrock.data.command.CommandEnumData; @@ -102,13 +104,17 @@ import org.geysermc.floodgate.util.BedrockData; import org.geysermc.geyser.Constants; import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.api.connection.GeyserConnection; +import org.geysermc.geyser.api.entity.EntityDefinition; +import org.geysermc.geyser.api.entity.EntityIdentifier; import org.geysermc.geyser.api.entity.type.GeyserEntity; import org.geysermc.geyser.api.entity.type.player.GeyserPlayerEntity; +import org.geysermc.geyser.api.event.bedrock.SessionDefineEntitiesEvent; import org.geysermc.geyser.api.network.AuthType; import org.geysermc.geyser.api.network.RemoteServer; import org.geysermc.geyser.command.GeyserCommandSource; import org.geysermc.geyser.configuration.EmoteOffhandWorkaroundOption; import org.geysermc.geyser.entity.EntityDefinitions; +import org.geysermc.geyser.entity.GeyserEntityIdentifier; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.ItemFrameEntity; @@ -151,6 +157,7 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; @Getter public class GeyserSession implements GeyserConnection, GeyserCommandSource { @@ -630,9 +637,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource { biomeDefinitionListPacket.setDefinitions(Registries.BIOMES_NBT.get()); upstream.sendPacket(biomeDefinitionListPacket); - AvailableEntityIdentifiersPacket entityPacket = new AvailableEntityIdentifiersPacket(); - entityPacket.setIdentifiers(Registries.BEDROCK_ENTITY_IDENTIFIERS.get()); - upstream.sendPacket(entityPacket); + this.sendAvailableEntityIdentifiers(); CreativeContentPacket creativePacket = new CreativeContentPacket(); creativePacket.setContents(this.itemMappings.getCreativeItems()); @@ -668,6 +673,36 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource { upstream.sendPacket(gamerulePacket); } + public void sendAvailableEntityIdentifiers() { + NbtMap nbt = Registries.BEDROCK_ENTITY_IDENTIFIERS.get(); + List idlist = nbt.getList("idlist", NbtType.COMPOUND); + List identifiers = new ArrayList<>(idlist.size()); + for (NbtMap identifier : idlist) { + identifiers.add(new GeyserEntityIdentifier(identifier)); + } + + NbtMapBuilder builder = nbt.toBuilder(); + SessionDefineEntitiesEvent event = new SessionDefineEntitiesEvent(this, identifiers) { + + @Override + public boolean register(@NonNull EntityIdentifier entityIdentifier) { + return identifiers.add(entityIdentifier); + } + }; + + this.geyser.eventBus().fire(event); + + builder.putList("idlist", NbtType.COMPOUND, identifiers + .stream() + .map(identifer -> ((GeyserEntityIdentifier) identifer).nbt()) + .collect(Collectors.toList()) + ); + + AvailableEntityIdentifiersPacket entityPacket = new AvailableEntityIdentifiersPacket(); + entityPacket.setIdentifiers(builder.build()); + upstream.sendPacket(entityPacket); + } + public void authenticate(String username) { authenticate(username, ""); } diff --git a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SpawnerBlockEntityTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SpawnerBlockEntityTranslator.java index d1af70d8d..bdcc86f4b 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SpawnerBlockEntityTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/level/block/entity/SpawnerBlockEntityTranslator.java @@ -30,7 +30,7 @@ import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.github.steveice10.opennbt.tag.builtin.Tag; import org.cloudburstmc.nbt.NbtMapBuilder; -import org.geysermc.geyser.entity.EntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityDefinition; import org.geysermc.geyser.registry.Registries; @BlockEntity(type = BlockEntityType.MOB_SPAWNER) @@ -75,7 +75,7 @@ public class SpawnerBlockEntityTranslator extends BlockEntityTranslator { String entityId = idTag.getValue(); builder.put("EntityIdentifier", entityId); - EntityDefinition definition = Registries.JAVA_ENTITY_IDENTIFIERS.get(entityId); + GeyserEntityDefinition definition = Registries.ENTITY_IDENTIFIERS.get(entityId); if (definition != null) { builder.put("DisplayEntityWidth", definition.width()); builder.put("DisplayEntityHeight", definition.height()); diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCommandsTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCommandsTranslator.java index 8b46b4350..739ae9141 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCommandsTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCommandsTranslator.java @@ -324,7 +324,7 @@ public class JavaCommandsTranslator extends PacketTranslator definition = entity.getDefinition(); + GeyserEntityDefinition definition = entity.getDefinition(); for (EntityMetadata metadata : packet.getMetadata()) { if (metadata.getId() >= definition.translators().size()) { if (session.getGeyser().getConfig().isDebugMode()) { @@ -53,7 +53,7 @@ public class JavaSetEntityDataTranslator extends PacketTranslator definition = Registries.ENTITY_DEFINITIONS.get(packet.getType()); + GeyserEntityDefinition definition = Registries.ENTITY_DEFINITIONS.get(packet.getType()); if (definition == null) { session.getGeyser().getLogger().warning("Could not find an entity definition with type " + packet.getType()); return; } + ServerSpawnEntityEvent event = new ServerSpawnEntityEvent(session, packet.getEntityId(), packet.getUuid(), definition); + GeyserImpl.getInstance().eventBus().fire(event); + + GeyserEntityDefinition eventDefinition = (GeyserEntityDefinition) event.entityDefinition(); + + // If the definition is changed, we need to update our current + // definition to reflect that. + if (!eventDefinition.equals(definition)) { + session.getGeyser().getLogger().debug("Replacing entity definition " + definition.identifier() + " with " + eventDefinition.identifier() + " for " + packet.getEntityId() + " (" + packet.getUuid() + ")"); + + definition = definition.toBuilder() + .identifier(eventDefinition.entityIdentifier()) + .width(eventDefinition.width()) + .height(eventDefinition.height()) + .offset(eventDefinition.offset()) + .build(); + } + Entity entity; if (packet.getType() == EntityType.FALLING_BLOCK) { entity = new FallingBlockEntity(session, packet.getEntityId(), session.getEntityCache().getNextEntityId().incrementAndGet(), packet.getUuid(), diff --git a/core/src/main/java/org/geysermc/geyser/util/EntityUtils.java b/core/src/main/java/org/geysermc/geyser/util/EntityUtils.java index a6e0720b6..1cfe47035 100644 --- a/core/src/main/java/org/geysermc/geyser/util/EntityUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/EntityUtils.java @@ -29,16 +29,24 @@ import com.github.steveice10.mc.protocol.data.game.entity.Effect; import com.github.steveice10.mc.protocol.data.game.entity.player.Hand; import com.github.steveice10.mc.protocol.data.game.entity.type.EntityType; import org.cloudburstmc.math.vector.Vector3f; +import org.cloudburstmc.nbt.NbtMap; +import org.cloudburstmc.nbt.NbtType; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; +import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.entity.EntityDefinitions; +import org.geysermc.geyser.entity.GeyserEntityDefinition; +import org.geysermc.geyser.entity.GeyserEntityIdentifier; import org.geysermc.geyser.entity.type.BoatEntity; import org.geysermc.geyser.entity.type.Entity; import org.geysermc.geyser.entity.type.living.ArmorStandEntity; 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.registry.Registries; +import java.util.ArrayList; +import java.util.List; import java.util.Locale; public final class EntityUtils { @@ -233,6 +241,28 @@ public final class EntityUtils { return InteractionResult.PASS; } + public static void registerEntity(String identifier, GeyserEntityDefinition definition) { + if (definition.entityType() != null) { + Registries.ENTITY_DEFINITIONS.get().putIfAbsent(definition.entityType(), definition); + Registries.ENTITY_IDENTIFIERS.get().putIfAbsent(identifier, definition); + } else { + // We're dealing with a custom entity here + Registries.ENTITY_IDENTIFIERS.get().putIfAbsent(identifier, definition); + + // Now let's add it to the entity identifiers + NbtMap nbt = Registries.BEDROCK_ENTITY_IDENTIFIERS.get(); + List idlist = new ArrayList<>(nbt.getList("idlist", NbtType.COMPOUND)); + idlist.add(((GeyserEntityIdentifier) definition.entityIdentifier()).nbt()); + + NbtMap newIdentifiers = nbt.toBuilder() + .putList("idlist", NbtType.COMPOUND, idlist) + .build(); + + Registries.BEDROCK_ENTITY_IDENTIFIERS.set(newIdentifiers); + GeyserImpl.getInstance().getLogger().debug("Registered custom entity " + identifier); + } + } + private EntityUtils() { } }