diff --git a/src/main/java/com/ninni/spawn/entity/AnglerFish.java b/src/main/java/com/ninni/spawn/entity/AnglerFish.java index b200ea3..ff4661f 100644 --- a/src/main/java/com/ninni/spawn/entity/AnglerFish.java +++ b/src/main/java/com/ninni/spawn/entity/AnglerFish.java @@ -48,6 +48,8 @@ public class AnglerFish extends AbstractFish implements Bucketable, PathFindingF public AnglerFish(EntityType type, Level world) { super(type, world); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02f, 0.1f, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); } public boolean isDeflated() { diff --git a/src/main/java/com/ninni/spawn/entity/Herring.java b/src/main/java/com/ninni/spawn/entity/Herring.java index 4195db5..1592771 100644 --- a/src/main/java/com/ninni/spawn/entity/Herring.java +++ b/src/main/java/com/ninni/spawn/entity/Herring.java @@ -17,6 +17,8 @@ import net.minecraft.world.entity.SpawnGroupData; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.control.SmoothSwimmingLookControl; +import net.minecraft.world.entity.ai.control.SmoothSwimmingMoveControl; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.ServerLevelAccessor; @@ -26,6 +28,8 @@ public class Herring extends BoidFishEntity { private static final EntityDataAccessor SCHOOL_SIZE = SynchedEntityData.defineId(Herring.class, EntityDataSerializers.INT); public Herring(EntityType entityType, Level level) { super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02f, 0.1f, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); } @Override diff --git a/src/main/java/com/ninni/spawn/mixin/AbstractFishMixin.java b/src/main/java/com/ninni/spawn/mixin/AbstractFishMixin.java index 7ccf62c..0044642 100644 --- a/src/main/java/com/ninni/spawn/mixin/AbstractFishMixin.java +++ b/src/main/java/com/ninni/spawn/mixin/AbstractFishMixin.java @@ -18,16 +18,6 @@ private AbstractFishMixin(EntityType entityType, Level wo super(entityType, world); } - - @Inject(method = "", at = @At("TAIL")) - private void S$init(EntityType entityType, Level level, CallbackInfo ci) { - AbstractFish that = AbstractFish.class.cast(this); - if ((that instanceof Cod) || (that instanceof Salmon) || (that instanceof TropicalFish)) { - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02f, 0.1f, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - } - @Inject(method = "aiStep", at = @At("HEAD"), cancellable = true) private void S$aiStep(CallbackInfo ci) { AbstractFish that = AbstractFish.class.cast(this); diff --git a/src/main/java/com/ninni/spawn/mixin/tweaks/CodMixin.java b/src/main/java/com/ninni/spawn/mixin/tweaks/CodMixin.java new file mode 100644 index 0000000..9605530 --- /dev/null +++ b/src/main/java/com/ninni/spawn/mixin/tweaks/CodMixin.java @@ -0,0 +1,24 @@ +package com.ninni.spawn.mixin.tweaks; + +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.ai.control.SmoothSwimmingLookControl; +import net.minecraft.world.entity.ai.control.SmoothSwimmingMoveControl; +import net.minecraft.world.entity.animal.*; +import net.minecraft.world.level.Level; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(Cod.class) +public abstract class CodMixin extends AbstractSchoolingFish { + protected CodMixin(EntityType entityType, Level level) { + super(entityType, level); + } + + @Inject(method = "", at = @At("TAIL")) + private void S$init(EntityType entityType, Level level, CallbackInfo ci) { + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02f, 0.1f, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } +} diff --git a/src/main/java/com/ninni/spawn/mixin/RabbitMixin.java b/src/main/java/com/ninni/spawn/mixin/tweaks/RabbitMixin.java similarity index 95% rename from src/main/java/com/ninni/spawn/mixin/RabbitMixin.java rename to src/main/java/com/ninni/spawn/mixin/tweaks/RabbitMixin.java index 0625ece..2ee493b 100644 --- a/src/main/java/com/ninni/spawn/mixin/RabbitMixin.java +++ b/src/main/java/com/ninni/spawn/mixin/tweaks/RabbitMixin.java @@ -1,4 +1,4 @@ -package com.ninni.spawn.mixin; +package com.ninni.spawn.mixin.tweaks; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.VariantHolder; diff --git a/src/main/java/com/ninni/spawn/mixin/tweaks/SalmonMixin.java b/src/main/java/com/ninni/spawn/mixin/tweaks/SalmonMixin.java new file mode 100644 index 0000000..d08a27c --- /dev/null +++ b/src/main/java/com/ninni/spawn/mixin/tweaks/SalmonMixin.java @@ -0,0 +1,24 @@ +package com.ninni.spawn.mixin.tweaks; + +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.ai.control.SmoothSwimmingLookControl; +import net.minecraft.world.entity.ai.control.SmoothSwimmingMoveControl; +import net.minecraft.world.entity.animal.*; +import net.minecraft.world.level.Level; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(Salmon.class) +public abstract class SalmonMixin extends AbstractSchoolingFish { + protected SalmonMixin(EntityType entityType, Level level) { + super(entityType, level); + } + + @Inject(method = "", at = @At("TAIL")) + private void S$init(EntityType entityType, Level level, CallbackInfo ci) { + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02f, 0.1f, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } +} diff --git a/src/main/java/com/ninni/spawn/mixin/tweaks/TropicalFishMixin.java b/src/main/java/com/ninni/spawn/mixin/tweaks/TropicalFishMixin.java new file mode 100644 index 0000000..fd58209 --- /dev/null +++ b/src/main/java/com/ninni/spawn/mixin/tweaks/TropicalFishMixin.java @@ -0,0 +1,24 @@ +package com.ninni.spawn.mixin.tweaks; + +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.ai.control.SmoothSwimmingLookControl; +import net.minecraft.world.entity.ai.control.SmoothSwimmingMoveControl; +import net.minecraft.world.entity.animal.*; +import net.minecraft.world.level.Level; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(TropicalFish.class) +public abstract class TropicalFishMixin extends AbstractSchoolingFish { + protected TropicalFishMixin(EntityType entityType, Level level) { + super(entityType, level); + } + + @Inject(method = "", at = @At("TAIL")) + private void S$init(EntityType entityType, Level level, CallbackInfo ci) { + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02f, 0.1f, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } +} diff --git a/src/main/java/com/ninni/spawn/mixin/client/BatRendererMixin.java b/src/main/java/com/ninni/spawn/mixin/tweaks/client/BatRendererMixin.java similarity index 88% rename from src/main/java/com/ninni/spawn/mixin/client/BatRendererMixin.java rename to src/main/java/com/ninni/spawn/mixin/tweaks/client/BatRendererMixin.java index f937931..7bdf845 100644 --- a/src/main/java/com/ninni/spawn/mixin/client/BatRendererMixin.java +++ b/src/main/java/com/ninni/spawn/mixin/tweaks/client/BatRendererMixin.java @@ -1,21 +1,17 @@ -package com.ninni.spawn.mixin.client; +package com.ninni.spawn.mixin.tweaks.client; import com.mojang.blaze3d.vertex.PoseStack; import com.ninni.spawn.SpawnRPTweaks; import com.ninni.spawn.client.model.BatRemodel; -import com.ninni.spawn.client.model.RabbitRemodel; import com.ninni.spawn.registry.SpawnEntityModelLayers; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.model.BatModel; -import net.minecraft.client.model.RabbitModel; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.BatRenderer; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.entity.MobRenderer; -import net.minecraft.client.renderer.entity.RabbitRenderer; import net.minecraft.world.entity.ambient.Bat; -import net.minecraft.world.entity.animal.Rabbit; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; diff --git a/src/main/java/com/ninni/spawn/mixin/client/CodModelMixin.java b/src/main/java/com/ninni/spawn/mixin/tweaks/client/CodModelMixin.java similarity index 98% rename from src/main/java/com/ninni/spawn/mixin/client/CodModelMixin.java rename to src/main/java/com/ninni/spawn/mixin/tweaks/client/CodModelMixin.java index a3f81e7..a4b723e 100644 --- a/src/main/java/com/ninni/spawn/mixin/client/CodModelMixin.java +++ b/src/main/java/com/ninni/spawn/mixin/tweaks/client/CodModelMixin.java @@ -1,9 +1,8 @@ -package com.ninni.spawn.mixin.client; +package com.ninni.spawn.mixin.tweaks.client; import com.ninni.spawn.SpawnRPTweaks; import net.minecraft.client.model.CodModel; import net.minecraft.client.model.HierarchicalModel; -import net.minecraft.client.model.SalmonModel; import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.builders.CubeListBuilder; diff --git a/src/main/java/com/ninni/spawn/mixin/client/ParrotOnShoulderLayerMixin.java b/src/main/java/com/ninni/spawn/mixin/tweaks/client/ParrotOnShoulderLayerMixin.java similarity index 94% rename from src/main/java/com/ninni/spawn/mixin/client/ParrotOnShoulderLayerMixin.java rename to src/main/java/com/ninni/spawn/mixin/tweaks/client/ParrotOnShoulderLayerMixin.java index 1e54623..a833791 100644 --- a/src/main/java/com/ninni/spawn/mixin/client/ParrotOnShoulderLayerMixin.java +++ b/src/main/java/com/ninni/spawn/mixin/tweaks/client/ParrotOnShoulderLayerMixin.java @@ -1,4 +1,4 @@ -package com.ninni.spawn.mixin.client; +package com.ninni.spawn.mixin.tweaks.client; import com.mojang.blaze3d.vertex.PoseStack; import com.ninni.spawn.SpawnRPTweaks; @@ -6,7 +6,6 @@ import com.ninni.spawn.registry.SpawnEntityModelLayers; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.Minecraft; import net.minecraft.client.model.ParrotModel; import net.minecraft.client.model.PlayerModel; import net.minecraft.client.model.geom.EntityModelSet; @@ -14,7 +13,6 @@ import net.minecraft.client.renderer.entity.RenderLayerParent; import net.minecraft.client.renderer.entity.layers.ParrotOnShoulderLayer; import net.minecraft.client.renderer.entity.layers.RenderLayer; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Player; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; diff --git a/src/main/java/com/ninni/spawn/mixin/client/ParrotRendererMixin.java b/src/main/java/com/ninni/spawn/mixin/tweaks/client/ParrotRendererMixin.java similarity index 93% rename from src/main/java/com/ninni/spawn/mixin/client/ParrotRendererMixin.java rename to src/main/java/com/ninni/spawn/mixin/tweaks/client/ParrotRendererMixin.java index ec43ba4..c1af7c9 100644 --- a/src/main/java/com/ninni/spawn/mixin/client/ParrotRendererMixin.java +++ b/src/main/java/com/ninni/spawn/mixin/tweaks/client/ParrotRendererMixin.java @@ -1,4 +1,4 @@ -package com.ninni.spawn.mixin.client; +package com.ninni.spawn.mixin.tweaks.client; import com.mojang.blaze3d.vertex.PoseStack; import com.ninni.spawn.SpawnRPTweaks; @@ -6,13 +6,11 @@ import com.ninni.spawn.registry.SpawnEntityModelLayers; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.Minecraft; import net.minecraft.client.model.ParrotModel; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.entity.MobRenderer; import net.minecraft.client.renderer.entity.ParrotRenderer; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.animal.Parrot; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; diff --git a/src/main/java/com/ninni/spawn/mixin/client/RabbitRendererMixin.java b/src/main/java/com/ninni/spawn/mixin/tweaks/client/RabbitRendererMixin.java similarity index 87% rename from src/main/java/com/ninni/spawn/mixin/client/RabbitRendererMixin.java rename to src/main/java/com/ninni/spawn/mixin/tweaks/client/RabbitRendererMixin.java index 1ba74e1..25d5732 100644 --- a/src/main/java/com/ninni/spawn/mixin/client/RabbitRendererMixin.java +++ b/src/main/java/com/ninni/spawn/mixin/tweaks/client/RabbitRendererMixin.java @@ -1,20 +1,16 @@ -package com.ninni.spawn.mixin.client; +package com.ninni.spawn.mixin.tweaks.client; import com.mojang.blaze3d.vertex.PoseStack; import com.ninni.spawn.SpawnRPTweaks; -import com.ninni.spawn.client.model.ParrotRemodel; import com.ninni.spawn.client.model.RabbitRemodel; import com.ninni.spawn.registry.SpawnEntityModelLayers; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.client.model.ParrotModel; import net.minecraft.client.model.RabbitModel; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.entity.MobRenderer; -import net.minecraft.client.renderer.entity.ParrotRenderer; import net.minecraft.client.renderer.entity.RabbitRenderer; -import net.minecraft.world.entity.animal.Parrot; import net.minecraft.world.entity.animal.Rabbit; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; diff --git a/src/main/java/com/ninni/spawn/mixin/client/SalmonModelMixin.java b/src/main/java/com/ninni/spawn/mixin/tweaks/client/SalmonModelMixin.java similarity index 99% rename from src/main/java/com/ninni/spawn/mixin/client/SalmonModelMixin.java rename to src/main/java/com/ninni/spawn/mixin/tweaks/client/SalmonModelMixin.java index 4049b7b..0da1cd8 100644 --- a/src/main/java/com/ninni/spawn/mixin/client/SalmonModelMixin.java +++ b/src/main/java/com/ninni/spawn/mixin/tweaks/client/SalmonModelMixin.java @@ -1,4 +1,4 @@ -package com.ninni.spawn.mixin.client; +package com.ninni.spawn.mixin.tweaks.client; import com.ninni.spawn.SpawnRPTweaks; import net.minecraft.client.model.HierarchicalModel; diff --git a/src/main/java/com/ninni/spawn/mixin/client/TropicalFishModelAMixin.java b/src/main/java/com/ninni/spawn/mixin/tweaks/client/TropicalFishModelAMixin.java similarity index 99% rename from src/main/java/com/ninni/spawn/mixin/client/TropicalFishModelAMixin.java rename to src/main/java/com/ninni/spawn/mixin/tweaks/client/TropicalFishModelAMixin.java index 8cb44da..2fc4a8d 100644 --- a/src/main/java/com/ninni/spawn/mixin/client/TropicalFishModelAMixin.java +++ b/src/main/java/com/ninni/spawn/mixin/tweaks/client/TropicalFishModelAMixin.java @@ -1,4 +1,4 @@ -package com.ninni.spawn.mixin.client; +package com.ninni.spawn.mixin.tweaks.client; import com.ninni.spawn.SpawnRPTweaks; import net.minecraft.client.model.ColorableHierarchicalModel; diff --git a/src/main/java/com/ninni/spawn/mixin/client/TropicalFishModelBMixin.java b/src/main/java/com/ninni/spawn/mixin/tweaks/client/TropicalFishModelBMixin.java similarity index 98% rename from src/main/java/com/ninni/spawn/mixin/client/TropicalFishModelBMixin.java rename to src/main/java/com/ninni/spawn/mixin/tweaks/client/TropicalFishModelBMixin.java index 27366a1..15960a9 100644 --- a/src/main/java/com/ninni/spawn/mixin/client/TropicalFishModelBMixin.java +++ b/src/main/java/com/ninni/spawn/mixin/tweaks/client/TropicalFishModelBMixin.java @@ -1,8 +1,7 @@ -package com.ninni.spawn.mixin.client; +package com.ninni.spawn.mixin.tweaks.client; import com.ninni.spawn.SpawnRPTweaks; import net.minecraft.client.model.ColorableHierarchicalModel; -import net.minecraft.client.model.TropicalFishModelA; import net.minecraft.client.model.TropicalFishModelB; import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.model.geom.PartPose; diff --git a/src/main/java/com/ninni/spawn/mixin/client/TurtleModelMixin.java b/src/main/java/com/ninni/spawn/mixin/tweaks/client/TurtleModelMixin.java similarity index 98% rename from src/main/java/com/ninni/spawn/mixin/client/TurtleModelMixin.java rename to src/main/java/com/ninni/spawn/mixin/tweaks/client/TurtleModelMixin.java index 19558e0..7b5baf8 100644 --- a/src/main/java/com/ninni/spawn/mixin/client/TurtleModelMixin.java +++ b/src/main/java/com/ninni/spawn/mixin/tweaks/client/TurtleModelMixin.java @@ -1,13 +1,11 @@ -package com.ninni.spawn.mixin.client; +package com.ninni.spawn.mixin.tweaks.client; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import com.ninni.spawn.SpawnRPTweaks; -import net.minecraft.client.Minecraft; import net.minecraft.client.model.QuadrupedModel; import net.minecraft.client.model.TurtleModel; import net.minecraft.client.model.geom.ModelPart; -import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.entity.animal.Turtle; import org.spongepowered.asm.mixin.Final; diff --git a/src/main/resources/spawn.mixins.json b/src/main/resources/spawn.mixins.json index 8e72e4c..026b17d 100644 --- a/src/main/resources/spawn.mixins.json +++ b/src/main/resources/spawn.mixins.json @@ -4,6 +4,15 @@ "package": "com.ninni.spawn.mixin", "compatibilityLevel": "JAVA_17", "mixins": [ + "accessor.NoiseGeneratorSettingsAccessor", + "accessor.PlayerAccessor", + "accessor.TropicalFishAccessor", + + "tweaks.CodMixin", + "tweaks.RabbitMixin", + "tweaks.SalmonMixin", + "tweaks.TropicalFishMixin", + "AbstractFishMixin", "BlockEntityTypeMixin", "ChestBlockMixin", @@ -15,25 +24,22 @@ "OverworldBiomeBuilderMixin", "PlayerMixin", "PoseMixin", - "RabbitMixin", - "ServerPlayerMixin", - "accessor.NoiseGeneratorSettingsAccessor", - "accessor.PlayerAccessor", - "accessor.TropicalFishAccessor" + "ServerPlayerMixin" ], "client": [ + "tweaks.client.BatRendererMixin", + "tweaks.client.CodModelMixin", + "tweaks.client.ParrotOnShoulderLayerMixin", + "tweaks.client.ParrotRendererMixin", + "tweaks.client.RabbitRendererMixin", + "tweaks.client.SalmonModelMixin", + "tweaks.client.TropicalFishModelAMixin", + "tweaks.client.TropicalFishModelBMixin", + "tweaks.client.TurtleModelMixin", + "client.AxolotlModelMixin", - "client.BatRendererMixin", - "client.BlockEntityWithoutLevelRendererMixin", - "client.CodModelMixin", - "client.ParrotOnShoulderLayerMixin", - "client.ParrotRendererMixin", "client.PufferfishRendererMixin", - "client.RabbitRendererMixin", - "client.SalmonModelMixin", - "client.TropicalFishModelAMixin", - "client.TropicalFishModelBMixin", - "client.TurtleModelMixin" + "client.BlockEntityWithoutLevelRendererMixin" ], "injectors": { "defaultRequire": 1