From e9cee51be2bbd3b6f9fc8c6dbc998627a6bdbb2e Mon Sep 17 00:00:00 2001 From: onebeastchris Date: Sat, 2 Nov 2024 17:06:55 +0800 Subject: [PATCH] Water creatures are now ageable --- .../geyser/entity/EntityDefinitions.java | 37 ++++++++++--------- .../entity/type/living/WaterEntity.java | 2 +- .../org/geysermc/geyser/util/Ordered.java | 33 ----------------- 3 files changed, 21 insertions(+), 51 deletions(-) delete mode 100644 core/src/main/java/org/geysermc/geyser/util/Ordered.java 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 7a92a5fe306..a2586181348 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java +++ b/core/src/main/java/org/geysermc/geyser/entity/EntityDefinitions.java @@ -678,14 +678,6 @@ 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) - .type(EntityType.DOLPHIN) - .height(0.6f).width(0.9f) - //TODO check - .addTranslator(null) // treasure position - .addTranslator(null) // "got fish" - .addTranslator(null) // "moistness level" - .build(); ENDERMAN = EntityDefinition.inherited(EndermanEntity::new, mobEntityBase) .type(EntityType.ENDERMAN) .height(2.9f).width(0.6f) @@ -755,10 +747,6 @@ public final class EntityDefinitions { .type(EntityType.CAVE_SPIDER) .height(0.5f).width(0.7f) .build(); - SQUID = EntityDefinition.inherited(SquidEntity::new, mobEntityBase) - .type(EntityType.SQUID) - .heightAndWidth(0.8f) - .build(); STRAY = EntityDefinition.inherited(AbstractSkeletonEntity::new, mobEntityBase) .type(EntityType.STRAY) .height(1.8f).width(0.6f) @@ -885,11 +873,6 @@ public final class EntityDefinitions { .height(1.95f).width(0.6f) .build(); - GLOW_SQUID = EntityDefinition.inherited(GlowSquidEntity::new, SQUID) - .type(EntityType.GLOW_SQUID) - .addTranslator(null) // Set dark ticks remaining, possible TODO - .build(); - EntityDefinition raidParticipantEntityBase = EntityDefinition.inherited(RaidParticipantEntity::new, mobEntityBase) .addTranslator(null) // Celebrating //TODO .build(); @@ -1081,6 +1064,26 @@ public final class EntityDefinitions { .build(); } + // Water creatures (AgeableWaterCreature) + { + DOLPHIN = EntityDefinition.inherited(DolphinEntity::new, ageableEntityBase) + .type(EntityType.DOLPHIN) + .height(0.6f).width(0.9f) + //TODO check + .addTranslator(null) // treasure position + .addTranslator(null) // "got fish" + .addTranslator(null) // "moistness level" + .build(); + SQUID = EntityDefinition.inherited(SquidEntity::new, ageableEntityBase) + .type(EntityType.SQUID) + .heightAndWidth(0.8f) + .build(); + GLOW_SQUID = EntityDefinition.inherited(GlowSquidEntity::new, SQUID) + .type(EntityType.GLOW_SQUID) + .addTranslator(null) // Set dark ticks remaining, possible TODO + .build(); + } + // Horses { EntityDefinition abstractHorseEntityBase = EntityDefinition.inherited(AbstractHorseEntity::new, ageableEntityBase) 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 ae9d0d6599e..b8fd864b66b 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 @@ -31,7 +31,7 @@ import java.util.UUID; -public class WaterEntity extends CreatureEntity { +public class WaterEntity extends AgeableEntity { public WaterEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition 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/util/Ordered.java b/core/src/main/java/org/geysermc/geyser/util/Ordered.java deleted file mode 100644 index 08ff5df7223..00000000000 --- a/core/src/main/java/org/geysermc/geyser/util/Ordered.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2024 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/Geyser - */ - -package org.geysermc.geyser.util; - -/** - * Represents anything that could be tracked like a enum, without also creating a name and enum-wide array. - */ -public interface Ordered { - int ordinal(); -}