From db42c1bf48e1a92a4fce78a237fe58c7471da20c Mon Sep 17 00:00:00 2001 From: MysticKoko <132279944+MysticKoko@users.noreply.github.com> Date: Mon, 8 Apr 2024 20:33:11 +0200 Subject: [PATCH] File organization and such --- .../mixin/FishingBobberEntityMixin.java | 2 - .../entity/HybridAquaticEntityTypes.kt | 3 +- .../entity/SpawnRestrictionRegistry.kt | 2 +- .../aquatic/entity/ai/goal/CrabDigGoal.kt | 5 +- .../critter/HybridAquaticCritterEntity.kt | 3 +- .../CoconutCrabEntity.kt | 3 +- .../{critter => crustacean}/CrayfishEntity.kt | 3 +- .../DungenessCrabEntity.kt | 3 +- .../FiddlerCrabEntity.kt | 3 +- .../FlowerCrabEntity.kt | 3 +- .../GhostCrabEntity.kt | 3 +- .../GiantIsopodEntity.kt | 3 +- .../HermitCrabEntity.kt | 3 +- .../HorseshoeCrabEntity.kt | 3 +- .../HybridAquaticCrabEntity.kt | 3 +- .../{critter => crustacean}/KarkinosEntity.kt | 3 +- .../LightfootCrabEntity.kt | 3 +- .../{critter => crustacean}/LobsterEntity.kt | 3 +- .../{critter => crustacean}/ShrimpEntity.kt | 3 +- .../SpiderCrabEntity.kt | 3 +- .../VampireCrabEntity.kt | 3 +- .../{critter => crustacean}/YetiCrabEntity.kt | 3 +- .../entity/fish/BlueSpottedStingrayEntity.kt | 2 +- .../aquatic/entity/fish/ClownfishEntity.kt | 106 +++++++----------- .../entity/fish/HybridAquaticFishEntity.kt | 2 +- .../aquatic/entity/fish/SeahorseEntity.kt | 44 ++++++++ 26 files changed, 125 insertions(+), 95 deletions(-) rename src/main/kotlin/dev/hybridlabs/aquatic/entity/{critter => crustacean}/CoconutCrabEntity.kt (88%) rename src/main/kotlin/dev/hybridlabs/aquatic/entity/{critter => crustacean}/CrayfishEntity.kt (88%) rename src/main/kotlin/dev/hybridlabs/aquatic/entity/{critter => crustacean}/DungenessCrabEntity.kt (88%) rename src/main/kotlin/dev/hybridlabs/aquatic/entity/{critter => crustacean}/FiddlerCrabEntity.kt (89%) rename src/main/kotlin/dev/hybridlabs/aquatic/entity/{critter => crustacean}/FlowerCrabEntity.kt (88%) rename src/main/kotlin/dev/hybridlabs/aquatic/entity/{critter => crustacean}/GhostCrabEntity.kt (88%) rename src/main/kotlin/dev/hybridlabs/aquatic/entity/{critter => crustacean}/GiantIsopodEntity.kt (88%) rename src/main/kotlin/dev/hybridlabs/aquatic/entity/{critter => crustacean}/HermitCrabEntity.kt (96%) rename src/main/kotlin/dev/hybridlabs/aquatic/entity/{critter => crustacean}/HorseshoeCrabEntity.kt (88%) rename src/main/kotlin/dev/hybridlabs/aquatic/entity/{critter => crustacean}/HybridAquaticCrabEntity.kt (97%) rename src/main/kotlin/dev/hybridlabs/aquatic/entity/{critter => crustacean}/KarkinosEntity.kt (98%) rename src/main/kotlin/dev/hybridlabs/aquatic/entity/{critter => crustacean}/LightfootCrabEntity.kt (88%) rename src/main/kotlin/dev/hybridlabs/aquatic/entity/{critter => crustacean}/LobsterEntity.kt (88%) rename src/main/kotlin/dev/hybridlabs/aquatic/entity/{critter => crustacean}/ShrimpEntity.kt (87%) rename src/main/kotlin/dev/hybridlabs/aquatic/entity/{critter => crustacean}/SpiderCrabEntity.kt (88%) rename src/main/kotlin/dev/hybridlabs/aquatic/entity/{critter => crustacean}/VampireCrabEntity.kt (88%) rename src/main/kotlin/dev/hybridlabs/aquatic/entity/{critter => crustacean}/YetiCrabEntity.kt (95%) diff --git a/src/main/java/dev/hybridlabs/aquatic/mixin/FishingBobberEntityMixin.java b/src/main/java/dev/hybridlabs/aquatic/mixin/FishingBobberEntityMixin.java index 41d046cc0..e573be7a6 100644 --- a/src/main/java/dev/hybridlabs/aquatic/mixin/FishingBobberEntityMixin.java +++ b/src/main/java/dev/hybridlabs/aquatic/mixin/FishingBobberEntityMixin.java @@ -4,7 +4,6 @@ import dev.hybridlabs.aquatic.enchantment.HybridAquaticEnchantments; import dev.hybridlabs.aquatic.enchantment.LiveCatchEnchantment; import dev.hybridlabs.aquatic.entity.HybridAquaticEntityTypes; -import dev.hybridlabs.aquatic.entity.critter.KarkinosEntity; import dev.hybridlabs.aquatic.item.HybridAquaticItems; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; @@ -28,7 +27,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; -import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/entity/HybridAquaticEntityTypes.kt b/src/main/kotlin/dev/hybridlabs/aquatic/entity/HybridAquaticEntityTypes.kt index a0dc63e2a..2c6aa3f1b 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/entity/HybridAquaticEntityTypes.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/entity/HybridAquaticEntityTypes.kt @@ -2,6 +2,7 @@ package dev.hybridlabs.aquatic.entity import dev.hybridlabs.aquatic.HybridAquatic import dev.hybridlabs.aquatic.entity.critter.* +import dev.hybridlabs.aquatic.entity.crustacean.* import dev.hybridlabs.aquatic.entity.fish.* import dev.hybridlabs.aquatic.entity.jellyfish.* import dev.hybridlabs.aquatic.entity.shark.* @@ -55,7 +56,7 @@ object HybridAquaticEntityTypes { "clownfish", ::ClownfishEntity, EntityDimensions.fixed(0.4f, 0.35f), - ClownfishEntity.createClownfishAttributes() + ClownfishEntity.createMobAttributes() ) val COWFISH = registerFish( diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/entity/SpawnRestrictionRegistry.kt b/src/main/kotlin/dev/hybridlabs/aquatic/entity/SpawnRestrictionRegistry.kt index 3b1678ba2..770b9b640 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/entity/SpawnRestrictionRegistry.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/entity/SpawnRestrictionRegistry.kt @@ -1,6 +1,6 @@ package dev.hybridlabs.aquatic.entity -import dev.hybridlabs.aquatic.entity.critter.HybridAquaticCrabEntity +import dev.hybridlabs.aquatic.entity.crustacean.HybridAquaticCrabEntity import dev.hybridlabs.aquatic.entity.critter.HybridAquaticCritterEntity import dev.hybridlabs.aquatic.entity.fish.HybridAquaticFishEntity import dev.hybridlabs.aquatic.entity.jellyfish.HybridAquaticJellyfishEntity diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/entity/ai/goal/CrabDigGoal.kt b/src/main/kotlin/dev/hybridlabs/aquatic/entity/ai/goal/CrabDigGoal.kt index e52f2cac2..e2c33f9ce 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/entity/ai/goal/CrabDigGoal.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/entity/ai/goal/CrabDigGoal.kt @@ -1,10 +1,9 @@ package dev.hybridlabs.aquatic.entity.ai.goal -import dev.hybridlabs.aquatic.entity.critter.HybridAquaticCrabEntity +import dev.hybridlabs.aquatic.entity.crustacean.HybridAquaticCrabEntity import dev.hybridlabs.aquatic.loot.HybridAquaticLootTables import dev.hybridlabs.aquatic.tag.HybridAquaticBlockTags import net.minecraft.block.BlockState -import net.minecraft.entity.Entity import net.minecraft.entity.ItemEntity import net.minecraft.entity.ai.goal.Goal import net.minecraft.item.ItemStack @@ -13,8 +12,6 @@ import net.minecraft.loot.context.LootContextParameters import net.minecraft.loot.context.LootContextTypes import net.minecraft.particle.ParticleTypes import net.minecraft.server.world.ServerWorld -import net.minecraft.util.math.Vec3d -import net.minecraft.world.World import java.util.* class CrabDigGoal( diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/HybridAquaticCritterEntity.kt b/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/HybridAquaticCritterEntity.kt index b2cedbcab..9d809cd06 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/HybridAquaticCritterEntity.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/HybridAquaticCritterEntity.kt @@ -96,12 +96,11 @@ open class HybridAquaticCritterEntity(type: EntityType predicate(event: AnimationState): PlayState { - if (event.isMoving && isOnGround) { + if (event.isMoving) { event.controller.setAnimation(WALK_ANIMATION) } else { event.controller.setAnimation(IDLE_ANIMATION) } - return PlayState.CONTINUE } diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/CoconutCrabEntity.kt b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/CoconutCrabEntity.kt similarity index 88% rename from src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/CoconutCrabEntity.kt rename to src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/CoconutCrabEntity.kt index eddcd44e6..fbc4dde4a 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/CoconutCrabEntity.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/CoconutCrabEntity.kt @@ -1,5 +1,6 @@ -package dev.hybridlabs.aquatic.entity.critter +package dev.hybridlabs.aquatic.entity.crustacean +import dev.hybridlabs.aquatic.entity.critter.HybridAquaticCritterEntity import net.minecraft.entity.EntityType import net.minecraft.entity.attribute.DefaultAttributeContainer import net.minecraft.entity.attribute.EntityAttributes diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/CrayfishEntity.kt b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/CrayfishEntity.kt similarity index 88% rename from src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/CrayfishEntity.kt rename to src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/CrayfishEntity.kt index 3d7eb9f9d..442416f80 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/CrayfishEntity.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/CrayfishEntity.kt @@ -1,5 +1,6 @@ -package dev.hybridlabs.aquatic.entity.critter +package dev.hybridlabs.aquatic.entity.crustacean +import dev.hybridlabs.aquatic.entity.critter.HybridAquaticCritterEntity import net.minecraft.entity.EntityType import net.minecraft.entity.attribute.DefaultAttributeContainer import net.minecraft.entity.attribute.EntityAttributes diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/DungenessCrabEntity.kt b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/DungenessCrabEntity.kt similarity index 88% rename from src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/DungenessCrabEntity.kt rename to src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/DungenessCrabEntity.kt index c51c4827a..14ab8abb2 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/DungenessCrabEntity.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/DungenessCrabEntity.kt @@ -1,5 +1,6 @@ -package dev.hybridlabs.aquatic.entity.critter +package dev.hybridlabs.aquatic.entity.crustacean +import dev.hybridlabs.aquatic.entity.critter.HybridAquaticCritterEntity import net.minecraft.entity.EntityType import net.minecraft.entity.attribute.DefaultAttributeContainer import net.minecraft.entity.attribute.EntityAttributes diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/FiddlerCrabEntity.kt b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/FiddlerCrabEntity.kt similarity index 89% rename from src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/FiddlerCrabEntity.kt rename to src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/FiddlerCrabEntity.kt index 481e60200..2e50ea2c4 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/FiddlerCrabEntity.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/FiddlerCrabEntity.kt @@ -1,5 +1,6 @@ -package dev.hybridlabs.aquatic.entity.critter +package dev.hybridlabs.aquatic.entity.crustacean +import dev.hybridlabs.aquatic.entity.critter.HybridAquaticCritterEntity import net.minecraft.entity.EntityGroup import net.minecraft.entity.EntityType import net.minecraft.entity.attribute.DefaultAttributeContainer diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/FlowerCrabEntity.kt b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/FlowerCrabEntity.kt similarity index 88% rename from src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/FlowerCrabEntity.kt rename to src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/FlowerCrabEntity.kt index a0606c215..98e591d8f 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/FlowerCrabEntity.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/FlowerCrabEntity.kt @@ -1,5 +1,6 @@ -package dev.hybridlabs.aquatic.entity.critter +package dev.hybridlabs.aquatic.entity.crustacean +import dev.hybridlabs.aquatic.entity.critter.HybridAquaticCritterEntity import net.minecraft.entity.EntityType import net.minecraft.entity.attribute.DefaultAttributeContainer import net.minecraft.entity.attribute.EntityAttributes diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/GhostCrabEntity.kt b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/GhostCrabEntity.kt similarity index 88% rename from src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/GhostCrabEntity.kt rename to src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/GhostCrabEntity.kt index ca1faf51a..7a1d1489f 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/GhostCrabEntity.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/GhostCrabEntity.kt @@ -1,5 +1,6 @@ -package dev.hybridlabs.aquatic.entity.critter +package dev.hybridlabs.aquatic.entity.crustacean +import dev.hybridlabs.aquatic.entity.critter.HybridAquaticCritterEntity import net.minecraft.entity.EntityType import net.minecraft.entity.attribute.DefaultAttributeContainer import net.minecraft.entity.attribute.EntityAttributes diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/GiantIsopodEntity.kt b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/GiantIsopodEntity.kt similarity index 88% rename from src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/GiantIsopodEntity.kt rename to src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/GiantIsopodEntity.kt index 5467515ae..c4d6e0fae 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/GiantIsopodEntity.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/GiantIsopodEntity.kt @@ -1,5 +1,6 @@ -package dev.hybridlabs.aquatic.entity.critter +package dev.hybridlabs.aquatic.entity.crustacean +import dev.hybridlabs.aquatic.entity.critter.HybridAquaticCritterEntity import net.minecraft.entity.EntityType import net.minecraft.entity.attribute.DefaultAttributeContainer import net.minecraft.entity.attribute.EntityAttributes diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/HermitCrabEntity.kt b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/HermitCrabEntity.kt similarity index 96% rename from src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/HermitCrabEntity.kt rename to src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/HermitCrabEntity.kt index 1ad002cc5..d8de82cb2 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/HermitCrabEntity.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/HermitCrabEntity.kt @@ -1,6 +1,7 @@ -package dev.hybridlabs.aquatic.entity.critter +package dev.hybridlabs.aquatic.entity.crustacean import dev.hybridlabs.aquatic.entity.ai.goal.CrabDigGoal +import dev.hybridlabs.aquatic.entity.critter.HybridAquaticCritterEntity import net.minecraft.entity.EntityGroup import net.minecraft.entity.EntityType import net.minecraft.entity.attribute.DefaultAttributeContainer diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/HorseshoeCrabEntity.kt b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/HorseshoeCrabEntity.kt similarity index 88% rename from src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/HorseshoeCrabEntity.kt rename to src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/HorseshoeCrabEntity.kt index 511143852..4b2fb29ed 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/HorseshoeCrabEntity.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/HorseshoeCrabEntity.kt @@ -1,5 +1,6 @@ -package dev.hybridlabs.aquatic.entity.critter +package dev.hybridlabs.aquatic.entity.crustacean +import dev.hybridlabs.aquatic.entity.critter.HybridAquaticCritterEntity import net.minecraft.entity.EntityType import net.minecraft.entity.attribute.DefaultAttributeContainer import net.minecraft.entity.attribute.EntityAttributes diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/HybridAquaticCrabEntity.kt b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/HybridAquaticCrabEntity.kt similarity index 97% rename from src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/HybridAquaticCrabEntity.kt rename to src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/HybridAquaticCrabEntity.kt index 9953f27fd..1fcf22fab 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/HybridAquaticCrabEntity.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/HybridAquaticCrabEntity.kt @@ -1,5 +1,6 @@ -package dev.hybridlabs.aquatic.entity.critter +package dev.hybridlabs.aquatic.entity.crustacean +import dev.hybridlabs.aquatic.entity.critter.HybridAquaticCritterEntity import dev.hybridlabs.aquatic.tag.HybridAquaticBlockTags import net.minecraft.block.Blocks import net.minecraft.entity.EntityGroup diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/KarkinosEntity.kt b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/KarkinosEntity.kt similarity index 98% rename from src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/KarkinosEntity.kt rename to src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/KarkinosEntity.kt index c7782e156..4eaeca28e 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/KarkinosEntity.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/KarkinosEntity.kt @@ -1,5 +1,6 @@ -package dev.hybridlabs.aquatic.entity.critter +package dev.hybridlabs.aquatic.entity.crustacean +import dev.hybridlabs.aquatic.entity.critter.HybridAquaticCritterEntity import net.minecraft.enchantment.EnchantmentHelper import net.minecraft.enchantment.Enchantments import net.minecraft.entity.EntityType diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/LightfootCrabEntity.kt b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/LightfootCrabEntity.kt similarity index 88% rename from src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/LightfootCrabEntity.kt rename to src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/LightfootCrabEntity.kt index c0839ab1b..40eb03b58 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/LightfootCrabEntity.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/LightfootCrabEntity.kt @@ -1,5 +1,6 @@ -package dev.hybridlabs.aquatic.entity.critter +package dev.hybridlabs.aquatic.entity.crustacean +import dev.hybridlabs.aquatic.entity.critter.HybridAquaticCritterEntity import net.minecraft.entity.EntityType import net.minecraft.entity.attribute.DefaultAttributeContainer import net.minecraft.entity.attribute.EntityAttributes diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/LobsterEntity.kt b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/LobsterEntity.kt similarity index 88% rename from src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/LobsterEntity.kt rename to src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/LobsterEntity.kt index a02e0c53d..a34c4a092 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/LobsterEntity.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/LobsterEntity.kt @@ -1,5 +1,6 @@ -package dev.hybridlabs.aquatic.entity.critter +package dev.hybridlabs.aquatic.entity.crustacean +import dev.hybridlabs.aquatic.entity.critter.HybridAquaticCritterEntity import net.minecraft.entity.EntityType import net.minecraft.entity.attribute.DefaultAttributeContainer import net.minecraft.entity.attribute.EntityAttributes diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/ShrimpEntity.kt b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/ShrimpEntity.kt similarity index 87% rename from src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/ShrimpEntity.kt rename to src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/ShrimpEntity.kt index 7ee3ebdac..e2264f068 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/ShrimpEntity.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/ShrimpEntity.kt @@ -1,5 +1,6 @@ -package dev.hybridlabs.aquatic.entity.critter +package dev.hybridlabs.aquatic.entity.crustacean +import dev.hybridlabs.aquatic.entity.critter.HybridAquaticCritterEntity import net.minecraft.entity.EntityType import net.minecraft.entity.attribute.DefaultAttributeContainer import net.minecraft.entity.attribute.EntityAttributes diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/SpiderCrabEntity.kt b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/SpiderCrabEntity.kt similarity index 88% rename from src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/SpiderCrabEntity.kt rename to src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/SpiderCrabEntity.kt index 69e5f7ed0..5eebd0d45 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/SpiderCrabEntity.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/SpiderCrabEntity.kt @@ -1,5 +1,6 @@ -package dev.hybridlabs.aquatic.entity.critter +package dev.hybridlabs.aquatic.entity.crustacean +import dev.hybridlabs.aquatic.entity.critter.HybridAquaticCritterEntity import net.minecraft.entity.EntityType import net.minecraft.entity.attribute.DefaultAttributeContainer import net.minecraft.entity.attribute.EntityAttributes diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/VampireCrabEntity.kt b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/VampireCrabEntity.kt similarity index 88% rename from src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/VampireCrabEntity.kt rename to src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/VampireCrabEntity.kt index a7de53679..f2e28b252 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/VampireCrabEntity.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/VampireCrabEntity.kt @@ -1,5 +1,6 @@ -package dev.hybridlabs.aquatic.entity.critter +package dev.hybridlabs.aquatic.entity.crustacean +import dev.hybridlabs.aquatic.entity.critter.HybridAquaticCritterEntity import net.minecraft.entity.EntityType import net.minecraft.entity.attribute.DefaultAttributeContainer import net.minecraft.entity.attribute.EntityAttributes diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/YetiCrabEntity.kt b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/YetiCrabEntity.kt similarity index 95% rename from src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/YetiCrabEntity.kt rename to src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/YetiCrabEntity.kt index 8c8ff0d0b..7729ce0c5 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/entity/critter/YetiCrabEntity.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/entity/crustacean/YetiCrabEntity.kt @@ -1,6 +1,7 @@ -package dev.hybridlabs.aquatic.entity.critter +package dev.hybridlabs.aquatic.entity.crustacean import dev.hybridlabs.aquatic.block.HybridAquaticBlocks +import dev.hybridlabs.aquatic.entity.critter.HybridAquaticCritterEntity import net.minecraft.entity.EntityType import net.minecraft.entity.attribute.DefaultAttributeContainer import net.minecraft.entity.attribute.EntityAttributes diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/entity/fish/BlueSpottedStingrayEntity.kt b/src/main/kotlin/dev/hybridlabs/aquatic/entity/fish/BlueSpottedStingrayEntity.kt index 0befa1ed8..e4ee3520b 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/entity/fish/BlueSpottedStingrayEntity.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/entity/fish/BlueSpottedStingrayEntity.kt @@ -18,7 +18,7 @@ class BlueSpottedStingrayEntity(entityType: EntityType, world: World) : HybridAquaticFishEntity(entityType, world) { - private val isAttacked = false + private var targetAnemonePos: BlockPos? = null - override fun initGoals() { - goalSelector.add(2, GoalHideInAnemone(this)) - super.initGoals() + companion object { + fun createMobAttributes(): DefaultAttributeContainer.Builder { + return WaterCreatureEntity.createMobAttributes() + .add(EntityAttributes.GENERIC_MAX_HEALTH, 2.0) + .add(EntityAttributes.GENERIC_MOVEMENT_SPEED, 0.6) + } } - class GoalHideInAnemone(private val clownfish: ClownfishEntity) : Goal() { - private var targetAnemonePos: BlockPos? = null + override fun getMaxSize(): Int { + return 5 + } - init { - controls = EnumSet.of(Control.MOVE) - } + override fun getMinSize(): Int { + return -5 + } - override fun canStart(): Boolean { - return clownfish.attacker != null - } + override fun tick() { + super.tick() - override fun start() { - findNearestAnemone()?.let { nearestAnemonePos -> - targetAnemonePos = nearestAnemonePos - clownfish.getNavigation().startMovingTo( - nearestAnemonePos.x.toDouble(), - nearestAnemonePos.y.toDouble(), - nearestAnemonePos.z.toDouble(), - 1.0 - ) - } + if (targetAnemonePos == null || world.getBlockState(targetAnemonePos).isOf(HybridAquaticBlocks.ANEMONE)) { + targetAnemonePos = findNearbyAnemone() } - override fun shouldContinue(): Boolean { - return targetAnemonePos != null && clownfish.isAlive && clownfish.isAttacked - } + if (targetAnemonePos != null) { + val distanceToAnemone = distanceTo(targetAnemonePos!!) - override fun tick() { - targetAnemonePos?.let { pos -> - clownfish.getNavigation().startMovingTo( - pos.x.toDouble(), - pos.y.toDouble(), - pos.z.toDouble(), - 1.0 - ) + if (distanceToAnemone > 5.0) { + navigateToAnemone(targetAnemonePos!!) } } + } - override fun stop() { - targetAnemonePos = null - clownfish.getNavigation().stop() - } + private fun navigateToAnemone(ventBlockPos: BlockPos) { + this.navigation.startMovingTo(ventBlockPos.x.toDouble(), ventBlockPos.y.toDouble(), ventBlockPos.z.toDouble(), this.getAttributeValue(EntityAttributes.GENERIC_MOVEMENT_SPEED)) + } - private fun findNearestAnemone(): BlockPos? { - val currentPos = clownfish.blockPos - for (i in -8..8) { - for (j in -8..8) { - for (k in -8..8) { - val checkPos = currentPos.add(i, j, k) - val block = clownfish.world.getBlockState(checkPos).block - if (block === ANEMONE) { - return checkPos - } + private fun findNearbyAnemone(): BlockPos? { + for (i in -5..5) { + for (j in -5..5) { + for (k in -5..5) { + val blockPos = BlockPos((x + i).toInt(), (y + j).toInt(), (z + k).toInt()) + val blockState = world.getBlockState(blockPos) + + if (blockState.isOf(HybridAquaticBlocks.ANEMONE)) { + return blockPos } } } - return null - } - } - - companion object { - fun createClownfishAttributes(): DefaultAttributeContainer.Builder { - return createMobAttributes() - .add(EntityAttributes.GENERIC_MAX_HEALTH, 4.0) - .add(EntityAttributes.GENERIC_MOVEMENT_SPEED, 0.6) } + return null } - override fun getMaxSize(): Int { - return 5 - } - - override fun getMinSize(): Int { - return -5 + private fun distanceTo(pos: BlockPos): Double { + return this.blockPos.getSquaredDistance(pos.x.toDouble(), pos.y.toDouble(), pos.z.toDouble()) } -} +} \ No newline at end of file diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/entity/fish/HybridAquaticFishEntity.kt b/src/main/kotlin/dev/hybridlabs/aquatic/entity/fish/HybridAquaticFishEntity.kt index cc042eb5d..79d115816 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/entity/fish/HybridAquaticFishEntity.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/entity/fish/HybridAquaticFishEntity.kt @@ -251,7 +251,7 @@ open class HybridAquaticFishEntity( init { moveControl = FishMoveControl(this) - lookControl = YawAdjustingLookControl(this, 5) + lookControl = YawAdjustingLookControl(this, 20) } override fun tickMovement() { diff --git a/src/main/kotlin/dev/hybridlabs/aquatic/entity/fish/SeahorseEntity.kt b/src/main/kotlin/dev/hybridlabs/aquatic/entity/fish/SeahorseEntity.kt index aad00bab1..b0ebb7f28 100644 --- a/src/main/kotlin/dev/hybridlabs/aquatic/entity/fish/SeahorseEntity.kt +++ b/src/main/kotlin/dev/hybridlabs/aquatic/entity/fish/SeahorseEntity.kt @@ -4,11 +4,15 @@ import net.minecraft.entity.EntityType import net.minecraft.entity.attribute.DefaultAttributeContainer import net.minecraft.entity.attribute.EntityAttributes import net.minecraft.entity.mob.WaterCreatureEntity +import net.minecraft.registry.tag.BlockTags +import net.minecraft.util.math.BlockPos import net.minecraft.world.World class SeahorseEntity(entityType: EntityType, world: World) : HybridAquaticFishEntity(entityType, world, 6) { + private var targetCoralPos: BlockPos? = null + companion object { fun createMobAttributes(): DefaultAttributeContainer.Builder { return WaterCreatureEntity.createMobAttributes() @@ -24,4 +28,44 @@ class SeahorseEntity(entityType: EntityType, world: World) : override fun getMinSize(): Int { return -5 } + + override fun tick() { + super.tick() + + if (targetCoralPos == null || world.getBlockState(targetCoralPos).isIn(BlockTags.CORAL_PLANTS)) { + targetCoralPos = findNearbyCoralFan() + } + + if (targetCoralPos != null) { + val distanceToCoral = distanceTo(targetCoralPos!!) + + if (distanceToCoral > 5.0) { + navigateToCoral(targetCoralPos!!) + } + } + } + + private fun navigateToCoral(ventBlockPos: BlockPos) { + this.navigation.startMovingTo(ventBlockPos.x.toDouble(), ventBlockPos.y.toDouble(), ventBlockPos.z.toDouble(), this.getAttributeValue(EntityAttributes.GENERIC_MOVEMENT_SPEED)) + } + + private fun findNearbyCoralFan(): BlockPos? { + for (i in -5..5) { + for (j in -5..5) { + for (k in -5..5) { + val blockPos = BlockPos((x + i).toInt(), (y + j).toInt(), (z + k).toInt()) + val blockState = world.getBlockState(blockPos) + + if (blockState.isIn(BlockTags.CORAL_PLANTS)) { + return blockPos + } + } + } + } + return null + } + + private fun distanceTo(pos: BlockPos): Double { + return this.blockPos.getSquaredDistance(pos.x.toDouble(), pos.y.toDouble(), pos.z.toDouble()) + } } \ No newline at end of file