From 3bd6d6f72099d76ebe01343deb6006044244b397 Mon Sep 17 00:00:00 2001 From: iGalaxy Date: Sat, 11 Mar 2023 13:39:57 -0800 Subject: [PATCH 1/3] feat: water transparency config --- build.gradle | 7 +++++++ .../angling/client/AnglingClient.java | 7 +++++++ .../angling/config/AnglingConfig.java | 11 +++++++++++ .../angling/config/ModMenuIntegration.java | 13 +++++++++++++ .../angling/mixin/FluidRendererMixin.java | 3 ++- .../mixin/integration/SodiumFluidRendererMixin.java | 3 ++- src/main/resources/assets/angling/lang/en_us.json | 4 +++- src/main/resources/fabric.mod.json | 7 ++++++- 8 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 src/main/java/com/eightsidedsquare/angling/config/AnglingConfig.java create mode 100644 src/main/java/com/eightsidedsquare/angling/config/ModMenuIntegration.java diff --git a/build.gradle b/build.gradle index 634dc59..bdbd070 100644 --- a/build.gradle +++ b/build.gradle @@ -33,6 +33,8 @@ repositories { url = 'https://ladysnake.jfrog.io/artifactory/mods' } maven { url 'https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/' } + maven { url "https://maven.shedaniel.me/" } + maven { url "https://maven.terraformersmc.com/releases/" } } dependencies { @@ -58,6 +60,11 @@ dependencies { modCompileOnly "maven.modrinth:sodium:${sodium_version}" modRuntimeOnly "maven.modrinth:sodium:${sodium_version}" implementation "org.joml:joml:1.10.4" + + modApi("me.shedaniel.cloth:cloth-config-fabric:8.2.88") { + exclude(group: "net.fabricmc.fabric-api") + } + modApi "com.terraformersmc:modmenu:4.2.0-beta.2" } processResources { diff --git a/src/main/java/com/eightsidedsquare/angling/client/AnglingClient.java b/src/main/java/com/eightsidedsquare/angling/client/AnglingClient.java index 58eb7ac..f105d9e 100644 --- a/src/main/java/com/eightsidedsquare/angling/client/AnglingClient.java +++ b/src/main/java/com/eightsidedsquare/angling/client/AnglingClient.java @@ -1,5 +1,6 @@ package com.eightsidedsquare.angling.client; +import com.eightsidedsquare.angling.config.AnglingConfig; import com.eightsidedsquare.angling.client.model.CrabEntityModel; import com.eightsidedsquare.angling.client.model.DongfishEntityModel; import com.eightsidedsquare.angling.client.model.SunfishEntityModel; @@ -15,6 +16,8 @@ import com.eightsidedsquare.angling.core.AnglingEntities; import com.eightsidedsquare.angling.core.AnglingItems; import com.eightsidedsquare.angling.core.AnglingParticles; +import me.shedaniel.autoconfig.AutoConfig; +import me.shedaniel.autoconfig.serializer.JanksonConfigSerializer; import net.fabricmc.api.ClientModInitializer; import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry; @@ -38,6 +41,8 @@ import static com.eightsidedsquare.angling.core.AnglingMod.MOD_ID; public class AnglingClient implements ClientModInitializer { + public static AnglingConfig CONFIG; + @Override public void onInitializeClient() { BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(), @@ -85,6 +90,8 @@ public void onInitializeClient() { ModelPredicateProviderRegistry.register(AnglingItems.DONGFISH_BUCKET, new Identifier(MOD_ID, "has_horngus"), this::dongfishBucketItemHasHorngus); + AutoConfig.register(AnglingConfig.class, JanksonConfigSerializer::new); + CONFIG = AutoConfig.getConfigHolder(AnglingConfig.class).getConfig(); } private float dongfishBucketItemHasHorngus(ItemStack stack, ClientWorld clientWorld, LivingEntity livingEntity, int i) { diff --git a/src/main/java/com/eightsidedsquare/angling/config/AnglingConfig.java b/src/main/java/com/eightsidedsquare/angling/config/AnglingConfig.java new file mode 100644 index 0000000..139bcc3 --- /dev/null +++ b/src/main/java/com/eightsidedsquare/angling/config/AnglingConfig.java @@ -0,0 +1,11 @@ +package com.eightsidedsquare.angling.config; + +import me.shedaniel.autoconfig.ConfigData; +import me.shedaniel.autoconfig.annotation.Config; +import me.shedaniel.autoconfig.annotation.ConfigEntry; + +@Config(name = "angling") +public class AnglingConfig implements ConfigData { + @ConfigEntry.Category("client") + public boolean hideWaterBehindGlass = true; +} diff --git a/src/main/java/com/eightsidedsquare/angling/config/ModMenuIntegration.java b/src/main/java/com/eightsidedsquare/angling/config/ModMenuIntegration.java new file mode 100644 index 0000000..7d14ba7 --- /dev/null +++ b/src/main/java/com/eightsidedsquare/angling/config/ModMenuIntegration.java @@ -0,0 +1,13 @@ +package com.eightsidedsquare.angling.config; + +import com.eightsidedsquare.angling.config.AnglingConfig; +import com.terraformersmc.modmenu.api.ConfigScreenFactory; +import com.terraformersmc.modmenu.api.ModMenuApi; +import me.shedaniel.autoconfig.AutoConfig; + +public class ModMenuIntegration implements ModMenuApi { + @Override + public ConfigScreenFactory getModConfigScreenFactory() { + return parent -> AutoConfig.getConfigScreen(AnglingConfig.class, parent).get(); + } +} diff --git a/src/main/java/com/eightsidedsquare/angling/mixin/FluidRendererMixin.java b/src/main/java/com/eightsidedsquare/angling/mixin/FluidRendererMixin.java index 3ed142e..7c8970c 100644 --- a/src/main/java/com/eightsidedsquare/angling/mixin/FluidRendererMixin.java +++ b/src/main/java/com/eightsidedsquare/angling/mixin/FluidRendererMixin.java @@ -1,5 +1,6 @@ package com.eightsidedsquare.angling.mixin; +import com.eightsidedsquare.angling.client.AnglingClient; import net.fabricmc.fabric.api.tag.convention.v1.ConventionalBlockTags; import net.minecraft.block.BlockState; import net.minecraft.client.render.block.FluidRenderer; @@ -18,7 +19,7 @@ public abstract class FluidRendererMixin { @Inject(method = "shouldRenderSide", at = @At("HEAD"), cancellable = true) private static void shouldRenderSide(BlockRenderView world, BlockPos pos, FluidState fluidState, BlockState blockState, Direction direction, FluidState neighborFluidState, CallbackInfoReturnable cir) { - if(fluidState.isIn(FluidTags.WATER)) { + if(AnglingClient.CONFIG.hideWaterBehindGlass && fluidState.isIn(FluidTags.WATER)) { if(world.getBlockState(pos.offset(direction)).isIn(ConventionalBlockTags.GLASS_BLOCKS)) { cir.setReturnValue(false); } diff --git a/src/main/java/com/eightsidedsquare/angling/mixin/integration/SodiumFluidRendererMixin.java b/src/main/java/com/eightsidedsquare/angling/mixin/integration/SodiumFluidRendererMixin.java index d870917..ad5cb99 100644 --- a/src/main/java/com/eightsidedsquare/angling/mixin/integration/SodiumFluidRendererMixin.java +++ b/src/main/java/com/eightsidedsquare/angling/mixin/integration/SodiumFluidRendererMixin.java @@ -1,5 +1,6 @@ package com.eightsidedsquare.angling.mixin.integration; +import com.eightsidedsquare.angling.client.AnglingClient; import me.jellysquid.mods.sodium.client.render.pipeline.FluidRenderer; import net.fabricmc.fabric.api.tag.convention.v1.ConventionalBlockTags; import net.minecraft.block.BlockState; @@ -22,7 +23,7 @@ public abstract class SodiumFluidRendererMixin { @Inject(method = "isFluidOccluded", at = @At("RETURN"), cancellable = true) private void isFluidOccluded(BlockRenderView world, int x, int y, int z, Direction dir, Fluid fluid, CallbackInfoReturnable cir) { - if(!cir.getReturnValue()) { + if(AnglingClient.CONFIG.hideWaterBehindGlass && !cir.getReturnValue()) { BlockState state = world.getBlockState(new BlockPos(scratchPos).offset(dir.getOpposite())); BlockState sideState = world.getBlockState(scratchPos); if(state.getFluidState().isIn(FluidTags.WATER) && sideState.isIn(ConventionalBlockTags.GLASS_BLOCKS)) { diff --git a/src/main/resources/assets/angling/lang/en_us.json b/src/main/resources/assets/angling/lang/en_us.json index 45766ac..6a355d4 100644 --- a/src/main/resources/assets/angling/lang/en_us.json +++ b/src/main/resources/assets/angling/lang/en_us.json @@ -141,5 +141,7 @@ "advancements.husbandry.traded_with_pelican.title": "Paying the Bill", "advancements.husbandry.traded_with_pelican.description": "Trade the Fish inside a Pelican's Beak for another Fish", "advancements.husbandry.look_at_nautilus.title": "Cephalopod Activities", - "advancements.husbandry.look_at_nautilus.description": "Observe a Nautilus" + "advancements.husbandry.look_at_nautilus.description": "Observe a Nautilus", + "text.autoconfig.angling.title": "Angling Config", + "text.autoconfig.angling.option.hideWaterBehindGlass": "Hide Water Behind Glass" } \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 56df9ca..510ea1a 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -30,6 +30,9 @@ ], "preLaunch": [ "com.eightsidedsquare.angling.core.AnglingPreLaunch" + ], + "modmenu": [ + "com.eightsidedsquare.angling.config.ModMenuIntegration" ] }, "mixins": [ @@ -41,7 +44,8 @@ "fabricloader": ">=0.14.6", "fabric": "*", "minecraft": "~1.19", - "java": ">=17" + "java": ">=17", + "cloth-config2": ">=8.0.0" }, "custom": { "cardinal-components": [ @@ -49,5 +53,6 @@ ] }, "suggests": { + "modmenu": ">=4.0.0" } } From e13653e52212fab8268bbf68e673739b10c1827a Mon Sep 17 00:00:00 2001 From: iGalaxy Date: Sat, 11 Mar 2023 13:42:53 -0800 Subject: [PATCH 2/3] misc: move config init to main class --- .../com/eightsidedsquare/angling/client/AnglingClient.java | 7 ------- .../java/com/eightsidedsquare/angling/core/AnglingMod.java | 7 +++++++ .../eightsidedsquare/angling/mixin/FluidRendererMixin.java | 4 ++-- .../mixin/integration/SodiumFluidRendererMixin.java | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/eightsidedsquare/angling/client/AnglingClient.java b/src/main/java/com/eightsidedsquare/angling/client/AnglingClient.java index f105d9e..89bd5fc 100644 --- a/src/main/java/com/eightsidedsquare/angling/client/AnglingClient.java +++ b/src/main/java/com/eightsidedsquare/angling/client/AnglingClient.java @@ -1,6 +1,5 @@ package com.eightsidedsquare.angling.client; -import com.eightsidedsquare.angling.config.AnglingConfig; import com.eightsidedsquare.angling.client.model.CrabEntityModel; import com.eightsidedsquare.angling.client.model.DongfishEntityModel; import com.eightsidedsquare.angling.client.model.SunfishEntityModel; @@ -16,8 +15,6 @@ import com.eightsidedsquare.angling.core.AnglingEntities; import com.eightsidedsquare.angling.core.AnglingItems; import com.eightsidedsquare.angling.core.AnglingParticles; -import me.shedaniel.autoconfig.AutoConfig; -import me.shedaniel.autoconfig.serializer.JanksonConfigSerializer; import net.fabricmc.api.ClientModInitializer; import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry; @@ -41,7 +38,6 @@ import static com.eightsidedsquare.angling.core.AnglingMod.MOD_ID; public class AnglingClient implements ClientModInitializer { - public static AnglingConfig CONFIG; @Override public void onInitializeClient() { @@ -89,9 +85,6 @@ public void onInitializeClient() { ParticleFactoryRegistry.getInstance().register(AnglingParticles.WORM, WormParticle.Factory::new); ModelPredicateProviderRegistry.register(AnglingItems.DONGFISH_BUCKET, new Identifier(MOD_ID, "has_horngus"), this::dongfishBucketItemHasHorngus); - - AutoConfig.register(AnglingConfig.class, JanksonConfigSerializer::new); - CONFIG = AutoConfig.getConfigHolder(AnglingConfig.class).getConfig(); } private float dongfishBucketItemHasHorngus(ItemStack stack, ClientWorld clientWorld, LivingEntity livingEntity, int i) { diff --git a/src/main/java/com/eightsidedsquare/angling/core/AnglingMod.java b/src/main/java/com/eightsidedsquare/angling/core/AnglingMod.java index de27244..0c428ba 100644 --- a/src/main/java/com/eightsidedsquare/angling/core/AnglingMod.java +++ b/src/main/java/com/eightsidedsquare/angling/core/AnglingMod.java @@ -2,13 +2,17 @@ import com.eightsidedsquare.angling.common.entity.util.*; import com.eightsidedsquare.angling.common.world.PelicanSpawner; +import com.eightsidedsquare.angling.config.AnglingConfig; import com.eightsidedsquare.angling.core.world.AnglingPlacedFeatures; +import me.shedaniel.autoconfig.AutoConfig; +import me.shedaniel.autoconfig.serializer.JanksonConfigSerializer; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; import software.bernie.geckolib3.GeckoLib; public class AnglingMod implements ModInitializer { public static final String MOD_ID = "angling"; + public static AnglingConfig CONFIG; @Override public void onInitialize() { @@ -29,5 +33,8 @@ public void onInitialize() { PelicanSpawner spawner = new PelicanSpawner(); ServerTickEvents.END_WORLD_TICK.register(world -> spawner.spawn(world, world.getServer().isMonsterSpawningEnabled(), world.getServer().shouldSpawnAnimals())); + + AutoConfig.register(AnglingConfig.class, JanksonConfigSerializer::new); + CONFIG = AutoConfig.getConfigHolder(AnglingConfig.class).getConfig(); } } diff --git a/src/main/java/com/eightsidedsquare/angling/mixin/FluidRendererMixin.java b/src/main/java/com/eightsidedsquare/angling/mixin/FluidRendererMixin.java index 7c8970c..ed96bb6 100644 --- a/src/main/java/com/eightsidedsquare/angling/mixin/FluidRendererMixin.java +++ b/src/main/java/com/eightsidedsquare/angling/mixin/FluidRendererMixin.java @@ -1,6 +1,6 @@ package com.eightsidedsquare.angling.mixin; -import com.eightsidedsquare.angling.client.AnglingClient; +import com.eightsidedsquare.angling.core.AnglingMod; import net.fabricmc.fabric.api.tag.convention.v1.ConventionalBlockTags; import net.minecraft.block.BlockState; import net.minecraft.client.render.block.FluidRenderer; @@ -19,7 +19,7 @@ public abstract class FluidRendererMixin { @Inject(method = "shouldRenderSide", at = @At("HEAD"), cancellable = true) private static void shouldRenderSide(BlockRenderView world, BlockPos pos, FluidState fluidState, BlockState blockState, Direction direction, FluidState neighborFluidState, CallbackInfoReturnable cir) { - if(AnglingClient.CONFIG.hideWaterBehindGlass && fluidState.isIn(FluidTags.WATER)) { + if(AnglingMod.CONFIG.hideWaterBehindGlass && fluidState.isIn(FluidTags.WATER)) { if(world.getBlockState(pos.offset(direction)).isIn(ConventionalBlockTags.GLASS_BLOCKS)) { cir.setReturnValue(false); } diff --git a/src/main/java/com/eightsidedsquare/angling/mixin/integration/SodiumFluidRendererMixin.java b/src/main/java/com/eightsidedsquare/angling/mixin/integration/SodiumFluidRendererMixin.java index ad5cb99..d852dcc 100644 --- a/src/main/java/com/eightsidedsquare/angling/mixin/integration/SodiumFluidRendererMixin.java +++ b/src/main/java/com/eightsidedsquare/angling/mixin/integration/SodiumFluidRendererMixin.java @@ -1,6 +1,6 @@ package com.eightsidedsquare.angling.mixin.integration; -import com.eightsidedsquare.angling.client.AnglingClient; +import com.eightsidedsquare.angling.core.AnglingMod; import me.jellysquid.mods.sodium.client.render.pipeline.FluidRenderer; import net.fabricmc.fabric.api.tag.convention.v1.ConventionalBlockTags; import net.minecraft.block.BlockState; @@ -23,7 +23,7 @@ public abstract class SodiumFluidRendererMixin { @Inject(method = "isFluidOccluded", at = @At("RETURN"), cancellable = true) private void isFluidOccluded(BlockRenderView world, int x, int y, int z, Direction dir, Fluid fluid, CallbackInfoReturnable cir) { - if(AnglingClient.CONFIG.hideWaterBehindGlass && !cir.getReturnValue()) { + if(AnglingMod.CONFIG.hideWaterBehindGlass && !cir.getReturnValue()) { BlockState state = world.getBlockState(new BlockPos(scratchPos).offset(dir.getOpposite())); BlockState sideState = world.getBlockState(scratchPos); if(state.getFluidState().isIn(FluidTags.WATER) && sideState.isIn(ConventionalBlockTags.GLASS_BLOCKS)) { From d94a7ace4c58b50d39747c4df9b072d9a3c570fd Mon Sep 17 00:00:00 2001 From: byquanton <32410361+byquanton@users.noreply.github.com> Date: Wed, 19 Apr 2023 21:12:46 +0200 Subject: [PATCH 3/3] Started Porting to 1.19.4 commented out some things I haven't done yet. But it should start ... --- build.gradle | 22 ++-- gradle.properties | 17 ++- gradle/wrapper/gradle-wrapper.jar | Bin 61574 -> 61608 bytes gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 4 +- .../angling/client/AnglingClient.java | 14 +- .../client/model/AnemoneBlockEntityModel.java | 10 +- .../client/model/BasicEntityModel.java | 36 +++--- .../angling/client/model/CrabEntityModel.java | 29 +++-- .../client/model/DongfishEntityModel.java | 12 +- .../client/model/NautilusEntityModel.java | 16 +-- .../model/StarfishBlockEntityModel.java | 23 ++-- .../client/model/SunfishEntityModel.java | 8 +- .../client/model/UrchinBlockEntityModel.java | 4 +- .../client/particle/AlgaeParticle.java | 4 +- .../angling/client/particle/WormParticle.java | 36 ++++-- .../renderer/AnemoneBlockEntityRenderer.java | 8 +- .../renderer/AnglerfishEntityRenderer.java | 29 ++--- .../client/renderer/BasicEntityRenderer.java | 22 ++-- .../client/renderer/FryEntityRenderer.java | 23 ++-- .../renderer/NautilusEntityRenderer.java | 6 +- .../renderer/PelicanEntityRenderer.java | 12 +- .../renderer/SeaSlugEntityRenderer.java | 23 ++-- .../renderer/StarfishBlockEntityRenderer.java | 54 ++++---- .../renderer/UrchinBlockEntityRenderer.java | 42 +++--- .../angling/common/block/AlgaeBlock.java | 16 ++- .../angling/common/block/AnemoneBlock.java | 2 +- .../angling/common/block/ClamBlock.java | 6 +- .../angling/common/block/OystersBlock.java | 2 +- .../angling/common/block/PapyrusBlock.java | 6 +- .../angling/common/block/RoeBlock.java | 6 +- .../common/block/SeaSlugEggsBlock.java | 4 +- .../angling/common/block/StarfishBlock.java | 8 +- .../angling/common/block/UrchinBlock.java | 2 +- .../common/block/WaterFloatingPlant.java | 3 +- .../common/block/WaterloggableBlock.java | 2 +- .../angling/common/block/WormyBlock.java | 4 +- .../common/entity/AnemoneBlockEntity.java | 40 +++--- .../common/entity/AnglerfishEntity.java | 41 +++--- .../common/entity/AnomalocarisEntity.java | 39 +++--- .../common/entity/BubbleEyeEntity.java | 50 +++++--- .../angling/common/entity/CatfishEntity.java | 47 ++++--- .../angling/common/entity/CrabEntity.java | 80 +++++++----- .../angling/common/entity/DongfishEntity.java | 53 ++++---- .../angling/common/entity/FryEntity.java | 47 ++++--- .../angling/common/entity/MahiMahiEntity.java | 54 ++++---- .../angling/common/entity/NautilusEntity.java | 50 +++++--- .../angling/common/entity/PelicanEntity.java | 98 ++++++++------ .../angling/common/entity/RoeBlockEntity.java | 4 +- .../common/entity/SeaSlugEggsBlockEntity.java | 2 +- .../angling/common/entity/SeaSlugEntity.java | 58 +++++---- .../angling/common/entity/SeahorseEntity.java | 46 ++++--- .../common/entity/StarfishBlockEntity.java | 46 ++++--- .../angling/common/entity/SunfishEntity.java | 45 ++++--- .../common/entity/UrchinBlockEntity.java | 43 ++++--- .../angling/common/entity/UrchinEntity.java | 42 +++--- .../common/entity/ai/EatAlgaeGoal.java | 2 +- .../common/entity/ai/GoToWaterGoal.java | 2 +- .../common/entity/ai/PelicanAttackTask.java | 3 +- .../common/entity/ai/PelicanBrain.java | 11 ++ .../common/entity/ai/PelicanEatTask.java | 4 +- .../common/entity/ai/PelicanSoarTask.java | 10 +- .../common/entity/ai/PelicanTradeTask.java | 4 +- .../common/entity/ai/SeaSlugLayEggsGoal.java | 2 +- .../entity/ai/WanderAroundWaterGoal.java | 4 +- .../common/entity/util/CrabVariant.java | 4 +- .../util/PelicanBeakEntityInitializer.java | 8 +- .../common/entity/util/SeaSlugColor.java | 4 +- .../common/entity/util/SeaSlugPattern.java | 4 +- .../common/entity/util/SunfishVariant.java | 4 +- .../common/feature/NoisePatchFeature.java | 5 +- .../feature/WaterAdjacentPatchFeature.java | 2 +- .../feature/WaterloggablePatchFeature.java | 4 +- .../common/feature/WormyBlockFeature.java | 2 +- .../angling/common/item/RoeBlockItem.java | 11 +- .../angling/common/item/UrchinBucketItem.java | 2 +- .../angling/core/AnglingBlocks.java | 55 +++++--- .../angling/core/AnglingDataGenerator.java | 21 +++ .../angling/core/AnglingEntities.java | 39 +++--- .../angling/core/AnglingItems.java | 33 +++-- .../angling/core/AnglingMixinPlugin.java | 2 +- .../angling/core/AnglingMod.java | 54 ++++---- .../angling/core/AnglingParticles.java | 7 +- .../angling/core/AnglingSounds.java | 7 +- .../angling/core/AnglingUtil.java | 8 +- .../core/ai/AnglingMemoryModuleTypes.java | 5 +- .../angling/core/ai/AnglingSensorTypes.java | 5 +- .../angling/core/tags/AnglingBiomeTags.java | 46 ++++--- .../angling/core/tags/AnglingBlockTags.java | 14 +- .../core/tags/AnglingEntityTypeTags.java | 18 +-- .../core/world/AnglingConfiguredFeatures.java | 83 +++++------- .../angling/core/world/AnglingFeatures.java | 5 +- .../core/world/AnglingPlacedFeatures.java | 121 +++++++++--------- .../angling/mixin/CoralFeatureMixin.java | 2 +- .../angling/mixin/FluidRendererMixin.java | 2 +- .../integration/SodiumFluidRendererMixin.java | 12 +- src/main/resources/fabric.mod.json | 8 +- 97 files changed, 1133 insertions(+), 908 deletions(-) mode change 100644 => 100755 gradlew create mode 100644 src/main/java/com/eightsidedsquare/angling/core/AnglingDataGenerator.java diff --git a/build.gradle b/build.gradle index bdbd070..33872b0 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.0-SNAPSHOT' + id 'fabric-loom' version '1.1-SNAPSHOT' id 'maven-publish' } @@ -38,33 +38,29 @@ repositories { } dependencies { - modImplementation 'software.bernie.geckolib:geckolib-fabric-1.19:3.1.5' - minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - modImplementation 'software.bernie.geckolib:geckolib-fabric-1.19:3.1.5' - + modImplementation "software.bernie.geckolib:geckolib-fabric-1.19.4:${project.geckolib_version}" modImplementation "dev.onyxstudios.cardinal-components-api:cardinal-components-base:${project.cca_version}" modImplementation "dev.onyxstudios.cardinal-components-api:cardinal-components-entity:${project.cca_version}" include "dev.onyxstudios.cardinal-components-api:cardinal-components-base:${project.cca_version}" include "dev.onyxstudios.cardinal-components-api:cardinal-components-entity:${project.cca_version}" - implementation "com.github.LlamaLad7:MixinExtras:${mixin_extras_version}" - annotationProcessor "com.github.LlamaLad7:MixinExtras:${mixin_extras_version}" - include "com.github.LlamaLad7:MixinExtras:${mixin_extras_version}" + implementation "com.github.LlamaLad7:MixinExtras:${project.mixin_extras_version}" + annotationProcessor "com.github.LlamaLad7:MixinExtras:${project.mixin_extras_version}" + include "com.github.LlamaLad7:MixinExtras:${project.mixin_extras_version}" - modCompileOnly "maven.modrinth:sodium:${sodium_version}" - modRuntimeOnly "maven.modrinth:sodium:${sodium_version}" - implementation "org.joml:joml:1.10.4" + modCompileOnly "maven.modrinth:sodium:${project.sodium_version}" + modRuntimeOnly "maven.modrinth:sodium:${project.sodium_version}" - modApi("me.shedaniel.cloth:cloth-config-fabric:8.2.88") { + modApi ("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}") { exclude(group: "net.fabricmc.fabric-api") } - modApi "com.terraformersmc:modmenu:4.2.0-beta.2" + modApi "com.terraformersmc:modmenu:${project.modmenu_version}" } processResources { diff --git a/gradle.properties b/gradle.properties index d33817e..17eec1f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,15 +2,18 @@ org.gradle.jvmargs=-Xmx4G org.gradle.parallel=true -minecraft_version=1.19.2 -yarn_mappings=1.19.2+build.28 -loader_version=0.14.11 +minecraft_version=1.19.4 +yarn_mappings=1.19.4+build.2 +loader_version=0.14.19 -mod_version = 1.0.0 +mod_version = 1.1.0 maven_group = com.eightsidedsquare archives_base_name = angling -fabric_version=0.68.0+1.19.2 +fabric_version=0.78.0+1.19.4 mixin_extras_version=0.1.1 -sodium_version=mc1.19.2-0.4.4 -cca_version=5.0.0 +sodium_version=mc1.19.4-0.4.10 +cca_version=5.1.0 +geckolib_version=4.1.3 +cloth_config_version=10.0.96 +modmenu_version=6.1.0 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 943f0cbfa754578e88a3dae77fce6e3dea56edbf..ccebba7710deaf9f98673a68957ea02138b60d0a 100644 GIT binary patch delta 5094 zcmZu#c|6qH|DG9RA4`noBZNWrC2N)tSqjO%%aX0^O4dPAB*iC6_9R<`apl^#h-_oY z)(k_0v8Fxp{fyi9-uwN%e)GpU&v~BrS>~KG^PF=MNmQjIDr&QHR7f-kM{%U_u*1=5 zGC}ae5(^Rrg9QY8$x^}oiJ0d2O9YW{J~$dD1ovlvh&0B4L)!4S=z;Hac>K{#9q9cKq;>>BtKo1!+gw`yqE zSK8x^jC|B!qmSW#uyb@T^CkB9qRd{N3V-rEi}AEgoU_J27lw_0X`}c0&m9JhxM;RK z54_gdZ(u?R5`B3}NeVal2NTHqlktM`2eTF28%6BZCWW$-shf0l-BOVSm)hU58MTPy zDcY-5777j;ccU!Yba8wH=X6OdPJ8O5Kp^3gUNo>!b=xb6T2F&LiC2eBJj8KuLPW!4 zw3V^NnAKZm^D?tmliCvzi>UtoDH%V#%SM0d*NS+m%4}qO<)M1E{OpQ(v&ZNc`vdi| zEGlVi$Dgxy1p6+k0qGLQt(JwxZxLCZ4>wJ=sb0v%Ki?*+!ic_2exumn{%Co|| z-axdK#RUC;P|vqbe?L`K!j;sUo=uuR_#ZkRvBf%Txo6{OL&I(?dz?47Z(DcX3KTw> zGY%A=kX;fBkq$F^sX|-)1Qkg##+n-Ci{qJVPj@P?l_1Y`nD^v>fZ3HMX%(4p-TlD(>yWwJij!6Jw}l7h>CIm@Ou5B@$Wy`Ky*814%Mdi1GfG1zDG9NogaoVHHr4gannv4?w6g&10!j=lKM zFW;@=Z0}vAPAxA=R4)|`J??*$|Fh`5=ks*V7TapX`+=4n*{aXxRhh-EGX_Xrzjb4r zn0vO7Cc~wtyeM_8{**~9y7>+}1JV8Buhg%*hy|PUc#!vw#W(HFTL|BpM)U0>JxG6S zLnqn1!0++RyyJ>5VU<4mDv8>Q#{EtgS3mj7Hx}Zkr0tz1}h8Kn6q`MiwC z{Y#;D!-ndlImST(C@(*i5f0U(jD29G7g#nkiPX zki6M$QYX_fNH=E4_eg9*FFZ3wF9YAKC}CP89Kl(GNS(Ag994)0$OL4-fj_1EdR}ARB#-vP_$bWF`Qk58+ z4Jq*-YkcmCuo9U%oxGeYe7Be=?n}pX+x>ob(8oPLDUPiIryT8v*N4@0{s_VYALi;lzj19ivLJKaXt7~UfU|mu9zjbhPnIhG2`uI34urWWA9IO{ z_1zJ)lwSs{qt3*UnD}3qB^kcRZ?``>IDn>qp8L96bRaZH)Zl`!neewt(wjSk1i#zf zb8_{x_{WRBm9+0CF4+nE)NRe6K8d|wOWN)&-3jCDiK5mj>77=s+TonlH5j`nb@rB5 z5NX?Z1dk`E#$BF{`(D>zISrMo4&}^wmUIyYL-$PWmEEfEn-U0tx_vy$H6|+ zi{ytv2@JXBsot|%I5s74>W1K{-cvj0BYdNiRJz*&jrV9>ZXYZhEMULcM=fCmxkN&l zEoi=)b)Vazc5TQC&Q$oEZETy@!`Gnj`qoXl7mcwdY@3a-!SpS2Mau|uK#++@>H8QC zr2ld8;<_8We%@E?S=E?=e9c$BL^9X?bj*4W;<+B&OOe+3{<`6~*fC(=`TO>o^A(Y! zA`Qc1ky?*6xjVfR?ugE~oY`Gtzhw^{Z@E6vZ`mMRAp>Odpa!m zzWmtjT|Lj^qiZMfj%%un-o$Eu>*v12qF{$kCKai^?DF=$^tfyV%m9;W@pm-BZn_6b z{jsXY3!U`%9hzk6n7YyHY%48NhjI6jjuUn?Xfxe0`ARD_Q+T_QBZ{ zUK@!63_Wr`%9q_rh`N4=J=m;v>T{Y=ZLKN^m?(KZQ2J%|3`hV0iogMHJ} zY6&-nXirq$Yhh*CHY&Qf*b@@>LPTMf z(cMorwW?M11RN{H#~ApKT)F!;R#fBHahZGhmy>Sox`rk>>q&Y)RG$-QwH$_TWk^hS zTq2TC+D-cB21|$g4D=@T`-ATtJ?C=aXS4Q}^`~XjiIRszCB^cvW0OHe5;e~9D%D10 zl4yP4O=s-~HbL7*4>#W52eiG7*^Hi)?@-#*7C^X5@kGwK+paI>_a2qxtW zU=xV7>QQROWQqVfPcJ$4GSx`Y23Z&qnS?N;%mjHL*EVg3pBT{V7bQUI60jtBTS?i~ zycZ4xqJ<*3FSC6_^*6f)N|sgB5Bep(^%)$=0cczl>j&n~KR!7WC|3;Zoh_^GuOzRP zo2Hxf50w9?_4Qe368fZ0=J|fR*jO_EwFB1I^g~i)roB|KWKf49-)!N%Ggb%w=kB8)(+_%kE~G!(73aF=yCmM3Cfb9lV$G!b zoDIxqY{dH>`SILGHEJwq%rwh46_i`wkZS-NY95qdNE)O*y^+k#JlTEij8NT(Y_J!W zFd+YFoZB|auOz~A@A{V*c)o7E(a=wHvb@8g5PnVJ&7D+Fp8ABV z5`&LD-<$jPy{-y*V^SqM)9!#_Pj2-x{m$z+9Z*o|JTBGgXYYVM;g|VbitDUfnVn$o zO)6?CZcDklDoODzj+ti@i#WcqPoZ!|IPB98LW!$-p+a4xBVM@%GEGZKmNjQMhh)zv z7D){Gpe-Dv=~>c9f|1vANF&boD=Nb1Dv>4~eD636Lldh?#zD5{6JlcR_b*C_Enw&~ z5l2(w(`{+01xb1FCRfD2ap$u(h1U1B6e&8tQrnC}Cy0GR=i^Uue26Rc6Dx}!4#K*0 zaxt`a+px7-Z!^(U1WN2#kdN#OeR|2z+C@b@w+L67VEi&ZpAdg+8`HJT=wIMJqibhT ztb3PFzsq&7jzQuod3xp7uL?h-7rYao&0MiT_Bux;U*N#ebGv92o(jM2?`1!N2W_M* zeo9$%hEtIy;=`8z1c|kL&ZPn0y`N)i$Y1R9>K!el{moiy)014448YC#9=K zwO3weN|8!`5bU_#f(+ZrVd*9`7Uw?!q?yo&7sk&DJ;#-^tcCtqt5*A(V;&LdHq7Hg zI6sC@!ly9p$^@v&XDsgIuv;9#w^!C1n5+10-tEw~ZdO1kqMDYyDl!5__o}f3hYe2M zCeO)~m&&=JZn%cVH3HzPlcE`9^@``2u+!Y}Remn)DLMHc-h5A9ATgs;7F7=u2=vBlDRbjeYvyNby=TvpI{5nb2@J_YTEEEj4q<@zaGSC_i&xxD!6)d zG{1??({Ma<=Wd4JL%bnEXoBOU_0bbNy3p%mFrMW>#c zzPEvryBevZVUvT^2P&Zobk#9j>vSIW_t?AHy>(^x-Bx~(mvNYb_%$ZFg(s5~oka+Kp(GU68I$h(Vq|fZ zC_u1FM|S)=ldt#5q>&p4r%%p)*7|Rf0}B#-FwHDTo*|P6HB_rz%R;{==hpl#xTt@VLdSrrf~g^ z`IA8ZV1b`UazYpnkn28h&U)$(gdZ*f{n`&kH%Oy54&Z;ebjlh4x?JmnjFAALu}EG} zfGmQ$5vEMJMH`a=+*src#dWK&N1^LFxK9Sa#q_rja$JWra09we<2oL9Q9Sx)?kZFW z$jhOFGE~VcihYlkaZv8?uA7v$*}?2h6i%Qmgc4n~3E(O_`YCRGy~}`NFaj@(?Wz;GS_?T+RqU{S)eD1j$1Gr;C^m z7zDK=xaJ^6``=#Y-2ssNfdRqh0ntJrutGV5Nv&WI%3k1wmD5n+0aRe{0k^!>LFReN zx1g*E>nbyx03KU~UT6->+rG%(owLF=beJxK&a0F;ie1GZ^eKg-VEZb&=s&ajKS#6w zjvC6J#?b|U_(%@uq$c#Q@V_me0S1%)pKz9--{EKwyM}_gOj*Og-NEWLDF_oFtPjG; zXCZ7%#=s}RKr&_5RFN@=H(015AGl4XRN9Bc51`;WWt%vzQvzexDI2BZ@xP~^2$I&7 zA(ndsgLsmA*su8p-~IS q+ZJUZM}`4#Zi@l2F-#HCw*??ha2ta#9s8?H3%YId(*zJG6aF78h1yF1 delta 5107 zcmY*d1zc0@|J{HQlai7V5+f#EN-H%&UP4MFm6QgFfuJK4DG4u#ARsbQL4i>MB1q|w zmWd#pqd~BR-yN@ieE-|$^W1aKIZtf&-p_fyw{(Uwc7_sWYDh^12cY!qXvcPQ!qF;q@b0nYU7 zP&ht}K7j%}P%%|ffm;4F0^i3P0R`a!2wm89L5P3Kfu;tTZJre<{N5}AzsH+E3DS`Q zJLIl`LRMf`JOTBLf(;IV(9(h{(}dXK!cPoSLm(o@fz8vRz}6fOw%3}3VYOsCczLF` za2RTsCWa2sS-uw(6|HLJg)Xf@S8#|+(Z5Y)ER+v+8;btfB3&9sWH6<=U}0)o-jIts zsi?Nko;No&JyZI%@1G&zsG5kKo^Zd7rk_9VIUao9;fC~nv(T0F&Af0&Rp`?x94EIS zUBPyBe5R5#okNiB1Xe--q4|hPyGzhJ?Lurt#Ci09BQ+}rlHpBhm;EmfLw{EbCz)sg zgseAE#f$met1jo;`Z6ihk?O1be3aa$IGV69{nzagziA!M*~E5lMc(Sp+NGm2IUjmn zql((DU9QP~Tn1pt6L`}|$Na-v(P+Zg&?6bAN@2u%KiB*Gmf}Z)R zMENRJgjKMqVbMpzPO{`!J~2Jyu7&xXnTDW?V?IJgy+-35q1)-J8T**?@_-2H`%X+6f5 zIRv`uLp&*?g7L~6+3O*saXT~gWsmhF*FNKw4X$29ePKi02G*)ysenhHv{u9-y?_do ztT(Cu04pk>51n}zu~=wgToY5Cx|MTlNw}GR>+`|6CAhQn=bh@S<7N)`w};;KTywDU z=QWO@RBj$WKOXSgCWg{BD`xl&DS!G}`Mm3$)=%3jzO_C+s+mfTFH5JL>}*(JKs@MqX|o2b#ZBX5P;p7;c)$F1y4HwvJ?KA938$rd)gn_U^CcUtmdaBW57 zlPph>Fz&L`cSScFjcj+7Jif3vxb20Ag~FPstm?9#OrD$e?Y~#1osDB0CFZ9Mu&%iE zSj~wZpFqu6!k%BT)}$F@Z%(d-Pqy07`N8ch2F7z^=S-!r-@j{#&{SM@a8O$P#SySx zZLD_z=I300OCA1YmKV0^lo@>^)THfZvW}s<$^w^#^Ce=kO5ymAnk>H7pK!+NJ-+F7 z1Bb6Y=r)0nZ+hRXUyD+BKAyecZxb+$JTHK5k(nWv*5%2a+u*GDt|rpReYQ}vft zXrIt#!kGO85o^~|9Oc-M5A!S@9Q)O$$&g8u>1=ew?T35h8B{-Z_S78oe=E(-YZhBPe@Y1sUt63A-Cdv>D1nIT~=Rub6$?8g>meFb7Ic@w^%@RN2z72oPZ#Ta%b(P1|&6I z61iO<8hT*)p19Bgd0JgXP{^c{P2~K@^DIXv=dF(u|DFfqD^dMIl8-x)xKIpJRZru@ zDxicyYJG}mh}=1Dfg%B$#H`CiAxPTj^;f4KRMZHUz-_x6)lEq!^mu%72*PI=t$6{Uql#dqm4 zClgaN63!&?v*enz4k1sbaM+yCqUf+i9rw$(YrY%ir1+%cWRB<;r}$8si!6QcNAk~J zk3?dejBaC`>=T<=y=>QVt*4kL>SwYwn$(4ES793qaH)>n(axyV3R5jdXDh#e-N0K- zuUgk|N^|3*D1!Wlz-!M*b}Zc5=;K6I+>1N$&Q%)&8LWUiTYi&aQIj(luA< zN5R<8Y8L#*i0xBio$jWcaiZ4S2w3#R@CGemesy~akKP)2GojQF6!$}!_RdUJPBevX zG#~uz%Yirb0@1wgQ;ayb=qD}6{=QXxjuZQ@@kxbN!QWhtEvuhS2yAZe8fZy6*4Inr zdSyR9Dec4HrE|I=z-U;IlH;_h#7e^Hq}gaJ<-z^}{*s!m^66wu2=(*EM0UaV*&u1q zJrq!K23TO8a(ecSQFdD$y+`xu)Xk36Z*;1i{hS=H2E<8<5yHuHG~22-S+Jq|3HMAw z%qBz3auT=M!=5F|Wqke|I^E8pmJ-}>_DwX5w%d3MSdC>xW%$ocm8w8HRdZ|^#cEt1 zM*I7S6sLQq;;Mecet(Q()+?s+&MeVLOvx}(MkvytkvLHl7h*N0AT1#AqC&(he(^%przH`KqA$z_dAvJJb409@F)fYwD$JW_{_Oie8!@VdJE zU>D$@B?LawAf5$;`AZ1E!krn=aAC%4+YQrzL!59yl1;|T2)u=RBYA8lk0Ek&gS!Rb zt0&hVuyhSa0}rpZGjTA>Gz}>Uv*4)F zf7S%D2nfA7x?gPEXZWk8DZimQs#xi0?So_k`2zb!UVQEAcbvjPLK9v>J~!awnxGpq zEh$EPOc4q&jywmglnC&D)1-P0DH!@)x;uJwMHdhPh>ZLWDw+p1pf52{X2dk{_|UOmakJa4MHu?CY`6Hhv!!d7=aNwiB5z zb*Wlq1zf^3iDlPf)b_SzI*{JCx2jN;*s~ra8NeB!PghqP!0po-ZL?0Jk;2~*~sCQ<%wU`mRImd)~!23RS?XJu|{u( ztFPy3*F=ZhJmBugTv48WX)4U*pNmm~4oD4}$*-92&<)n=R)5lT z-VpbEDk>(C1hoo#-H_u0`#%L6L$ zln(}h2*Cl(5(JtVM{YZ26@Fwmp;?Qt}9$_F%`?+-JHbC;bPZj8PLq9 zWo-KFw!i&r8WuA-!3F_m9!24Z(RhalAUR~_H#Ln=$%b5GY z)oB)zO%J5TY}&BXq^7#M>euVL%01Tzj4$6^ZOjT*7@zr~q@6GEjGi)nbwzSL`TiLN z{DVG~I$w@%^#tD{>1Ap@%=XogG_^Hvy_xiRn4yy?LKsC+ zU!S79X8orh&D%>1S`x2iyi&(iG&r#YT{}~iy(FIOo8?MZU#eo*c*(RjAGj@uDi zARJur)-*{n0PgW~&mFeg`MJ?(Kr;NUom)jh?ozZtyywN9bea6ikQlh}953Oul~N%4 z@Sx!@>?l1e7V*@HZMJx!gMo0TeXdU~#W6^n?YVQJ$)nuFRkvKbfwv_s*2g(!wPO|@ zvuXF=2MiPIX)A7x!|BthSa$GB%ECnuZe_Scx&AlnC z!~6C_SF24#@^VMIw)a-7{00}}Cr5NImPbW8OTIHoo6@NcxLVTna8<<;uy~YaaeMnd z;k_ynYc_8jQn9vW_W8QLkgaHtmwGC}wRcgZ^I^GPbz{lW)p#YYoinez1MjkY%6LBd z+Vr>j&^!?b-*Vk>8I!28o`r3w&^Lal8@=50zV4&9V9oXI{^r8;JmVeos&wf?O!;_o zk))^k*1fvYw9?WrS!sG2TcX`hH@Y3mF&@{i05;_AV{>Umi8{uZP_0W5_1V2yHU<)E z+qviK*7SJtnL;76{WK!?Pv$-!w$08<%8Qy|sB|P%GiV1<+dHw*sj!C~SjsB6+1L@so+Q~n# z+Uc5+Uz+mGmkR@>H7D*c?mm8WQz;3VOpktU_DeBi>3#@z zmLe;3gP<7KPy>~k47nEeT?G?7e2g6316Xdb_y+ja5C9Ayg6QTNr~&Kbs(1>7zp|f@le;9B z1e(+Ga%jPWR7oc}=XcB4$z?YD)l;%#U;}~gZzGViI=fwu9OAPCCK!0w>Ay^#$b49k zT&|M?JaIyRT<;@*t_jp1ifWPvL;{maf6o0T#X!#9YX;0Q;LTQ0}0tg^_Ru4pkSr4#P zmnW|D0`A#Ie6pEfBDv39=jN2;kiUoT6I&kChsbI!jMuY6zuZql5!&i%5!c zjsHlXtjT;NV?jAb`%vy)JOK_j1rponLqc>(2qgYlLPEs>|0QV<=Pw~C`fLFKJJitt zyC6003{rxCsmtGKjhB%W2W~*%vKH8l$pZoOFT*K@uL9%CD^3rh=ZtuTU1 zJpf4|%n^yjh#dKSSCJI8;YU*CD!8Wv20*e5`-fya^75@ADLU^RdHDg3Bk3k6)dGi7 z!!z;|O1h$8q!vO*w6 I6Xdi10eY*&F8}}l diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f398c33..0c85a1f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 index 65dcd68..79a61d4 --- a/gradlew +++ b/gradlew @@ -144,7 +144,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +152,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac diff --git a/src/main/java/com/eightsidedsquare/angling/client/AnglingClient.java b/src/main/java/com/eightsidedsquare/angling/client/AnglingClient.java index 89bd5fc..3174d0d 100644 --- a/src/main/java/com/eightsidedsquare/angling/client/AnglingClient.java +++ b/src/main/java/com/eightsidedsquare/angling/client/AnglingClient.java @@ -18,12 +18,12 @@ import net.fabricmc.api.ClientModInitializer; import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry; -import net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry; import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry; import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.item.ModelPredicateProviderRegistry; import net.minecraft.client.render.RenderLayer; +import net.minecraft.client.render.block.entity.BlockEntityRendererFactories; import net.minecraft.client.world.ClientWorld; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.passive.TropicalFishEntity; @@ -33,7 +33,7 @@ import net.minecraft.nbt.NbtElement; import net.minecraft.util.DyeColor; import net.minecraft.util.Identifier; -import software.bernie.geckolib3.core.util.Color; +import software.bernie.geckolib.core.object.Color; import static com.eightsidedsquare.angling.core.AnglingMod.MOD_ID; @@ -62,12 +62,12 @@ public void onInitializeClient() { EntityRendererRegistry.register(AnglingEntities.ANGLERFISH, AnglerfishEntityRenderer::new); EntityRendererRegistry.register(AnglingEntities.MAHI_MAHI, BasicEntityRenderer.create("mahi_mahi", true)); - BlockEntityRendererRegistry.register(AnglingEntities.STARFISH, StarfishBlockEntityRenderer::new); - BlockEntityRendererRegistry.register(AnglingEntities.ANEMONE, AnemoneBlockEntityRenderer::new); - BlockEntityRendererRegistry.register(AnglingEntities.URCHIN, UrchinBlockEntityRenderer::new); + BlockEntityRendererFactories.register(AnglingEntities.STARFISH, StarfishBlockEntityRenderer::new); + BlockEntityRendererFactories.register(AnglingEntities.ANEMONE, AnemoneBlockEntityRenderer::new); + BlockEntityRendererFactories.register(AnglingEntities.URCHIN, UrchinBlockEntityRenderer::new); if(FabricLoader.getInstance().isModLoaded("sodium")) { - BlockEntityRendererRegistry.register(AnglingEntities.ROE, RoeBlockEntityRenderer::new); - BlockEntityRendererRegistry.register(AnglingEntities.SEA_SLUG_EGGS, SeaSlugEggsBlockEntityRenderer::new); + BlockEntityRendererFactories.register(AnglingEntities.ROE, RoeBlockEntityRenderer::new); + BlockEntityRendererFactories.register(AnglingEntities.SEA_SLUG_EGGS, SeaSlugEggsBlockEntityRenderer::new); } ColorProviderRegistry.BLOCK.register(RoeBlockEntity::getColor, AnglingBlocks.ROE); diff --git a/src/main/java/com/eightsidedsquare/angling/client/model/AnemoneBlockEntityModel.java b/src/main/java/com/eightsidedsquare/angling/client/model/AnemoneBlockEntityModel.java index 9367a20..7610bf2 100644 --- a/src/main/java/com/eightsidedsquare/angling/client/model/AnemoneBlockEntityModel.java +++ b/src/main/java/com/eightsidedsquare/angling/client/model/AnemoneBlockEntityModel.java @@ -2,11 +2,11 @@ import com.eightsidedsquare.angling.common.entity.AnemoneBlockEntity; import net.minecraft.util.Identifier; -import software.bernie.geckolib3.model.AnimatedGeoModel; +import software.bernie.geckolib.model.GeoModel; import static com.eightsidedsquare.angling.core.AnglingMod.MOD_ID; -public class AnemoneBlockEntityModel extends AnimatedGeoModel { +public class AnemoneBlockEntityModel extends GeoModel { @Override public Identifier getModelResource(AnemoneBlockEntity object) { return new Identifier(MOD_ID, "geo/anemone.geo.json"); @@ -21,10 +21,4 @@ public Identifier getTextureResource(AnemoneBlockEntity entity) { public Identifier getAnimationResource(AnemoneBlockEntity animatable) { return new Identifier(MOD_ID, "animations/anemone.animation.json"); } - - @Override - public void setLivingAnimations(AnemoneBlockEntity entity, Integer uniqueID) { - - super.setLivingAnimations(entity, uniqueID); - } } diff --git a/src/main/java/com/eightsidedsquare/angling/client/model/BasicEntityModel.java b/src/main/java/com/eightsidedsquare/angling/client/model/BasicEntityModel.java index 732d7e1..49da504 100644 --- a/src/main/java/com/eightsidedsquare/angling/client/model/BasicEntityModel.java +++ b/src/main/java/com/eightsidedsquare/angling/client/model/BasicEntityModel.java @@ -3,17 +3,17 @@ import com.eightsidedsquare.angling.core.AnglingUtil; import net.minecraft.entity.LivingEntity; import net.minecraft.util.Identifier; -import software.bernie.geckolib3.core.IAnimatable; -import software.bernie.geckolib3.core.event.predicate.AnimationEvent; -import software.bernie.geckolib3.core.processor.IBone; -import software.bernie.geckolib3.model.AnimatedGeoModel; -import software.bernie.geckolib3.model.provider.data.EntityModelData; - -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; +import software.bernie.geckolib.constant.DataTickets; +import software.bernie.geckolib.core.animatable.GeoAnimatable; +import software.bernie.geckolib.core.animatable.model.CoreGeoBone; +import software.bernie.geckolib.core.animation.AnimationState; +import software.bernie.geckolib.model.GeoModel; +import software.bernie.geckolib.model.data.EntityModelData; import static com.eightsidedsquare.angling.core.AnglingMod.MOD_ID; -public class BasicEntityModel extends AnimatedGeoModel { +public class BasicEntityModel extends GeoModel { private final Identifier model; private final Identifier texture; @@ -57,24 +57,24 @@ public Identifier getAnimationResource(A entity) { } @Override - @SuppressWarnings("unchecked") - public void setLivingAnimations(A entity, Integer uniqueID, AnimationEvent event) { + public void setCustomAnimations(A animatable, long instanceId, AnimationState animationState) { if(!AnglingUtil.isReloadingResources()) { - super.setLivingAnimations(entity, uniqueID, event); + super.setCustomAnimations(animatable, instanceId, animationState); if(liesOutOfWater) { - IBone root = getAnimationProcessor().getBone("root"); - if (!entity.isTouchingWater() && root != null) { - root.setRotationZ((float) (Math.PI / 2d)); + CoreGeoBone root = getAnimationProcessor().getBone("root"); + if (!animatable.isTouchingWater() && root != null) { + root.setRotZ((float) (Math.PI / 2d)); } } if(head != null) { - IBone headBone = this.getAnimationProcessor().getBone(head); - EntityModelData extraData = (EntityModelData) event.getExtraDataOfType(EntityModelData.class).get(0); + CoreGeoBone headBone = this.getAnimationProcessor().getBone(head); + EntityModelData extraData = animationState.getData(DataTickets.ENTITY_MODEL_DATA); if (headBone != null) { - headBone.setRotationX(extraData.headPitch * ((float) Math.PI / 180F)); - headBone.setRotationY(extraData.netHeadYaw * ((float) Math.PI / 180F)); + headBone.setRotX(extraData.headPitch() * ((float) Math.PI / 180F)); + headBone.setRotY(extraData.netHeadYaw() * ((float) Math.PI / 180F)); } } } } + } diff --git a/src/main/java/com/eightsidedsquare/angling/client/model/CrabEntityModel.java b/src/main/java/com/eightsidedsquare/angling/client/model/CrabEntityModel.java index aec191f..4defcee 100644 --- a/src/main/java/com/eightsidedsquare/angling/client/model/CrabEntityModel.java +++ b/src/main/java/com/eightsidedsquare/angling/client/model/CrabEntityModel.java @@ -3,14 +3,15 @@ import com.eightsidedsquare.angling.common.entity.CrabEntity; import com.eightsidedsquare.angling.core.AnglingUtil; import net.minecraft.util.Identifier; -import software.bernie.geckolib3.core.event.predicate.AnimationEvent; -import software.bernie.geckolib3.core.processor.IBone; -import software.bernie.geckolib3.model.AnimatedGeoModel; -import software.bernie.geckolib3.model.provider.data.EntityModelData; +import software.bernie.geckolib.constant.DataTickets; +import software.bernie.geckolib.core.animatable.model.CoreGeoBone; +import software.bernie.geckolib.core.animation.AnimationState; +import software.bernie.geckolib.model.GeoModel; +import software.bernie.geckolib.model.data.EntityModelData; import static com.eightsidedsquare.angling.core.AnglingMod.MOD_ID; -public class CrabEntityModel extends AnimatedGeoModel { +public class CrabEntityModel extends GeoModel { @Override public Identifier getModelResource(CrabEntity entity) { @@ -27,21 +28,21 @@ public Identifier getAnimationResource(CrabEntity entity) { return new Identifier(MOD_ID, "animations/crab.animation.json"); } - @Override @SuppressWarnings("unchecked") - public void setLivingAnimations(CrabEntity entity, Integer uniqueID, AnimationEvent event) { + @Override + public void setCustomAnimations(CrabEntity animatable, long instanceId, AnimationState animationState) { if(!AnglingUtil.isReloadingResources()) { - super.setLivingAnimations(entity, uniqueID, event); - IBone root = getAnimationProcessor().getBone("root"); - IBone eyes = getAnimationProcessor().getBone("eyes"); - EntityModelData extraData = (EntityModelData) event.getExtraDataOfType(EntityModelData.class).get(0); + super.setCustomAnimations(animatable, instanceId, animationState); + CoreGeoBone root = getAnimationProcessor().getBone("root"); + CoreGeoBone eyes = getAnimationProcessor().getBone("eyes"); + EntityModelData extraData = animationState.getData(DataTickets.ENTITY_MODEL_DATA); if (eyes != null) { - eyes.setRotationX(extraData.headPitch * ((float) Math.PI / 180F)); + eyes.setRotX(extraData.headPitch() * ((float) Math.PI / 180F)); } - if(extraData.isChild && root != null) { + if(extraData.isChild() && root != null) { root.setScaleX(0.35f); root.setScaleY(0.35f); root.setScaleZ(0.35f); - root.setPositionY(-1.75f); + root.setPosY(-1.75f); } } } diff --git a/src/main/java/com/eightsidedsquare/angling/client/model/DongfishEntityModel.java b/src/main/java/com/eightsidedsquare/angling/client/model/DongfishEntityModel.java index 1d7c89d..8efd941 100644 --- a/src/main/java/com/eightsidedsquare/angling/client/model/DongfishEntityModel.java +++ b/src/main/java/com/eightsidedsquare/angling/client/model/DongfishEntityModel.java @@ -2,8 +2,8 @@ import com.eightsidedsquare.angling.common.entity.DongfishEntity; import com.eightsidedsquare.angling.core.AnglingUtil; -import software.bernie.geckolib3.core.event.predicate.AnimationEvent; -import software.bernie.geckolib3.core.processor.IBone; +import software.bernie.geckolib.core.animatable.model.CoreGeoBone; +import software.bernie.geckolib.core.animation.AnimationState; public class DongfishEntityModel extends BasicEntityModel { @@ -12,12 +12,12 @@ public DongfishEntityModel() { } @Override - public void setLivingAnimations(DongfishEntity entity, Integer uniqueID, AnimationEvent customPredicate) { - super.setLivingAnimations(entity, uniqueID, customPredicate); + public void setCustomAnimations(DongfishEntity animatable, long instanceId, AnimationState animationState) { + super.setCustomAnimations(animatable, instanceId, animationState); if(!AnglingUtil.isReloadingResources()) { - IBone scungle = getAnimationProcessor().getBone("scungle"); + CoreGeoBone scungle = getAnimationProcessor().getBone("scungle"); if(scungle != null) { - scungle.setHidden(!entity.hasHorngus()); + scungle.setHidden(!animatable.hasHorngus()); } } } diff --git a/src/main/java/com/eightsidedsquare/angling/client/model/NautilusEntityModel.java b/src/main/java/com/eightsidedsquare/angling/client/model/NautilusEntityModel.java index e106d8c..8566e53 100644 --- a/src/main/java/com/eightsidedsquare/angling/client/model/NautilusEntityModel.java +++ b/src/main/java/com/eightsidedsquare/angling/client/model/NautilusEntityModel.java @@ -2,8 +2,8 @@ import com.eightsidedsquare.angling.common.entity.NautilusEntity; import com.eightsidedsquare.angling.core.AnglingUtil; -import software.bernie.geckolib3.core.event.predicate.AnimationEvent; -import software.bernie.geckolib3.core.processor.IBone; +import software.bernie.geckolib.core.animatable.model.CoreGeoBone; +import software.bernie.geckolib.core.animation.AnimationState; public class NautilusEntityModel extends BasicEntityModel { public NautilusEntityModel() { @@ -11,13 +11,13 @@ public NautilusEntityModel() { } @Override - public void setLivingAnimations(NautilusEntity entity, Integer uniqueID, AnimationEvent customPredicate) { + public void setCustomAnimations(NautilusEntity animatable, long instanceId, AnimationState animationState) { if(!AnglingUtil.isReloadingResources()) { - super.setLivingAnimations(entity, uniqueID, customPredicate); - IBone root = getAnimationProcessor().getBone("root"); - if(!entity.isTouchingWater() && root != null) { - root.setRotationZ((float) (Math.PI / -2d)); - root.setPositionY(-1.5f); + super.setCustomAnimations(animatable, instanceId, animationState); + CoreGeoBone root = getAnimationProcessor().getBone("root"); + if(!animatable.isTouchingWater() && root != null) { + root.setRotZ((float) (Math.PI / -2d)); + root.setPosY(-1.5f); } } } diff --git a/src/main/java/com/eightsidedsquare/angling/client/model/StarfishBlockEntityModel.java b/src/main/java/com/eightsidedsquare/angling/client/model/StarfishBlockEntityModel.java index ef30d2d..46b02d8 100644 --- a/src/main/java/com/eightsidedsquare/angling/client/model/StarfishBlockEntityModel.java +++ b/src/main/java/com/eightsidedsquare/angling/client/model/StarfishBlockEntityModel.java @@ -5,13 +5,18 @@ import com.eightsidedsquare.angling.core.AnglingUtil; import net.minecraft.util.Identifier; import net.minecraft.util.math.Vec3i; -import software.bernie.geckolib3.model.AnimatedGeoModel; +import software.bernie.geckolib.core.animation.AnimationState; +import software.bernie.geckolib.model.GeoModel; import java.util.Optional; import static com.eightsidedsquare.angling.core.AnglingMod.MOD_ID; -public class StarfishBlockEntityModel extends AnimatedGeoModel { +public class StarfishBlockEntityModel extends GeoModel { + + public StarfishBlockEntityModel() { + } + @Override public Identifier getModelResource(StarfishBlockEntity object) { return new Identifier(MOD_ID, "geo/starfish.geo.json"); @@ -30,17 +35,17 @@ public Identifier getAnimationResource(StarfishBlockEntity animatable) { } @Override - public void setLivingAnimations(StarfishBlockEntity entity, Integer uniqueID) { + public void setCustomAnimations(StarfishBlockEntity animatable, long instanceId, AnimationState animationState) { if(!AnglingUtil.isReloadingResources()){ - super.setLivingAnimations(entity, uniqueID); + super.setCustomAnimations(animatable, instanceId, animationState); Optional.ofNullable(getAnimationProcessor().getBone("root")).ifPresent(bone -> { - Vec3i rotation = entity.getRotation(); - bone.setRotationX((float) Math.toRadians(rotation.getX())); - bone.setRotationY((float) Math.toRadians(rotation.getY())); - bone.setRotationZ((float) Math.toRadians(rotation.getZ())); + Vec3i rotation = animatable.getRotation(); + bone.setRotX((float) Math.toRadians(rotation.getX())); + bone.setRotY((float) Math.toRadians(rotation.getY())); + bone.setRotZ((float) Math.toRadians(rotation.getZ())); }); Optional.ofNullable(getAnimationProcessor().getBone("starfish")).ifPresent(bone -> - bone.setRotationY((float) entity.getRandomRotation())); + bone.setRotZ((float) animatable.getRandomRotation())); } } } diff --git a/src/main/java/com/eightsidedsquare/angling/client/model/SunfishEntityModel.java b/src/main/java/com/eightsidedsquare/angling/client/model/SunfishEntityModel.java index e110241..7be12bc 100644 --- a/src/main/java/com/eightsidedsquare/angling/client/model/SunfishEntityModel.java +++ b/src/main/java/com/eightsidedsquare/angling/client/model/SunfishEntityModel.java @@ -2,19 +2,13 @@ import com.eightsidedsquare.angling.common.entity.SunfishEntity; import com.eightsidedsquare.angling.common.entity.util.SunfishVariant; -import com.eightsidedsquare.angling.core.AnglingUtil; import net.minecraft.util.Identifier; -import org.jetbrains.annotations.Nullable; -import software.bernie.geckolib3.core.event.predicate.AnimationEvent; -import software.bernie.geckolib3.core.processor.IBone; -import software.bernie.geckolib3.model.AnimatedGeoModel; - -import static com.eightsidedsquare.angling.core.AnglingMod.MOD_ID; public class SunfishEntityModel extends BasicEntityModel { public SunfishEntityModel() { super("sunfish", true); } + @Override public Identifier getTextureResource(SunfishEntity entity) { SunfishVariant variant = entity.getVariant(); diff --git a/src/main/java/com/eightsidedsquare/angling/client/model/UrchinBlockEntityModel.java b/src/main/java/com/eightsidedsquare/angling/client/model/UrchinBlockEntityModel.java index e7936b6..1385e66 100644 --- a/src/main/java/com/eightsidedsquare/angling/client/model/UrchinBlockEntityModel.java +++ b/src/main/java/com/eightsidedsquare/angling/client/model/UrchinBlockEntityModel.java @@ -2,11 +2,11 @@ import com.eightsidedsquare.angling.common.entity.UrchinBlockEntity; import net.minecraft.util.Identifier; -import software.bernie.geckolib3.model.AnimatedGeoModel; +import software.bernie.geckolib.model.GeoModel; import static com.eightsidedsquare.angling.core.AnglingMod.MOD_ID; -public class UrchinBlockEntityModel extends AnimatedGeoModel { +public class UrchinBlockEntityModel extends GeoModel { @Override public Identifier getModelResource(UrchinBlockEntity object) { diff --git a/src/main/java/com/eightsidedsquare/angling/client/particle/AlgaeParticle.java b/src/main/java/com/eightsidedsquare/angling/client/particle/AlgaeParticle.java index 70d0244..1b1f8d1 100644 --- a/src/main/java/com/eightsidedsquare/angling/client/particle/AlgaeParticle.java +++ b/src/main/java/com/eightsidedsquare/angling/client/particle/AlgaeParticle.java @@ -4,7 +4,7 @@ import net.minecraft.client.particle.*; import net.minecraft.client.world.ClientWorld; import net.minecraft.particle.DefaultParticleType; -import net.minecraft.tag.FluidTags; +import net.minecraft.registry.tag.FluidTags; import net.minecraft.util.Util; import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.Nullable; @@ -21,7 +21,7 @@ protected AlgaeParticle(ClientWorld clientWorld, double x, double y, double z, d @Override public void tick() { super.tick(); - if (!this.dead && !this.world.getFluidState(new BlockPos(this.x, this.y, this.z)).isIn(FluidTags.WATER)) { + if (!this.dead && !this.world.getFluidState(BlockPos.ofFloored(this.x, this.y, this.z)).isIn(FluidTags.WATER)) { this.markDead(); } } diff --git a/src/main/java/com/eightsidedsquare/angling/client/particle/WormParticle.java b/src/main/java/com/eightsidedsquare/angling/client/particle/WormParticle.java index f7301c0..60462ce 100644 --- a/src/main/java/com/eightsidedsquare/angling/client/particle/WormParticle.java +++ b/src/main/java/com/eightsidedsquare/angling/client/particle/WormParticle.java @@ -1,12 +1,22 @@ package com.eightsidedsquare.angling.client.particle; import net.minecraft.block.Block; -import net.minecraft.client.particle.*; +import net.minecraft.client.particle.Particle; +import net.minecraft.client.particle.ParticleFactory; +import net.minecraft.client.particle.ParticleTextureSheet; +import net.minecraft.client.particle.SpriteBillboardParticle; +import net.minecraft.client.particle.SpriteProvider; import net.minecraft.client.render.Camera; import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.world.ClientWorld; import net.minecraft.particle.DefaultParticleType; -import net.minecraft.util.math.*; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.RotationAxis; +import net.minecraft.util.math.Vec3d; +import org.joml.Quaternionf; +import org.joml.Vector3f; public class WormParticle extends SpriteBillboardParticle { @@ -25,8 +35,8 @@ public void buildGeometry(VertexConsumer vertexConsumer, Camera camera, float ti float currentX = (float)(MathHelper.lerp(tickDelta, this.prevPosX, this.x) - vec3d.getX()); float currentY = (float)(MathHelper.lerp(tickDelta, this.prevPosY, this.y) - vec3d.getY()); float currentZ = (float)(MathHelper.lerp(tickDelta, this.prevPosZ, this.z) - vec3d.getZ()); - Quaternion quaternion = Vec3f.POSITIVE_Y.getDegreesQuaternion(-camera.getYaw()); - Quaternion flip = Vec3f.POSITIVE_Y.getDegreesQuaternion(180 - camera.getYaw()); + Quaternionf quaternion = RotationAxis.POSITIVE_Y.rotationDegrees(-camera.getYaw()); + Quaternionf flip = RotationAxis.POSITIVE_Y.rotationDegrees(180 - camera.getYaw()); float size = this.getSize(tickDelta); float minU = this.getMinU(); @@ -39,19 +49,19 @@ public void buildGeometry(VertexConsumer vertexConsumer, Camera camera, float ti renderFace(vertexConsumer, flip, size, currentX, currentY, currentZ, minU, maxU, minV, maxV, light); } - private void renderFace(VertexConsumer vertexConsumer, Quaternion quaternion, float size, float x, float y, float z, float minU, float maxU, float minV, float maxV, int light) { - Vec3f[] vec3fs = new Vec3f[]{new Vec3f(-1.0F, -1.0F, 0.0F), new Vec3f(-1.0F, 1.0F, 0.0F), new Vec3f(1.0F, 1.0F, 0.0F), new Vec3f(1.0F, -1.0F, 0.0F)}; + private void renderFace(VertexConsumer vertexConsumer, Quaternionf quaternion, float size, float x, float y, float z, float minU, float maxU, float minV, float maxV, int light) { + Vector3f[] vec3fs = new Vector3f[]{new Vector3f(-1.0F, -1.0F, 0.0F), new Vector3f(-1.0F, 1.0F, 0.0F), new Vector3f(1.0F, 1.0F, 0.0F), new Vector3f(1.0F, -1.0F, 0.0F)}; for(int k = 0; k < 4; ++k) { - Vec3f vec3f2 = vec3fs[k]; + Vector3f vec3f2 = vec3fs[k]; vec3f2.rotate(quaternion); - vec3f2.scale(size); + vec3f2.mul(size); vec3f2.add(x, y, z); } - vertexConsumer.vertex(vec3fs[0].getX(), vec3fs[0].getY(), vec3fs[0].getZ()).texture(maxU, maxV).color(this.red, this.green, this.blue, this.alpha).light(light).next(); - vertexConsumer.vertex(vec3fs[1].getX(), vec3fs[1].getY(), vec3fs[1].getZ()).texture(maxU, minV).color(this.red, this.green, this.blue, this.alpha).light(light).next(); - vertexConsumer.vertex(vec3fs[2].getX(), vec3fs[2].getY(), vec3fs[2].getZ()).texture(minU, minV).color(this.red, this.green, this.blue, this.alpha).light(light).next(); - vertexConsumer.vertex(vec3fs[3].getX(), vec3fs[3].getY(), vec3fs[3].getZ()).texture(minU, maxV).color(this.red, this.green, this.blue, this.alpha).light(light).next(); + vertexConsumer.vertex(vec3fs[0].x(), vec3fs[0].y(), vec3fs[0].z()).texture(maxU, maxV).color(this.red, this.green, this.blue, this.alpha).light(light).next(); + vertexConsumer.vertex(vec3fs[1].x(), vec3fs[1].y(), vec3fs[1].z()).texture(maxU, minV).color(this.red, this.green, this.blue, this.alpha).light(light).next(); + vertexConsumer.vertex(vec3fs[2].x(), vec3fs[2].y(), vec3fs[2].z()).texture(minU, minV).color(this.red, this.green, this.blue, this.alpha).light(light).next(); + vertexConsumer.vertex(vec3fs[3].x(), vec3fs[3].y(), vec3fs[3].z()).texture(minU, maxV).color(this.red, this.green, this.blue, this.alpha).light(light).next(); } @Override @@ -69,7 +79,7 @@ public void tick() { setVelocity(0, 0, 0); } super.tick(); - if(!Block.isFaceFullSquare(world.getBlockState(new BlockPos(x, y - 0.5d, z)).getSidesShape(world, new BlockPos(x, y - 0.5d, z)), Direction.UP)) { + if(!Block.isFaceFullSquare(world.getBlockState(BlockPos.ofFloored(x, y - 0.5d, z)).getSidesShape(world, BlockPos.ofFloored(x, y - 0.5d, z)), Direction.UP)) { markDead(); } setSpriteForAge(this.spriteProvider); diff --git a/src/main/java/com/eightsidedsquare/angling/client/renderer/AnemoneBlockEntityRenderer.java b/src/main/java/com/eightsidedsquare/angling/client/renderer/AnemoneBlockEntityRenderer.java index c7ba68c..7c43fe2 100644 --- a/src/main/java/com/eightsidedsquare/angling/client/renderer/AnemoneBlockEntityRenderer.java +++ b/src/main/java/com/eightsidedsquare/angling/client/renderer/AnemoneBlockEntityRenderer.java @@ -3,12 +3,10 @@ import com.eightsidedsquare.angling.client.model.AnemoneBlockEntityModel; import com.eightsidedsquare.angling.common.entity.AnemoneBlockEntity; import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.Identifier; -import software.bernie.geckolib3.renderers.geo.GeoBlockRenderer; +import software.bernie.geckolib.renderer.GeoBlockRenderer; public class AnemoneBlockEntityRenderer extends GeoBlockRenderer { @@ -17,7 +15,7 @@ public AnemoneBlockEntityRenderer(BlockEntityRendererFactory.Context ctx) { } @Override - public RenderLayer getRenderType(AnemoneBlockEntity animatable, float partialTicks, MatrixStack stack, VertexConsumerProvider renderTypeBuffer, VertexConsumer vertexBuilder, int packedLightIn, Identifier textureLocation) { - return RenderLayer.getEntityTranslucent(getTextureResource(animatable)); + public RenderLayer getRenderType(AnemoneBlockEntity animatable, Identifier texture, VertexConsumerProvider bufferSource, float partialTick) { + return RenderLayer.getEntityTranslucent(getTextureLocation(animatable)); } } diff --git a/src/main/java/com/eightsidedsquare/angling/client/renderer/AnglerfishEntityRenderer.java b/src/main/java/com/eightsidedsquare/angling/client/renderer/AnglerfishEntityRenderer.java index fdc6a28..af05685 100644 --- a/src/main/java/com/eightsidedsquare/angling/client/renderer/AnglerfishEntityRenderer.java +++ b/src/main/java/com/eightsidedsquare/angling/client/renderer/AnglerfishEntityRenderer.java @@ -6,9 +6,10 @@ import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.Identifier; -import software.bernie.geckolib3.renderers.geo.GeoEntityRenderer; -import software.bernie.geckolib3.renderers.geo.GeoLayerRenderer; -import software.bernie.geckolib3.renderers.geo.IGeoRenderer; +import software.bernie.geckolib.cache.object.BakedGeoModel; +import software.bernie.geckolib.renderer.GeoEntityRenderer; +import software.bernie.geckolib.renderer.GeoRenderer; +import software.bernie.geckolib.renderer.layer.GeoRenderLayer; import static com.eightsidedsquare.angling.core.AnglingMod.MOD_ID; @@ -18,33 +19,27 @@ public class AnglerfishEntityRenderer extends GeoEntityRenderer("anglerfish", true)); - addLayer(new AnglerfishLayerRenderer(this)); + addRenderLayer(new AnglerfishLayerRenderer(this)); } @Override - public RenderLayer getRenderType(AnglerfishEntity entity, float partialTicks, MatrixStack stack, VertexConsumerProvider renderTypeBuffer, VertexConsumer vertexBuilder, int packedLightIn, Identifier textureLocation) { - return RenderLayer.getEntityTranslucent(getTextureResource(entity)); + public RenderLayer getRenderType(AnglerfishEntity animatable, Identifier texture, VertexConsumerProvider bufferSource, float partialTick) { + return RenderLayer.getEntityTranslucent(getTextureLocation(animatable)); } - static class AnglerfishLayerRenderer extends GeoLayerRenderer { + static class AnglerfishLayerRenderer extends GeoRenderLayer { - public AnglerfishLayerRenderer(IGeoRenderer entityRendererIn) { + public AnglerfishLayerRenderer(GeoRenderer entityRendererIn) { super(entityRendererIn); } @Override - public void render(MatrixStack matrixStackIn, VertexConsumerProvider bufferIn, int packedLightIn, AnglerfishEntity entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) { + public void render(MatrixStack poseStack, AnglerfishEntity animatable, BakedGeoModel bakedModel, RenderLayer renderType, VertexConsumerProvider bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) { int overlay = OverlayTexture.getUv(0, - entity.hurtTime > 0 || entity.deathTime > 0); + animatable.hurtTime > 0 || animatable.deathTime > 0); - this.getRenderer().render(this.getEntityModel().getModel(getEntityModel().getModelResource(entity)), entity, partialTicks, this.getRenderType(OVERLAY), matrixStackIn, bufferIn, - bufferIn.getBuffer(this.getRenderType(OVERLAY)), LightmapTextureManager.MAX_LIGHT_COORDINATE, overlay, 1, 1, 1, 1); - } - - @Override - public RenderLayer getRenderType(Identifier texture) { - return RenderLayer.getEntityCutoutNoCull(texture); + super.render(poseStack, animatable, bakedModel, renderType, bufferSource, buffer, partialTick, packedLight, overlay); } } } diff --git a/src/main/java/com/eightsidedsquare/angling/client/renderer/BasicEntityRenderer.java b/src/main/java/com/eightsidedsquare/angling/client/renderer/BasicEntityRenderer.java index ca80f95..514ffc1 100644 --- a/src/main/java/com/eightsidedsquare/angling/client/renderer/BasicEntityRenderer.java +++ b/src/main/java/com/eightsidedsquare/angling/client/renderer/BasicEntityRenderer.java @@ -2,36 +2,34 @@ import com.eightsidedsquare.angling.client.model.BasicEntityModel; import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.entity.EntityRendererFactory; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.LivingEntity; import net.minecraft.util.Identifier; -import software.bernie.geckolib3.core.IAnimatable; -import software.bernie.geckolib3.model.AnimatedGeoModel; -import software.bernie.geckolib3.renderers.geo.GeoEntityRenderer; +import software.bernie.geckolib.core.animatable.GeoAnimatable; +import software.bernie.geckolib.model.GeoModel; +import software.bernie.geckolib.renderer.GeoEntityRenderer; -public class BasicEntityRenderer extends GeoEntityRenderer { +public class BasicEntityRenderer extends GeoEntityRenderer { - public BasicEntityRenderer(EntityRendererFactory.Context ctx, AnimatedGeoModel modelProvider) { + public BasicEntityRenderer(EntityRendererFactory.Context ctx, GeoModel modelProvider) { super(ctx, modelProvider); } - public static EntityRendererFactory create(AnimatedGeoModel model) { + public static EntityRendererFactory create(GeoModel model) { return ctx -> new BasicEntityRenderer<>(ctx, model); } - public static EntityRendererFactory create(String name, boolean liesOutOfWater) { + public static EntityRendererFactory create(String name, boolean liesOutOfWater) { return ctx -> new BasicEntityRenderer<>(ctx, new BasicEntityModel<>(name, liesOutOfWater)); } - public static EntityRendererFactory create(String name, boolean liesOutOfWater, String head) { + public static EntityRendererFactory create(String name, boolean liesOutOfWater, String head) { return ctx -> new BasicEntityRenderer<>(ctx, new BasicEntityModel<>(name, liesOutOfWater, head)); } @Override - public RenderLayer getRenderType(A entity, float partialTicks, MatrixStack stack, VertexConsumerProvider renderTypeBuffer, VertexConsumer vertexBuilder, int packedLightIn, Identifier textureLocation) { - return RenderLayer.getEntityTranslucent(getTextureResource(entity)); + public RenderLayer getRenderType(A animatable, Identifier texture, VertexConsumerProvider bufferSource, float partialTick) { + return RenderLayer.getEntityTranslucent(getTextureLocation(animatable)); } } diff --git a/src/main/java/com/eightsidedsquare/angling/client/renderer/FryEntityRenderer.java b/src/main/java/com/eightsidedsquare/angling/client/renderer/FryEntityRenderer.java index a733baa..a29b1de 100644 --- a/src/main/java/com/eightsidedsquare/angling/client/renderer/FryEntityRenderer.java +++ b/src/main/java/com/eightsidedsquare/angling/client/renderer/FryEntityRenderer.java @@ -4,46 +4,47 @@ import com.eightsidedsquare.angling.common.entity.FryEntity; import net.minecraft.client.render.OverlayTexture; import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.Identifier; -import software.bernie.geckolib3.renderers.geo.GeoEntityRenderer; -import software.bernie.geckolib3.renderers.geo.GeoLayerRenderer; -import software.bernie.geckolib3.renderers.geo.IGeoRenderer; +import software.bernie.geckolib.renderer.GeoEntityRenderer; +import software.bernie.geckolib.renderer.GeoRenderer; +import software.bernie.geckolib.renderer.layer.GeoRenderLayer; import static com.eightsidedsquare.angling.core.AnglingMod.MOD_ID; public class FryEntityRenderer extends GeoEntityRenderer { public FryEntityRenderer(EntityRendererFactory.Context ctx) { super(ctx, new FryEntityModel()); - addLayer(new FryEntityLayerRenderer(this)); + addRenderLayer(new FryEntityLayerRenderer(this)); } @Override - public RenderLayer getRenderType(FryEntity animatable, float partialTicks, MatrixStack stack, VertexConsumerProvider renderTypeBuffer, VertexConsumer vertexBuilder, int packedLightIn, Identifier textureLocation) { - return RenderLayer.getEntityTranslucent(getTextureResource(animatable)); + public RenderLayer getRenderType(FryEntity animatable, Identifier texture, VertexConsumerProvider bufferSource, float partialTick) { + return RenderLayer.getEntityTranslucent(getTextureLocation(animatable)); } - static class FryEntityLayerRenderer extends GeoLayerRenderer { + static class FryEntityLayerRenderer extends GeoRenderLayer { private static final Identifier OUTSIDE_LAYER = new Identifier(MOD_ID, "textures/entity/fry/fry.png"); private static final Identifier INSIDE_LAYER = new Identifier(MOD_ID, "textures/entity/fry/fry_innards.png"); private static final Identifier MODEL = new Identifier(MOD_ID, "geo/fry.geo.json"); - public FryEntityLayerRenderer(IGeoRenderer entityRendererIn) { + public FryEntityLayerRenderer(GeoRenderer entityRendererIn) { super(entityRendererIn); } private void render(Identifier layer, MatrixStack matrixStackIn, VertexConsumerProvider bufferIn, int packedLightIn, int overlay, FryEntity entity, float partialTicks, float r, float g, float b) { RenderLayer renderLayer = RenderLayer.getEntityTranslucent(layer); matrixStackIn.push(); - this.getRenderer().render(this.getEntityModel().getModel(MODEL), entity, partialTicks, renderLayer, matrixStackIn, bufferIn, + /*this.getRenderer().(this.getEntityModel().getModel(MODEL), entity, partialTicks, renderLayer, matrixStackIn, bufferIn, bufferIn.getBuffer(renderLayer), packedLightIn, overlay, r, g, b, 1f); + + */ matrixStackIn.pop(); } - @Override + public void render(MatrixStack matrixStackIn, VertexConsumerProvider bufferIn, int packedLightIn, FryEntity entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) { int color = entity.getColor(); float r = ((color >> 16) & 0xFF) / 255f; diff --git a/src/main/java/com/eightsidedsquare/angling/client/renderer/NautilusEntityRenderer.java b/src/main/java/com/eightsidedsquare/angling/client/renderer/NautilusEntityRenderer.java index c1df9de..046b64c 100644 --- a/src/main/java/com/eightsidedsquare/angling/client/renderer/NautilusEntityRenderer.java +++ b/src/main/java/com/eightsidedsquare/angling/client/renderer/NautilusEntityRenderer.java @@ -7,13 +7,14 @@ import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.util.math.MatrixStack; -import software.bernie.geckolib3.geo.render.built.GeoModel; +import software.bernie.geckolib.model.GeoModel; public class NautilusEntityRenderer extends BasicEntityRenderer { public NautilusEntityRenderer(EntityRendererFactory.Context ctx) { super(ctx, new NautilusEntityModel()); } + /* @Override public void render(GeoModel model, NautilusEntity animatable, float partialTicks, RenderLayer type, MatrixStack matrices, VertexConsumerProvider renderTypeBuffer, VertexConsumer vertexBuilder, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) { matrices.push(); @@ -21,4 +22,7 @@ public void render(GeoModel model, NautilusEntity animatable, float partialTicks super.render(model, animatable, partialTicks, type, matrices, renderTypeBuffer, vertexBuilder, packedLightIn, packedOverlayIn, red, green, blue, alpha); matrices.pop(); } + + + */ } diff --git a/src/main/java/com/eightsidedsquare/angling/client/renderer/PelicanEntityRenderer.java b/src/main/java/com/eightsidedsquare/angling/client/renderer/PelicanEntityRenderer.java index 38b22a8..ca34bb9 100644 --- a/src/main/java/com/eightsidedsquare/angling/client/renderer/PelicanEntityRenderer.java +++ b/src/main/java/com/eightsidedsquare/angling/client/renderer/PelicanEntityRenderer.java @@ -8,13 +8,11 @@ import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.client.util.math.Vector3d; import net.minecraft.entity.Entity; -import net.minecraft.util.math.Quaternion; -import net.minecraft.util.math.Vec3f; import org.jetbrains.annotations.Nullable; -import software.bernie.geckolib3.geo.render.built.GeoBone; -import software.bernie.geckolib3.util.RenderUtils; +import org.joml.Vector3d; +import software.bernie.geckolib.cache.object.GeoBone; +import software.bernie.geckolib.util.RenderUtils; public class PelicanEntityRenderer extends BasicEntityRenderer { @@ -28,7 +26,7 @@ public PelicanEntityRenderer(EntityRendererFactory.Context ctx) { entityRenderDispatcher = ctx.getRenderDispatcher(); this.shadowRadius = 0.35f; } - +/* @Override public void renderEarly(PelicanEntity entity, MatrixStack stackIn, float ticks, VertexConsumerProvider renderTypeBuffer, VertexConsumer vertexBuilder, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float tickDelta) { this.vertexConsumerProvider = renderTypeBuffer; @@ -73,6 +71,6 @@ public void renderRecursively(GeoBone bone, MatrixStack stack, VertexConsumer bu super.renderRecursively(bone, stack, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha); } - +*/ } diff --git a/src/main/java/com/eightsidedsquare/angling/client/renderer/SeaSlugEntityRenderer.java b/src/main/java/com/eightsidedsquare/angling/client/renderer/SeaSlugEntityRenderer.java index 147cd1e..c5f038d 100644 --- a/src/main/java/com/eightsidedsquare/angling/client/renderer/SeaSlugEntityRenderer.java +++ b/src/main/java/com/eightsidedsquare/angling/client/renderer/SeaSlugEntityRenderer.java @@ -9,42 +9,45 @@ import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.Identifier; -import software.bernie.geckolib3.renderers.geo.GeoEntityRenderer; -import software.bernie.geckolib3.renderers.geo.GeoLayerRenderer; -import software.bernie.geckolib3.renderers.geo.IGeoRenderer; +import software.bernie.geckolib.renderer.GeoEntityRenderer; +import software.bernie.geckolib.renderer.GeoRenderer; +import software.bernie.geckolib.renderer.layer.GeoRenderLayer; public class SeaSlugEntityRenderer extends GeoEntityRenderer { public SeaSlugEntityRenderer(EntityRendererFactory.Context ctx) { super(ctx, new BasicEntityModel<>("sea_slug", false)); - this.addLayer(new SeaSlugLayerRenderer(this)); + this.addRenderLayer(new SeaSlugLayerRenderer(this)); this.shadowRadius = 0.1f; } - static class SeaSlugLayerRenderer extends GeoLayerRenderer { + static class SeaSlugLayerRenderer extends GeoRenderLayer { - public SeaSlugLayerRenderer(IGeoRenderer entityRendererIn) { + public SeaSlugLayerRenderer(GeoRenderer entityRendererIn) { super(entityRendererIn); } public void render(int color, Identifier texture, boolean glow, MatrixStack matrixStackIn, VertexConsumerProvider bufferIn, int packedLightIn, SeaSlugEntity entity, float partialTicks) { if(texture != null) { - Identifier model = this.getEntityModel().getModelResource(entity); + Identifier model = this.getGeoModel().getModelResource(entity); float r = ((color >> 16) & 0xff) / 255f; float g = ((color >> 8) & 0xff) / 255f; float b = (color & 0xff) / 255f; int overlay = OverlayTexture.getUv(0, entity.hurtTime > 0 || entity.deathTime > 0); - this.getRenderer().render(this.getEntityModel().getModel(model), entity, partialTicks, this.getRenderType(texture), matrixStackIn, bufferIn, + /* this.getRenderer().renderRecursively(this.getGeoModel().getBakedModel(model), entity, partialTicks, this.getRenderType(texture), matrixStackIn, bufferIn, bufferIn.getBuffer(this.getRenderType(texture)), glow ? LightmapTextureManager.MAX_LIGHT_COORDINATE : packedLightIn, overlay, r, g, b, 1f); + TODO: ALL THIS STUFF + */ } } + /* @Override public void render(MatrixStack matrixStackIn, VertexConsumerProvider bufferIn, int packedLightIn, SeaSlugEntity entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) { - this.render(entity.getBaseColor().color(), this.getEntityTexture(entity), false, matrixStackIn, bufferIn, packedLightIn, entity, partialTicks); + this.render(entity.getBaseColor().color(), this.getTextureResource(entity), false, matrixStackIn, bufferIn, packedLightIn, entity, partialTicks); this.render(entity.getPatternColor().color(), entity.getPattern().texture(), entity.isBioluminescent(), matrixStackIn, bufferIn, packedLightIn, entity, partialTicks); } @@ -52,5 +55,7 @@ public void render(MatrixStack matrixStackIn, VertexConsumerProvider bufferIn, i public RenderLayer getRenderType(Identifier texture) { return RenderLayer.getEntityCutoutNoCull(texture); } + + */ } } diff --git a/src/main/java/com/eightsidedsquare/angling/client/renderer/StarfishBlockEntityRenderer.java b/src/main/java/com/eightsidedsquare/angling/client/renderer/StarfishBlockEntityRenderer.java index 81bab07..cbc074f 100644 --- a/src/main/java/com/eightsidedsquare/angling/client/renderer/StarfishBlockEntityRenderer.java +++ b/src/main/java/com/eightsidedsquare/angling/client/renderer/StarfishBlockEntityRenderer.java @@ -3,54 +3,50 @@ import com.eightsidedsquare.angling.client.model.StarfishBlockEntityModel; import com.eightsidedsquare.angling.common.entity.StarfishBlockEntity; import com.eightsidedsquare.angling.core.AnglingBlocks; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.render.OverlayTexture; import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.Identifier; -import software.bernie.geckolib3.core.util.Color; -import software.bernie.geckolib3.geo.render.built.GeoModel; -import software.bernie.geckolib3.model.AnimatedGeoModel; -import software.bernie.geckolib3.renderers.geo.GeoBlockRenderer; +import software.bernie.geckolib.core.object.Color; +import software.bernie.geckolib.model.GeoModel; +import software.bernie.geckolib.renderer.GeoBlockRenderer; public class StarfishBlockEntityRenderer extends GeoBlockRenderer { - private final AnimatedGeoModel modelProvider; + private final GeoModel modelProvider; public StarfishBlockEntityRenderer(BlockEntityRendererFactory.Context ctx) { super(new StarfishBlockEntityModel()); this.modelProvider = new StarfishBlockEntityModel(); } - @Override - public RenderLayer getRenderType(StarfishBlockEntity animatable, float partialTicks, MatrixStack stack, VertexConsumerProvider renderTypeBuffer, VertexConsumer vertexBuilder, int packedLightIn, Identifier textureLocation) { - return RenderLayer.getEntityTranslucent(getTextureResource(animatable)); + public RenderLayer getRenderType(StarfishBlockEntity animatable, Identifier texture, VertexConsumerProvider bufferSource, float partialTick) { + return RenderLayer.getEntityTranslucent(getTextureLocation(animatable)); } @Override - public Color getRenderColor(StarfishBlockEntity entity, float partialTicks, MatrixStack stack, VertexConsumerProvider renderTypeBuffer, VertexConsumer vertexBuilder, int packedLightIn) { - return entity.getCachedState().isOf(AnglingBlocks.DEAD_STARFISH) ? Color.WHITE : Color.ofOpaque(entity.isRainbow() ? StarfishBlockEntity.getRainbowColor() : entity.getColor()); + public Color getRenderColor(StarfishBlockEntity animatable, float partialTick, int packedLight) { + return animatable.getCachedState().isOf(AnglingBlocks.DEAD_STARFISH) ? Color.WHITE : Color.ofOpaque(animatable.isRainbow() ? StarfishBlockEntity.getRainbowColor() : animatable.getColor()); } + /* + @Override - public void render(StarfishBlockEntity entity, float partialTicks, MatrixStack stack, VertexConsumerProvider bufferIn, - int packedLightIn) { + public void render(StarfishBlockEntity entity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) { if(!entity.isRemoved()){ - GeoModel model = modelProvider.getModel(modelProvider.getModelResource(entity)); - modelProvider.setLivingAnimations(entity, this.getUniqueID(entity)); - stack.push(); - stack.translate(0.5, 0.01, 0.5); - - MinecraftClient.getInstance().getTextureManager().bindTexture(getTextureResource(entity)); - Color renderColor = getRenderColor(entity, partialTicks, stack, bufferIn, null, packedLightIn); - RenderLayer renderType = getRenderType(entity, partialTicks, stack, bufferIn, null, packedLightIn, - getTextureResource(entity)); - render(model, entity, partialTicks, renderType, stack, bufferIn, null, packedLightIn, OverlayTexture.DEFAULT_UV, - (float) renderColor.getRed() / 255f, (float) renderColor.getGreen() / 255f, - (float) renderColor.getBlue() / 255f, (float) renderColor.getAlpha() / 255); - stack.pop(); + BakedGeoModel model = modelProvider.getBakedModel(modelProvider.getModelResource(entity)); + // modelProvider.setCustomAnimations(entity, this.getInstanceId(entity)); + matrices.push(); + matrices.translate(0.5, 0.01, 0.5); + + MinecraftClient.getInstance().getTextureManager().bindTexture(getTextureLocation(entity)); + Color renderColor = getRenderColor(entity, tickDelta, light); + RenderLayer renderType = getRenderType(entity, getTextureLocation(entity), vertexConsumers, tickDelta); + + matrices.pop(); } } + + + */ + } diff --git a/src/main/java/com/eightsidedsquare/angling/client/renderer/UrchinBlockEntityRenderer.java b/src/main/java/com/eightsidedsquare/angling/client/renderer/UrchinBlockEntityRenderer.java index c7009b3..421871f 100644 --- a/src/main/java/com/eightsidedsquare/angling/client/renderer/UrchinBlockEntityRenderer.java +++ b/src/main/java/com/eightsidedsquare/angling/client/renderer/UrchinBlockEntityRenderer.java @@ -1,6 +1,7 @@ package com.eightsidedsquare.angling.client.renderer; import com.eightsidedsquare.angling.client.model.UrchinBlockEntityModel; +import com.eightsidedsquare.angling.common.entity.StarfishBlockEntity; import com.eightsidedsquare.angling.common.entity.UrchinBlockEntity; import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.OverlayTexture; @@ -10,12 +11,15 @@ import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; import net.minecraft.client.render.item.ItemRenderer; import net.minecraft.client.render.model.json.ModelTransformation; +import net.minecraft.client.render.model.json.ModelTransformationMode; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.Identifier; -import net.minecraft.util.math.Quaternion; -import net.minecraft.util.math.Vec3f; -import software.bernie.geckolib3.geo.render.built.GeoBone; -import software.bernie.geckolib3.renderers.geo.GeoBlockRenderer; +import org.joml.Quaternionf; +import org.joml.QuaternionfInterpolator; +import org.joml.Vector3f; +import software.bernie.geckolib.cache.object.BakedGeoModel; +import software.bernie.geckolib.cache.object.GeoBone; +import software.bernie.geckolib.renderer.GeoBlockRenderer; public class UrchinBlockEntityRenderer extends GeoBlockRenderer { @@ -27,29 +31,29 @@ public UrchinBlockEntityRenderer(BlockEntityRendererFactory.Context ctx) { } @Override - public RenderLayer getRenderType(UrchinBlockEntity entity, float partialTicks, MatrixStack stack, VertexConsumerProvider renderTypeBuffer, VertexConsumer vertexBuilder, int packedLightIn, Identifier textureLocation) { - return RenderLayer.getEntityTranslucent(getTextureResource(entity)); + public RenderLayer getRenderType(UrchinBlockEntity animatable, Identifier texture, VertexConsumerProvider bufferSource, float partialTick) { + return RenderLayer.getEntityTranslucent(getTextureLocation(animatable)); } @Override - public void renderEarly(UrchinBlockEntity entity, MatrixStack stackIn, float partialTicks, VertexConsumerProvider renderTypeBuffer, VertexConsumer vertexBuilder, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) { - this.entity = entity; - this.vertexConsumerProvider = renderTypeBuffer; - super.renderEarly(entity, stackIn, partialTicks, renderTypeBuffer, vertexBuilder, packedLightIn, packedOverlayIn, red, green, blue, alpha); + public void preRender(MatrixStack poseStack, UrchinBlockEntity animatable, BakedGeoModel model, VertexConsumerProvider bufferSource, VertexConsumer buffer, boolean isReRender, float partialTick, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { + this.entity = animatable; + this.vertexConsumerProvider = vertexConsumerProvider; + super.preRender(poseStack, animatable, model, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, red, green, blue, alpha); } @Override - public void renderRecursively(GeoBone bone, MatrixStack stack, VertexConsumer bufferIn, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) { + public void renderRecursively(MatrixStack poseStack, UrchinBlockEntity animatable, GeoBone bone, RenderLayer renderType, VertexConsumerProvider bufferSource, VertexConsumer buffer, boolean isReRender, float partialTick, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { if(bone.getName().equals("root")) { ItemRenderer itemRenderer = MinecraftClient.getInstance().getItemRenderer(); - stack.push(); - stack.multiply(Quaternion.fromEulerXyz(new Vec3f(bone.getRotationX(), bone.getRotationY(), bone.getRotationZ()))); - stack.translate(0f, 0.625f, 0f); - stack.scale(0.5f, 0.5f, 0.5f); - itemRenderer.renderItem(entity.getHat(), ModelTransformation.Mode.FIXED, packedLightIn, OverlayTexture.DEFAULT_UV, stack, vertexConsumerProvider, 0); - stack.pop(); - bufferIn = vertexConsumerProvider.getBuffer(RenderLayer.getEntityTranslucent(getTextureResource(entity))); + poseStack.push(); + // poseStack.multiply(Quaternion.fromEulerXyz(new Vector3f(bone.getRotX(), bone.getRotY(), bone.getRotZ()))); TODO: Fix this + poseStack.translate(0f, 0.625f, 0f); + poseStack.scale(0.5f, 0.5f, 0.5f); + itemRenderer.renderItem(entity.getHat(), ModelTransformationMode.FIXED, packedLight, OverlayTexture.DEFAULT_UV, poseStack, vertexConsumerProvider, null,0); + poseStack.pop(); + buffer = vertexConsumerProvider.getBuffer(RenderLayer.getEntityTranslucent(getTextureLocation(entity))); } - super.renderRecursively(bone, stack, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha); + super.renderRecursively(poseStack, animatable, bone, renderType, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, red, green, blue, alpha); } } diff --git a/src/main/java/com/eightsidedsquare/angling/common/block/AlgaeBlock.java b/src/main/java/com/eightsidedsquare/angling/common/block/AlgaeBlock.java index cd5bc0b..61ece7a 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/block/AlgaeBlock.java +++ b/src/main/java/com/eightsidedsquare/angling/common/block/AlgaeBlock.java @@ -10,11 +10,11 @@ import net.minecraft.fluid.Fluids; import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.Items; +import net.minecraft.registry.tag.FluidTags; import net.minecraft.server.world.ServerWorld; import net.minecraft.state.StateManager; import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.Properties; -import net.minecraft.tag.FluidTags; import net.minecraft.util.Util; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; @@ -23,6 +23,7 @@ import net.minecraft.world.BlockView; import net.minecraft.world.World; import net.minecraft.world.WorldAccess; +import net.minecraft.world.WorldView; import org.jetbrains.annotations.Nullable; import java.util.List; @@ -41,7 +42,7 @@ public AlgaeBlock(Settings settings) { public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { if (state.get(WATERLOGGED)) { - world.createAndScheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); } return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos); @@ -51,14 +52,15 @@ public boolean canReplace(BlockState state, ItemPlacementContext context) { return !context.getStack().isOf(Items.GLOW_LICHEN) || super.canReplace(state, context); } - public boolean isFertilizable(BlockView world, BlockPos pos, BlockState state, boolean isClient) { - return canGrow(world, pos, state); - } - public boolean canGrow(BlockView world, BlockPos pos, BlockState state) { return state.get(WATERLOGGED) && Direction.stream().anyMatch((direction) -> this.grower.canGrow(state, world, pos, direction.getOpposite())); } + @Override + public boolean isFertilizable(WorldView world, BlockPos pos, BlockState state, boolean isClient) { + return canGrow(world, pos, state); + } + public boolean canGrow(World world, Random random, BlockPos pos, BlockState state) { return true; } @@ -151,7 +153,7 @@ public void randomDisplayTick(BlockState state, World world, BlockPos pos, Rando double x = random.nextGaussian() + pos.getX(); double y = random.nextGaussian() + pos.getY(); double z = random.nextGaussian() + pos.getZ(); - if(world.getBlockState(new BlockPos(x, y, z)).getFluidState().isIn(FluidTags.WATER)) { + if(world.getBlockState(BlockPos.ofFloored(x, y, z)).getFluidState().isIn(FluidTags.WATER)) { double velocityX = random.nextGaussian() * 0.01d; double velocityY = random.nextGaussian() * 0.01d; double velocityZ = random.nextGaussian() * 0.01d; diff --git a/src/main/java/com/eightsidedsquare/angling/common/block/AnemoneBlock.java b/src/main/java/com/eightsidedsquare/angling/common/block/AnemoneBlock.java index a43259c..e50a74f 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/block/AnemoneBlock.java +++ b/src/main/java/com/eightsidedsquare/angling/common/block/AnemoneBlock.java @@ -39,7 +39,7 @@ protected boolean canPlantOnTop(BlockState floor, BlockView world, BlockPos pos) public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { if (state.get(WATERLOGGED)) { - world.createAndScheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); } if(!canPlaceAt(state, world, pos)) { return Blocks.AIR.getDefaultState(); diff --git a/src/main/java/com/eightsidedsquare/angling/common/block/ClamBlock.java b/src/main/java/com/eightsidedsquare/angling/common/block/ClamBlock.java index a63e1eb..349511b 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/block/ClamBlock.java +++ b/src/main/java/com/eightsidedsquare/angling/common/block/ClamBlock.java @@ -4,11 +4,11 @@ import net.minecraft.fluid.FluidState; import net.minecraft.fluid.Fluids; import net.minecraft.item.ItemPlacementContext; +import net.minecraft.registry.tag.FluidTags; import net.minecraft.server.world.ServerWorld; import net.minecraft.state.StateManager; import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.Properties; -import net.minecraft.tag.FluidTags; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.util.math.Vec3d; @@ -46,12 +46,12 @@ public VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos public BlockState getPlacementState(ItemPlacementContext ctx) { FluidState fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos()); boolean bl = fluidState.getFluid() == Fluids.WATER; - return getDefaultState().with(WATERLOGGED, bl).with(FACING, ctx.getPlayerFacing().getOpposite()); + return getDefaultState().with(WATERLOGGED, bl).with(FACING, ctx.getPlayerLookDirection().getOpposite()); } public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { if (state.get(WATERLOGGED)) { - world.createAndScheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); } if(!canPlaceAt(state, world, pos)) { return Blocks.AIR.getDefaultState(); diff --git a/src/main/java/com/eightsidedsquare/angling/common/block/OystersBlock.java b/src/main/java/com/eightsidedsquare/angling/common/block/OystersBlock.java index 6d6e75c..449f5cd 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/block/OystersBlock.java +++ b/src/main/java/com/eightsidedsquare/angling/common/block/OystersBlock.java @@ -31,7 +31,7 @@ public OystersBlock(Settings settings) { public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { if (state.get(WATERLOGGED)) { - world.createAndScheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); } if(!canPlaceAt(state, world, pos)) { return Blocks.AIR.getDefaultState(); diff --git a/src/main/java/com/eightsidedsquare/angling/common/block/PapyrusBlock.java b/src/main/java/com/eightsidedsquare/angling/common/block/PapyrusBlock.java index fe6ecbc..bc3aa2b 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/block/PapyrusBlock.java +++ b/src/main/java/com/eightsidedsquare/angling/common/block/PapyrusBlock.java @@ -4,12 +4,12 @@ import net.minecraft.fluid.FluidState; import net.minecraft.fluid.Fluids; import net.minecraft.item.ItemPlacementContext; +import net.minecraft.registry.tag.BlockTags; import net.minecraft.server.world.ServerWorld; import net.minecraft.state.StateManager; import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.IntProperty; import net.minecraft.state.property.Properties; -import net.minecraft.tag.BlockTags; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.util.math.Vec3d; @@ -37,7 +37,7 @@ public PapyrusBlock(Settings settings) { public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { if (state.get(WATERLOGGED)) { - world.createAndScheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); } if(!canPlaceAt(state, world, pos)) { return Blocks.AIR.getDefaultState(); @@ -72,7 +72,7 @@ public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { } @Override - public boolean isFertilizable(BlockView world, BlockPos pos, BlockState state, boolean isClient) { + public boolean isFertilizable(WorldView world, BlockPos pos, BlockState state, boolean isClient) { return state.get(AGE) < 2; } diff --git a/src/main/java/com/eightsidedsquare/angling/common/block/RoeBlock.java b/src/main/java/com/eightsidedsquare/angling/common/block/RoeBlock.java index 04a4d7d..3e45388 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/block/RoeBlock.java +++ b/src/main/java/com/eightsidedsquare/angling/common/block/RoeBlock.java @@ -72,7 +72,7 @@ public BlockState getPlacementState(ItemPlacementContext ctx) { public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { if (state.get(WATERLOGGED)) { - world.createAndScheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); } if(!canPlaceAt(state, world, pos)) { return Blocks.AIR.getDefaultState(); @@ -96,7 +96,7 @@ public int getHatchTime(Random random) { @Override public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean notify) { if(state.get(WATERLOGGED)) { - world.createAndScheduleBlockTick(pos, this, getHatchTime(world.getRandom())); + world.scheduleBlockTick(pos, this, getHatchTime(world.getRandom())); } } @@ -118,7 +118,7 @@ public static Pair getRoeColor(FishEntity entity) { SpawnEggItem eggItem = SpawnEggItem.forEntity(entity.getType()); FishSpawningComponent component = AnglingEntityComponents.FISH_SPAWNING.get(entity); if(entity instanceof TropicalFishEntity tropicalFishEntity) { - int parentColor = TropicalFishEntity.getBaseDyeColor(tropicalFishEntity.getVariant()).getSignColor(); + int parentColor = TropicalFishEntity.getBaseDyeColor(tropicalFishEntity.getVariant().getId()).getSignColor(); return new Pair<>(parentColor, component.getMateData() != null ? TropicalFishEntity.getBaseDyeColor(component.getMateData().getInt("Variant")).getSignColor() : parentColor); } diff --git a/src/main/java/com/eightsidedsquare/angling/common/block/SeaSlugEggsBlock.java b/src/main/java/com/eightsidedsquare/angling/common/block/SeaSlugEggsBlock.java index c9ed2c4..0729ad6 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/block/SeaSlugEggsBlock.java +++ b/src/main/java/com/eightsidedsquare/angling/common/block/SeaSlugEggsBlock.java @@ -62,7 +62,7 @@ public BlockState getPlacementState(ItemPlacementContext ctx) { public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { if (state.get(WATERLOGGED)) { - world.createAndScheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); } if(!canPlaceAt(state, world, pos)) { return Blocks.AIR.getDefaultState(); @@ -82,7 +82,7 @@ public int getHatchTime(Random random) { @Override public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean notify) { if(state.get(WATERLOGGED)) { - world.createAndScheduleBlockTick(pos, this, getHatchTime(world.getRandom())); + world.scheduleBlockTick(pos, this, getHatchTime(world.getRandom())); } } diff --git a/src/main/java/com/eightsidedsquare/angling/common/block/StarfishBlock.java b/src/main/java/com/eightsidedsquare/angling/common/block/StarfishBlock.java index e83d118..a959a01 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/block/StarfishBlock.java +++ b/src/main/java/com/eightsidedsquare/angling/common/block/StarfishBlock.java @@ -14,11 +14,11 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; import net.minecraft.particle.ParticleTypes; +import net.minecraft.registry.tag.FluidTags; import net.minecraft.server.world.ServerWorld; import net.minecraft.state.StateManager; import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.Properties; -import net.minecraft.tag.FluidTags; import net.minecraft.util.Util; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -121,7 +121,7 @@ private static int getRandomColor(Random random) { public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean notify) { randomize(world, pos, world.getRandom()); if(shouldDie(state, world, pos)) { - world.createAndScheduleBlockTick(pos, this, 60 + world.getRandom().nextInt(40)); + world.scheduleBlockTick(pos, this, 60 + world.getRandom().nextInt(40)); } super.onBlockAdded(state, world, pos, oldState, notify); } @@ -142,13 +142,13 @@ private boolean shouldDie(BlockState state, WorldAccess world, BlockPos pos) { public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { if (state.get(WATERLOGGED)) { - world.createAndScheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); } if(!canPlaceAt(state, world, pos)) { return Blocks.AIR.getDefaultState(); } if(shouldDie(state, world, pos)) { - world.createAndScheduleBlockTick(pos, this, 60 + world.getRandom().nextInt(40)); + world.scheduleBlockTick(pos, this, 60 + world.getRandom().nextInt(40)); } return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos); diff --git a/src/main/java/com/eightsidedsquare/angling/common/block/UrchinBlock.java b/src/main/java/com/eightsidedsquare/angling/common/block/UrchinBlock.java index c69767b..78bf1ff 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/block/UrchinBlock.java +++ b/src/main/java/com/eightsidedsquare/angling/common/block/UrchinBlock.java @@ -71,7 +71,7 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { if (state.get(WATERLOGGED)) { - world.createAndScheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); } if(!canPlaceAt(state, world, pos)) { return Blocks.AIR.getDefaultState(); diff --git a/src/main/java/com/eightsidedsquare/angling/common/block/WaterFloatingPlant.java b/src/main/java/com/eightsidedsquare/angling/common/block/WaterFloatingPlant.java index e859b0d..6b1f428 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/block/WaterFloatingPlant.java +++ b/src/main/java/com/eightsidedsquare/angling/common/block/WaterFloatingPlant.java @@ -11,6 +11,7 @@ import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.BlockView; import net.minecraft.world.World; +import net.minecraft.world.WorldView; @SuppressWarnings("deprecation") public class WaterFloatingPlant extends PlantBlock implements Fertilizable { @@ -32,7 +33,7 @@ protected boolean canPlantOnTop(BlockState floor, BlockView world, BlockPos pos) } @Override - public boolean isFertilizable(BlockView world, BlockPos pos, BlockState state, boolean isClient) { + public boolean isFertilizable(WorldView world, BlockPos pos, BlockState state, boolean isClient) { for(Direction d : Direction.Type.HORIZONTAL) { BlockPos offsetPos = pos.offset(d).down(); if(canPlantOnTop(world.getBlockState(offsetPos), world, offsetPos) && world.getBlockState(offsetPos.up()).isAir()) { diff --git a/src/main/java/com/eightsidedsquare/angling/common/block/WaterloggableBlock.java b/src/main/java/com/eightsidedsquare/angling/common/block/WaterloggableBlock.java index af40152..180f15b 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/block/WaterloggableBlock.java +++ b/src/main/java/com/eightsidedsquare/angling/common/block/WaterloggableBlock.java @@ -31,7 +31,7 @@ protected void appendProperties(StateManager.Builder builder) public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { if (state.get(WATERLOGGED)) { - world.createAndScheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); } return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos); } diff --git a/src/main/java/com/eightsidedsquare/angling/common/block/WormyBlock.java b/src/main/java/com/eightsidedsquare/angling/common/block/WormyBlock.java index c8e1fdb..7df382f 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/block/WormyBlock.java +++ b/src/main/java/com/eightsidedsquare/angling/common/block/WormyBlock.java @@ -7,12 +7,12 @@ import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; +import net.minecraft.registry.tag.BlockTags; +import net.minecraft.registry.tag.FluidTags; import net.minecraft.server.world.ServerWorld; import net.minecraft.sound.SoundCategory; import net.minecraft.state.StateManager; import net.minecraft.state.property.IntProperty; -import net.minecraft.tag.BlockTags; -import net.minecraft.tag.FluidTags; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/AnemoneBlockEntity.java b/src/main/java/com/eightsidedsquare/angling/common/entity/AnemoneBlockEntity.java index 9b8ae7b..49510de 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/AnemoneBlockEntity.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/AnemoneBlockEntity.java @@ -7,17 +7,18 @@ import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.Nullable; -import software.bernie.geckolib3.core.IAnimatable; -import software.bernie.geckolib3.core.PlayState; -import software.bernie.geckolib3.core.builder.AnimationBuilder; -import software.bernie.geckolib3.core.controller.AnimationController; -import software.bernie.geckolib3.core.event.predicate.AnimationEvent; -import software.bernie.geckolib3.core.manager.AnimationData; -import software.bernie.geckolib3.core.manager.AnimationFactory; +import software.bernie.geckolib.core.animatable.GeoAnimatable; +import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.core.animation.AnimatableManager; +import software.bernie.geckolib.core.animation.AnimationController; +import software.bernie.geckolib.core.animation.AnimationState; +import software.bernie.geckolib.core.animation.RawAnimation; +import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.util.GeckoLibUtil; -public class AnemoneBlockEntity extends BlockEntity implements IAnimatable { +public class AnemoneBlockEntity extends BlockEntity implements GeoAnimatable { - AnimationFactory factory = new AnimationFactory(this); + AnimatableInstanceCache animatableInstanceCache = GeckoLibUtil.createInstanceCache(this); public AnemoneBlockEntity(BlockPos pos, BlockState state) { super(AnglingEntities.ANEMONE, pos, state); @@ -35,17 +36,24 @@ public BlockEntityUpdateS2CPacket toUpdatePacket() { } @Override - public void registerControllers(AnimationData data) { - data.addAnimationController(new AnimationController<>(this, "controller", 0, this::controller)); + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController<>(this, "controller", 0, this::controller)); } - private PlayState controller(AnimationEvent event) { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.anemone.idle", true)); - return PlayState.CONTINUE; + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return animatableInstanceCache; } @Override - public AnimationFactory getFactory() { - return factory; + public double getTick(Object o) { + return 0; } + + private PlayState controller(AnimationState event) { + event.getController().setAnimation(RawAnimation.begin().thenLoop("animation.anemone.idle")); + return PlayState.CONTINUE; + } + + } diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/AnglerfishEntity.java b/src/main/java/com/eightsidedsquare/angling/common/entity/AnglerfishEntity.java index 17c6d84..ba4a198 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/AnglerfishEntity.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/AnglerfishEntity.java @@ -9,17 +9,20 @@ import net.minecraft.sound.SoundEvent; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; -import software.bernie.geckolib3.core.IAnimatable; -import software.bernie.geckolib3.core.PlayState; -import software.bernie.geckolib3.core.builder.AnimationBuilder; -import software.bernie.geckolib3.core.controller.AnimationController; -import software.bernie.geckolib3.core.event.predicate.AnimationEvent; -import software.bernie.geckolib3.core.manager.AnimationData; -import software.bernie.geckolib3.core.manager.AnimationFactory; +import software.bernie.geckolib.core.animatable.GeoAnimatable; +import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.core.animation.AnimatableManager; +import software.bernie.geckolib.core.animation.AnimationController; +import software.bernie.geckolib.core.animation.AnimationState; +import software.bernie.geckolib.core.animation.RawAnimation; +import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.util.GeckoLibUtil; -public class AnglerfishEntity extends FishEntity implements IAnimatable { +public class AnglerfishEntity extends FishEntity implements GeoAnimatable { - AnimationFactory factory = new AnimationFactory(this); + private final RawAnimation flopAnimation = RawAnimation.begin().thenLoop("animation.anglerfish.flop"); + private final RawAnimation idleAnimation = RawAnimation.begin().thenLoop("animation.anglerfish.idle"); + AnimatableInstanceCache animatableInstanceCache = GeckoLibUtil.createInstanceCache(this); public AnglerfishEntity(EntityType entityType, World world) { super(entityType, world); @@ -46,21 +49,27 @@ protected SoundEvent getDeathSound() { public ItemStack getBucketItem() { return new ItemStack(AnglingItems.ANGLERFISH_BUCKET); } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return animatableInstanceCache; + } + @Override - public AnimationFactory getFactory() { - return factory; + public double getTick(Object o) { + return 0; } @Override - public void registerControllers(AnimationData animationData) { - animationData.addAnimationController(new AnimationController<>(this, "controller", 2, this::controller)); + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController<>(this, "controller", 2, this::controller)); } - private PlayState controller(AnimationEvent event) { + private PlayState controller(AnimationState state) { if(!touchingWater) { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.anglerfish.flop", true)); + state.getController().setAnimation(flopAnimation); }else { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.anglerfish.idle", true)); + state.getController().setAnimation(idleAnimation); } return PlayState.CONTINUE; } diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/AnomalocarisEntity.java b/src/main/java/com/eightsidedsquare/angling/common/entity/AnomalocarisEntity.java index f1c96a3..99ce186 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/AnomalocarisEntity.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/AnomalocarisEntity.java @@ -14,17 +14,19 @@ import net.minecraft.world.ServerWorldAccess; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; -import software.bernie.geckolib3.core.IAnimatable; -import software.bernie.geckolib3.core.PlayState; -import software.bernie.geckolib3.core.builder.AnimationBuilder; -import software.bernie.geckolib3.core.controller.AnimationController; -import software.bernie.geckolib3.core.event.predicate.AnimationEvent; -import software.bernie.geckolib3.core.manager.AnimationData; -import software.bernie.geckolib3.core.manager.AnimationFactory; +import software.bernie.geckolib.core.animatable.GeoAnimatable; +import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.core.animation.AnimatableManager; +import software.bernie.geckolib.core.animation.AnimationController; +import software.bernie.geckolib.core.animation.AnimationState; +import software.bernie.geckolib.core.animation.RawAnimation; +import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.util.GeckoLibUtil; -public class AnomalocarisEntity extends FishEntity implements IAnimatable { +public class AnomalocarisEntity extends FishEntity implements GeoAnimatable { - AnimationFactory factory = new AnimationFactory(this); + private final RawAnimation idleAnimation = RawAnimation.begin().thenLoop("animation.anomalocaris.idle"); + AnimatableInstanceCache animatableInstanceCache = GeckoLibUtil.createInstanceCache(this); public AnomalocarisEntity(EntityType entityType, World world) { super(entityType, world); @@ -53,18 +55,23 @@ protected SoundEvent getDeathSound() { } @Override - public void registerControllers(AnimationData animationData) { - animationData.addAnimationController(new AnimationController<>(this, "controller", 2, this::controller)); + public AnimatableInstanceCache getAnimatableInstanceCache() { + return animatableInstanceCache; } - private PlayState controller(AnimationEvent event) { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.anomalocaris.idle", true)); - return PlayState.CONTINUE; + @Override + public double getTick(Object o) { + return 0; } @Override - public AnimationFactory getFactory() { - return factory; + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController<>(this, "controller", 2, this::controller)); + } + + private PlayState controller(AnimationState state) { + state.getController().setAnimation(idleAnimation); + return PlayState.CONTINUE; } @SuppressWarnings({"deprecation", "unused"}) diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/BubbleEyeEntity.java b/src/main/java/com/eightsidedsquare/angling/common/entity/BubbleEyeEntity.java index f44c8ea..3769c38 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/BubbleEyeEntity.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/BubbleEyeEntity.java @@ -9,17 +9,20 @@ import net.minecraft.sound.SoundEvent; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; -import software.bernie.geckolib3.core.IAnimatable; -import software.bernie.geckolib3.core.PlayState; -import software.bernie.geckolib3.core.builder.AnimationBuilder; -import software.bernie.geckolib3.core.controller.AnimationController; -import software.bernie.geckolib3.core.event.predicate.AnimationEvent; -import software.bernie.geckolib3.core.manager.AnimationData; -import software.bernie.geckolib3.core.manager.AnimationFactory; +import software.bernie.geckolib.core.animatable.GeoAnimatable; +import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.core.animation.AnimatableManager; +import software.bernie.geckolib.core.animation.AnimationController; +import software.bernie.geckolib.core.animation.AnimationState; +import software.bernie.geckolib.core.animation.RawAnimation; +import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.util.GeckoLibUtil; -public class BubbleEyeEntity extends SchoolingFishEntity implements IAnimatable { +public class BubbleEyeEntity extends SchoolingFishEntity implements GeoAnimatable { - AnimationFactory factory = new AnimationFactory(this); + private final RawAnimation flopAnimation = RawAnimation.begin().thenLoop("animation.bubble_eye.flop"); + private final RawAnimation idleAnimation = RawAnimation.begin().thenLoop("animation.bubble_eye.idle"); + AnimatableInstanceCache animatableInstanceCache = GeckoLibUtil.createInstanceCache(this); public BubbleEyeEntity(EntityType entityType, World world) { super(entityType, world); @@ -47,22 +50,29 @@ public ItemStack getBucketItem() { return new ItemStack(AnglingItems.BUBBLE_EYE_BUCKET); } + @Override - public void registerControllers(AnimationData animationData) { - animationData.addAnimationController(new AnimationController<>(this, "controller", 2, this::controller)); + public AnimatableInstanceCache getAnimatableInstanceCache() { + return animatableInstanceCache; } - private PlayState controller(AnimationEvent event) { - if(!touchingWater) { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.bubble_eye.flop", true)); - }else { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.bubble_eye.idle", true)); - } - return PlayState.CONTINUE; + @Override + public double getTick(Object o) { + return 0; } @Override - public AnimationFactory getFactory() { - return factory; + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController<>(this, "controller", 2, this::controller)); } + + private PlayState controller(AnimationState event) { + if (!touchingWater) { + event.getController().setAnimation(flopAnimation); + } else { + event.getController().setAnimation(idleAnimation); + } + return PlayState.CONTINUE; + } + } diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/CatfishEntity.java b/src/main/java/com/eightsidedsquare/angling/common/entity/CatfishEntity.java index 8f07b21..f6021a2 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/CatfishEntity.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/CatfishEntity.java @@ -10,17 +10,20 @@ import net.minecraft.sound.SoundEvent; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; -import software.bernie.geckolib3.core.IAnimatable; -import software.bernie.geckolib3.core.PlayState; -import software.bernie.geckolib3.core.builder.AnimationBuilder; -import software.bernie.geckolib3.core.controller.AnimationController; -import software.bernie.geckolib3.core.event.predicate.AnimationEvent; -import software.bernie.geckolib3.core.manager.AnimationData; -import software.bernie.geckolib3.core.manager.AnimationFactory; +import software.bernie.geckolib.core.animatable.GeoAnimatable; +import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.core.animation.AnimatableManager; +import software.bernie.geckolib.core.animation.AnimationController; +import software.bernie.geckolib.core.animation.AnimationState; +import software.bernie.geckolib.core.animation.RawAnimation; +import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.util.GeckoLibUtil; -public class CatfishEntity extends FishEntity implements IAnimatable { +public class CatfishEntity extends FishEntity implements GeoAnimatable { - AnimationFactory factory = new AnimationFactory(this); + private final RawAnimation flopAnimation = RawAnimation.begin().thenLoop("animation.catfish.flop"); + private final RawAnimation idleAnimation = RawAnimation.begin().thenLoop("animation.catfish.idle"); + AnimatableInstanceCache animatableInstanceCache = GeckoLibUtil.createInstanceCache(this); public CatfishEntity(EntityType entityType, World world) { super(entityType, world); @@ -52,22 +55,28 @@ public ItemStack getBucketItem() { return new ItemStack(AnglingItems.CATFISH_BUCKET); } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return animatableInstanceCache; + } + + @Override + public double getTick(Object o) { + return 0; + } + @Override - public void registerControllers(AnimationData animationData) { - animationData.addAnimationController(new AnimationController<>(this, "controller", 2, this::controller)); + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController<>(this, "controller", 2, this::controller)); } - private PlayState controller(AnimationEvent event) { + private PlayState controller(AnimationState event) { if(!touchingWater) { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.catfish.flop", true)); + event.getController().setAnimation(flopAnimation); }else { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.catfish.idle", true)); + event.getController().setAnimation(idleAnimation); } return PlayState.CONTINUE; } - - @Override - public AnimationFactory getFactory() { - return factory; - } } diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/CrabEntity.java b/src/main/java/com/eightsidedsquare/angling/common/entity/CrabEntity.java index d205293..df1e177 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/CrabEntity.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/CrabEntity.java @@ -6,8 +6,18 @@ import com.eightsidedsquare.angling.core.AnglingItems; import com.eightsidedsquare.angling.core.AnglingSounds; import com.eightsidedsquare.angling.core.tags.AnglingBlockTags; -import net.minecraft.entity.*; -import net.minecraft.entity.ai.goal.*; +import net.minecraft.entity.Bucketable; +import net.minecraft.entity.EntityData; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.MovementType; +import net.minecraft.entity.SpawnReason; +import net.minecraft.entity.ai.goal.AnimalMateGoal; +import net.minecraft.entity.ai.goal.EscapeDangerGoal; +import net.minecraft.entity.ai.goal.FollowParentGoal; +import net.minecraft.entity.ai.goal.LookAroundGoal; +import net.minecraft.entity.ai.goal.LookAtEntityGoal; +import net.minecraft.entity.ai.goal.TemptGoal; +import net.minecraft.entity.ai.goal.WanderAroundFarGoal; import net.minecraft.entity.ai.pathing.PathNodeType; import net.minecraft.entity.attribute.DefaultAttributeContainer; import net.minecraft.entity.attribute.EntityAttributes; @@ -23,6 +33,7 @@ import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtElement; import net.minecraft.recipe.Ingredient; +import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.server.world.ServerWorld; import net.minecraft.sound.SoundEvent; import net.minecraft.sound.SoundEvents; @@ -31,24 +42,27 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.random.Random; -import net.minecraft.util.registry.RegistryEntry; import net.minecraft.world.LocalDifficulty; import net.minecraft.world.ServerWorldAccess; import net.minecraft.world.World; import net.minecraft.world.WorldAccess; import net.minecraft.world.biome.Biome; import org.jetbrains.annotations.Nullable; -import software.bernie.geckolib3.core.IAnimatable; -import software.bernie.geckolib3.core.PlayState; -import software.bernie.geckolib3.core.builder.AnimationBuilder; -import software.bernie.geckolib3.core.controller.AnimationController; -import software.bernie.geckolib3.core.event.predicate.AnimationEvent; -import software.bernie.geckolib3.core.manager.AnimationData; -import software.bernie.geckolib3.core.manager.AnimationFactory; - -public class CrabEntity extends AnimalEntity implements IAnimatable, Bucketable { - - AnimationFactory factory = new AnimationFactory(this); +import software.bernie.geckolib.core.animatable.GeoAnimatable; +import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.core.animation.AnimatableManager; +import software.bernie.geckolib.core.animation.AnimationController; +import software.bernie.geckolib.core.animation.AnimationState; +import software.bernie.geckolib.core.animation.RawAnimation; +import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.util.GeckoLibUtil; + +public class CrabEntity extends AnimalEntity implements GeoAnimatable, Bucketable { + + private final RawAnimation rotatedCrabAnimation = RawAnimation.begin().thenLoop("animation.crab.rotated"); + private final RawAnimation crabForwardsAnimation = RawAnimation.begin().thenLoop("animation.crab.forwards"); + private final RawAnimation crabMovingAnimation = RawAnimation.begin().thenLoop("animation.crab.moving"); + AnimatableInstanceCache animatableInstanceCache = GeckoLibUtil.createInstanceCache(this); private static final TrackedData VARIANT = DataTracker.registerData(CrabEntity.class, CrabVariant.TRACKED_DATA_HANDLER); private static final TrackedData FROM_BUCKET = DataTracker.registerData(CrabEntity.class, TrackedDataHandlerRegistry.BOOLEAN); @@ -151,26 +165,37 @@ public void readCustomDataFromNbt(NbtCompound nbt) { } @Override - public void registerControllers(AnimationData animationData) { - animationData.addAnimationController(new AnimationController<>(this, "rotation_controller", 6, this::rotationController)); - animationData.addAnimationController(new AnimationController<>(this, "controller", 4, this::controller)); + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController<>(this, "rotation_controller", 6, this::rotationController)); + controllerRegistrar.add(new AnimationController<>(this, "controller", 4, this::controller)); + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return animatableInstanceCache; + } + + @Override + public double getTick(Object o) { + return 0; } - private PlayState rotationController(AnimationEvent event) { - if(event.isMoving()) { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.crab.rotated", true)); + private PlayState rotationController(AnimationState state) { + if(state.isMoving()) { + state.getController().setAnimation(rotatedCrabAnimation); return PlayState.CONTINUE; } - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.crab.forwards", true)); + state.getController().setAnimation(crabForwardsAnimation); + return PlayState.CONTINUE; } - private PlayState controller(AnimationEvent event) { - if(event.isMoving()) { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.crab.moving", true)); + private PlayState controller(AnimationState state) { + if(state.isMoving()) { + state.getController().setAnimation(crabMovingAnimation); return PlayState.CONTINUE; } - event.getController().clearAnimationCache(); + state.getController().forceAnimationReset(); return PlayState.STOP; } @@ -183,11 +208,6 @@ public ActionResult interactMob(PlayerEntity player, Hand hand) { return Bucketable.tryBucket(player, hand, this).orElse(super.interactMob(player, hand)); } - @Override - public AnimationFactory getFactory() { - return factory; - } - public static DefaultAttributeContainer.Builder createAttributes() { return MobEntity.createMobAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 10).add(EntityAttributes.GENERIC_MOVEMENT_SPEED, 0.2d); } diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/DongfishEntity.java b/src/main/java/com/eightsidedsquare/angling/common/entity/DongfishEntity.java index e0aecf9..7351c99 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/DongfishEntity.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/DongfishEntity.java @@ -4,6 +4,7 @@ import com.eightsidedsquare.angling.core.AnglingSounds; import net.minecraft.entity.EntityType; import net.minecraft.entity.damage.DamageSource; +import net.minecraft.entity.damage.DamageSources; import net.minecraft.entity.data.DataTracker; import net.minecraft.entity.data.TrackedData; import net.minecraft.entity.data.TrackedDataHandlerRegistry; @@ -17,17 +18,20 @@ import net.minecraft.util.Hand; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; -import software.bernie.geckolib3.core.IAnimatable; -import software.bernie.geckolib3.core.PlayState; -import software.bernie.geckolib3.core.builder.AnimationBuilder; -import software.bernie.geckolib3.core.controller.AnimationController; -import software.bernie.geckolib3.core.event.predicate.AnimationEvent; -import software.bernie.geckolib3.core.manager.AnimationData; -import software.bernie.geckolib3.core.manager.AnimationFactory; - -public class DongfishEntity extends FishEntity implements IAnimatable { - - AnimationFactory factory = new AnimationFactory(this); +import software.bernie.geckolib.core.animatable.GeoAnimatable; +import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.core.animation.AnimatableManager; +import software.bernie.geckolib.core.animation.AnimationController; +import software.bernie.geckolib.core.animation.AnimationState; +import software.bernie.geckolib.core.animation.RawAnimation; +import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.util.GeckoLibUtil; + +public class DongfishEntity extends FishEntity implements GeoAnimatable { + + private final RawAnimation flopAnimation = RawAnimation.begin().thenLoop("animation.dongfish.flop"); + private final RawAnimation idleAnimation = RawAnimation.begin().thenLoop("animation.dongfish.idle"); + AnimatableInstanceCache animatableInstanceCache = GeckoLibUtil.createInstanceCache(this); private static final TrackedData HAS_HORNGUS = DataTracker.registerData(DongfishEntity.class, TrackedDataHandlerRegistry.BOOLEAN); public DongfishEntity(EntityType entityType, World world) { @@ -40,7 +44,7 @@ protected ActionResult interactMob(PlayerEntity player, Hand hand) { if(hasHorngus() && stack.isOf(Items.SHEARS)) { playSound(AnglingSounds.ENTITY_DONGFISH_SHEAR, 1, 1); setHasHorngus(false); - damage(DamageSource.player(player), 1); + damage(player.world.getDamageSources().playerAttack(player), 1); if(!player.getAbilities().creativeMode) stack.damage(1, player, p -> p.sendToolBreakStatus(hand)); return ActionResult.success(world.isClient); @@ -97,24 +101,29 @@ public ItemStack getBucketItem() { } @Override - public void registerControllers(AnimationData animationData) { - animationData.addAnimationController(new AnimationController<>(this, "controller", 2, this::controller)); + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController<>(this, "controller", 2, this::controller)); + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return animatableInstanceCache; } - private PlayState controller(AnimationEvent event) { + @Override + public double getTick(Object o) { + return 0; + } + + private PlayState controller(AnimationState state) { if(!touchingWater) { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.dongfish.flop", true)); + state.getController().setAnimation(flopAnimation); }else { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.dongfish.idle", true)); + state.getController().setAnimation(idleAnimation); } return PlayState.CONTINUE; } - @Override - public AnimationFactory getFactory() { - return factory; - } - @Override public void copyDataToStack(ItemStack stack) { super.copyDataToStack(stack); diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/FryEntity.java b/src/main/java/com/eightsidedsquare/angling/common/entity/FryEntity.java index cd81d9d..2992bc2 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/FryEntity.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/FryEntity.java @@ -25,19 +25,22 @@ import net.minecraft.util.Hand; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; -import software.bernie.geckolib3.core.IAnimatable; -import software.bernie.geckolib3.core.PlayState; -import software.bernie.geckolib3.core.builder.AnimationBuilder; -import software.bernie.geckolib3.core.controller.AnimationController; -import software.bernie.geckolib3.core.event.predicate.AnimationEvent; -import software.bernie.geckolib3.core.manager.AnimationData; -import software.bernie.geckolib3.core.manager.AnimationFactory; +import software.bernie.geckolib.core.animatable.GeoAnimatable; +import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.core.animation.AnimatableManager; +import software.bernie.geckolib.core.animation.AnimationController; +import software.bernie.geckolib.core.animation.AnimationState; +import software.bernie.geckolib.core.animation.RawAnimation; +import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.util.GeckoLibUtil; import java.util.Optional; -public class FryEntity extends FishEntity implements IAnimatable { +public class FryEntity extends FishEntity implements GeoAnimatable { - AnimationFactory factory = new AnimationFactory(this); + private final RawAnimation idleAnimation = RawAnimation.begin().thenLoop("animation.fry.idle"); + private final RawAnimation flopAnimation = RawAnimation.begin().thenLoop("animation.fry.flop"); + AnimatableInstanceCache animatableInstanceCache = GeckoLibUtil.createInstanceCache(this); private static final TrackedData COLOR; private static final TrackedData AGE; private static final TrackedData VARIANT; @@ -218,25 +221,29 @@ public ItemStack getBucketItem() { } @Override - public void registerControllers(AnimationData animationData) { - AnimationController controller = new AnimationController<>(this, "controller", 2, this::controller); - animationData.addAnimationController(controller); + public AnimatableInstanceCache getAnimatableInstanceCache() { + return animatableInstanceCache; } - private PlayState controller(AnimationEvent event) { + @Override + public double getTick(Object o) { + return 0; + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController<>(this, "controller", 2, this::controller)); + } + + private PlayState controller(AnimationState state) { if(!touchingWater) { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.fry.flop", true)); + state.getController().setAnimation(flopAnimation); }else { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.fry.idle", true)); + state.getController().setAnimation(idleAnimation); } return PlayState.CONTINUE; } - @Override - public AnimationFactory getFactory() { - return factory; - } - static { COLOR = DataTracker.registerData(FryEntity.class, TrackedDataHandlerRegistry.INTEGER); AGE = DataTracker.registerData(FryEntity.class, TrackedDataHandlerRegistry.INTEGER); diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/MahiMahiEntity.java b/src/main/java/com/eightsidedsquare/angling/common/entity/MahiMahiEntity.java index a545428..ae323dc 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/MahiMahiEntity.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/MahiMahiEntity.java @@ -12,22 +12,29 @@ import net.minecraft.sound.SoundEvent; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; -import software.bernie.geckolib3.core.IAnimatable; -import software.bernie.geckolib3.core.PlayState; -import software.bernie.geckolib3.core.builder.AnimationBuilder; -import software.bernie.geckolib3.core.controller.AnimationController; -import software.bernie.geckolib3.core.event.predicate.AnimationEvent; -import software.bernie.geckolib3.core.manager.AnimationData; -import software.bernie.geckolib3.core.manager.AnimationFactory; +import software.bernie.geckolib.core.animatable.GeoAnimatable; +import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.core.animation.AnimatableManager; +import software.bernie.geckolib.core.animation.AnimationController; +import software.bernie.geckolib.core.animation.AnimationState; +import software.bernie.geckolib.core.animation.RawAnimation; +import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.util.GeckoLibUtil; -public class MahiMahiEntity extends FishEntity implements IAnimatable { +public class MahiMahiEntity extends FishEntity implements GeoAnimatable { - AnimationFactory factory = new AnimationFactory(this); + private final RawAnimation flopAnimation = RawAnimation.begin().thenLoop("animation.mahi_mahi.flop"); + private final RawAnimation idleAnimation = RawAnimation.begin().thenLoop("animation.mahi_mahi.idle"); + AnimatableInstanceCache animatableInstanceCache = GeckoLibUtil.createInstanceCache(this); public MahiMahiEntity(EntityType entityType, World world) { super(entityType, world); } + public static DefaultAttributeContainer.Builder createAttributes() { + return MobEntity.createMobAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 10); + } + @Override protected SoundEvent getFlopSound() { return AnglingSounds.ENTITY_MAHI_MAHI_FLOP; @@ -50,26 +57,27 @@ public ItemStack getBucketItem() { return new ItemStack(AnglingItems.MAHI_MAHI_BUCKET); } - public static DefaultAttributeContainer.Builder createAttributes() { - return MobEntity.createMobAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 10); + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return animatableInstanceCache; } @Override - public void registerControllers(AnimationData animationData) { - animationData.addAnimationController(new AnimationController<>(this, "controller", 2, this::controller)); + public double getTick(Object o) { + return 0; } - private PlayState controller(AnimationEvent event) { - if(!touchingWater) { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.mahi_mahi.flop", true)); - }else { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.mahi_mahi.idle", true)); - } - return PlayState.CONTINUE; + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController<>(this, "controller", 2, this::controller)); } - @Override - public AnimationFactory getFactory() { - return factory; + private PlayState controller(AnimationState state) { + if (!touchingWater) { + state.getController().setAnimation(flopAnimation); + } else { + state.getController().setAnimation(idleAnimation); + } + return PlayState.CONTINUE; } } diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/NautilusEntity.java b/src/main/java/com/eightsidedsquare/angling/common/entity/NautilusEntity.java index 63cc752..1c0753a 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/NautilusEntity.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/NautilusEntity.java @@ -10,25 +10,28 @@ import net.minecraft.entity.passive.FishEntity; import net.minecraft.item.ItemStack; import net.minecraft.particle.ParticleTypes; +import net.minecraft.registry.tag.FluidTags; import net.minecraft.sound.SoundEvent; import net.minecraft.sound.SoundEvents; -import net.minecraft.tag.FluidTags; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.random.Random; import net.minecraft.world.World; import net.minecraft.world.WorldAccess; import org.jetbrains.annotations.Nullable; -import software.bernie.geckolib3.core.IAnimatable; -import software.bernie.geckolib3.core.PlayState; -import software.bernie.geckolib3.core.builder.AnimationBuilder; -import software.bernie.geckolib3.core.controller.AnimationController; -import software.bernie.geckolib3.core.event.predicate.AnimationEvent; -import software.bernie.geckolib3.core.manager.AnimationData; -import software.bernie.geckolib3.core.manager.AnimationFactory; +import software.bernie.geckolib.core.animatable.GeoAnimatable; +import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.core.animation.AnimatableManager; +import software.bernie.geckolib.core.animation.AnimationController; +import software.bernie.geckolib.core.animation.AnimationState; +import software.bernie.geckolib.core.animation.RawAnimation; +import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.util.GeckoLibUtil; -public class NautilusEntity extends FishEntity implements IAnimatable { +public class NautilusEntity extends FishEntity implements GeoAnimatable { - AnimationFactory factory = new AnimationFactory(this); + private final RawAnimation idleAnimation = RawAnimation.begin().thenLoop("animation.nautilus.idle"); + private final RawAnimation movingAnimation = RawAnimation.begin().thenLoop("animation.nautilus.moving"); + AnimatableInstanceCache animatableInstanceCache = GeckoLibUtil.createInstanceCache(this); public NautilusEntity(EntityType entityType, World world) { super(entityType, world); @@ -57,8 +60,18 @@ public ItemStack getBucketItem() { } @Override - public void registerControllers(AnimationData animationData) { - animationData.addAnimationController(new AnimationController<>(this, "controller", 2, this::controller)); + public AnimatableInstanceCache getAnimatableInstanceCache() { + return animatableInstanceCache; + } + + @Override + public double getTick(Object o) { + return 0; + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController<>(this, "controller", 2, this::controller)); } @Override @@ -71,20 +84,15 @@ public void tickMovement() { super.tickMovement(); } - private PlayState controller(AnimationEvent event) { - if(event.isMoving() && isTouchingWater()) { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.nautilus.moving", true)); + private PlayState controller(AnimationState state) { + if(state.isMoving() && isTouchingWater()) { + state.getController().setAnimation(movingAnimation); }else { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.nautilus.idle", true)); + state.getController().setAnimation(idleAnimation); } return PlayState.CONTINUE; } - @Override - public AnimationFactory getFactory() { - return factory; - } - @SuppressWarnings("deprecation") public static boolean canSpawn(EntityType type, WorldAccess world, SpawnReason reason, BlockPos pos, Random random) { int seaLevel = world.getSeaLevel(); diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/PelicanEntity.java b/src/main/java/com/eightsidedsquare/angling/common/entity/PelicanEntity.java index 2006994..f61f850 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/PelicanEntity.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/PelicanEntity.java @@ -11,7 +11,14 @@ import com.google.common.collect.ImmutableList; import com.mojang.serialization.Dynamic; import net.minecraft.block.BlockState; -import net.minecraft.entity.*; +import net.minecraft.entity.Bucketable; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityData; +import net.minecraft.entity.EntityDimensions; +import net.minecraft.entity.EntityPose; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.MovementType; +import net.minecraft.entity.SpawnReason; import net.minecraft.entity.ai.brain.Activity; import net.minecraft.entity.ai.brain.Brain; import net.minecraft.entity.ai.brain.MemoryModuleState; @@ -36,33 +43,41 @@ import net.minecraft.item.Items; import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtElement; +import net.minecraft.registry.Registries; +import net.minecraft.registry.tag.TagKey; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.world.ServerWorld; import net.minecraft.sound.SoundEvent; -import net.minecraft.tag.TagKey; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.Unit; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; -import net.minecraft.util.registry.Registry; import net.minecraft.world.LocalDifficulty; import net.minecraft.world.ServerWorldAccess; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; -import software.bernie.geckolib3.core.IAnimatable; -import software.bernie.geckolib3.core.PlayState; -import software.bernie.geckolib3.core.builder.AnimationBuilder; -import software.bernie.geckolib3.core.controller.AnimationController; -import software.bernie.geckolib3.core.event.predicate.AnimationEvent; -import software.bernie.geckolib3.core.manager.AnimationData; -import software.bernie.geckolib3.core.manager.AnimationFactory; +import software.bernie.geckolib.core.animatable.GeoAnimatable; +import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.core.animation.AnimatableManager; +import software.bernie.geckolib.core.animation.AnimationController; +import software.bernie.geckolib.core.animation.AnimationState; +import software.bernie.geckolib.core.animation.RawAnimation; +import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.util.GeckoLibUtil; import java.util.Optional; -public class PelicanEntity extends AnimalEntity implements IAnimatable { +public class PelicanEntity extends AnimalEntity implements GeoAnimatable { - AnimationFactory factory = new AnimationFactory(this); + private final RawAnimation divingAnimation = RawAnimation.begin().thenLoop("animation.pelican.diving"); + private final RawAnimation swimmingAnimation = RawAnimation.begin().thenLoop("animation.pelican.swimming"); + private final RawAnimation flyingAnimation = RawAnimation.begin().thenLoop("animation.pelican.flying"); + private final RawAnimation flappingAnimation = RawAnimation.begin().thenLoop("animation.pelican.flapping"); + private final RawAnimation walkingAnimation = RawAnimation.begin().thenLoop("animation.pelican.walking"); + private final RawAnimation idleAnimation = RawAnimation.begin().thenLoop("animation.pelican.idle"); + private final RawAnimation beakOpened = RawAnimation.begin().thenLoop("animation.pelican.beak_opened"); + AnimatableInstanceCache animatableInstanceCache = GeckoLibUtil.createInstanceCache(this); protected static final ImmutableList>> SENSORS; protected static final ImmutableList> MEMORY_MODULES; @@ -82,7 +97,7 @@ public ActionResult interactMob(PlayerEntity player, Hand hand) { if(isBeakOpen() && stack.getItem() instanceof EntityBucketItem bucketItem) { bucketItem.playEmptyingSound(player, getWorld(), getBlockPos()); NbtCompound nbt = stack.getOrCreateNbt().copy(); - nbt.putString("id", Registry.ENTITY_TYPE.getId(bucketItem.entityType).toString()); + nbt.putString("id", Registries.ENTITY_TYPE.getId(bucketItem.entityType).toString()); if(nbt.contains("BucketVariantTag")) { nbt.put("Variant", nbt.get("BucketVariantTag")); nbt.remove("BucketVariantTag"); @@ -215,7 +230,7 @@ private NbtCompound initializeEntityInBeak() { TagKey> tag = random.nextInt(5) == 0 ? AnglingEntityTypeTags.UNCOMMON_ENTITIES_IN_PELICAN_BEAK : AnglingEntityTypeTags.COMMON_ENTITIES_IN_PELICAN_BEAK; EntityType type = AnglingUtil.getRandomTagValue(world, tag, random); - nbt.putString("id", Registry.ENTITY_TYPE.getId(type).toString()); + nbt.putString("id", Registries.ENTITY_TYPE.getId(type).toString()); nbt.putBoolean("FromBucket", true); if(type.isIn(AnglingEntityTypeTags.HUNTED_BY_PELICAN_WHEN_BABY)) { nbt.putInt("Age", -24000); @@ -223,11 +238,6 @@ private NbtCompound initializeEntityInBeak() { return PelicanBeakEntityInitializer.getInitializer(type).initialize(nbt, random, world); } - @Override - protected boolean hasWings() { - return !onGround; - } - @Override public boolean damage(DamageSource source, float amount) { boolean bl = super.damage(source, amount); @@ -305,7 +315,7 @@ public void travel(Vec3d movementInput) { } } - this.updateLimbs(this, false); + this.updateLimbs(false); } @Nullable @@ -314,51 +324,57 @@ public PassiveEntity createChild(ServerWorld world, PassiveEntity entity) { return null; } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return animatableInstanceCache; + } + @Override - public void registerControllers(AnimationData animationData) { - animationData.addAnimationController(new AnimationController<>(this, "controller", 4, this::controller)); - animationData.addAnimationController(new AnimationController<>(this, "beak_controller", 2, this::beakController)); + public double getTick(Object o) { + return 0; + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController<>(this, "controller", 2, this::controller)); + controllerRegistrar.add(new AnimationController<>(this, "beak_controller", 2, this::beakController)); } public boolean isFlying() { return getTimeOffGround() > 5; } - private PlayState controller(AnimationEvent event) { - PelicanEntity entity = event.getAnimatable(); + private PlayState controller(AnimationState state) { + PelicanEntity entity = state.getAnimatable(); if(entity.isDiving() && entity.isFlying()){ - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.pelican.diving", true)); + state.getController().setAnimation(divingAnimation); }else if(entity.isTouchingWater()) { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.pelican.swimming", true)); + state.getController().setAnimation(swimmingAnimation); }else if(entity.isFlying()) { if (Math.abs(entity.getVelocity().y) > 0.05d) { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.pelican.flying", true)); + state.getController().setAnimation(flyingAnimation); } else { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.pelican.flapping", true)); + state.getController().setAnimation(flappingAnimation); } - }else if(event.isMoving()) { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.pelican.walking", true)); + }else if(state.isMoving()) { + state.getController().setAnimation(walkingAnimation); }else { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.pelican.idle", true)); + state.getController().setAnimation(idleAnimation); } return PlayState.CONTINUE; } - private PlayState beakController(AnimationEvent event) { - PelicanEntity entity = event.getAnimatable(); + private PlayState beakController(AnimationState state) { + PelicanEntity entity = state.getAnimatable(); if(entity.isBeakOpen()) { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.pelican.beak_opened", true)); + state.getController().setAnimation(beakOpened); return PlayState.CONTINUE; } - event.getController().clearAnimationCache(); + state.getController().forceAnimationReset(); return PlayState.STOP; } - @Override - public AnimationFactory getFactory() { - return factory; - } - @Override protected Brain.Profile createBrainProfile() { return Brain.createProfile(MEMORY_MODULES, SENSORS); diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/RoeBlockEntity.java b/src/main/java/com/eightsidedsquare/angling/common/entity/RoeBlockEntity.java index 41aa82a..7652651 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/RoeBlockEntity.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/RoeBlockEntity.java @@ -16,11 +16,11 @@ import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; import net.minecraft.particle.BlockStateParticleEffect; import net.minecraft.particle.ParticleTypes; +import net.minecraft.registry.Registries; import net.minecraft.server.world.ServerWorld; import net.minecraft.sound.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.random.Random; -import net.minecraft.util.registry.Registry; import net.minecraft.world.BlockRenderView; import org.jetbrains.annotations.Nullable; @@ -53,7 +53,7 @@ public void setColors(int primaryColor, int secondaryColor) { } public void setEntityType(EntityType entityType) { - this.entityType = Registry.ENTITY_TYPE.getId(entityType).toString(); + this.entityType = Registries.ENTITY_TYPE.getId(entityType).toString(); } public Optional> getEntityType() { diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/SeaSlugEggsBlockEntity.java b/src/main/java/com/eightsidedsquare/angling/common/entity/SeaSlugEggsBlockEntity.java index 0030e0d..845b926 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/SeaSlugEggsBlockEntity.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/SeaSlugEggsBlockEntity.java @@ -17,9 +17,9 @@ import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; import net.minecraft.particle.BlockStateParticleEffect; import net.minecraft.particle.ParticleTypes; +import net.minecraft.registry.tag.TagKey; import net.minecraft.server.world.ServerWorld; import net.minecraft.sound.SoundCategory; -import net.minecraft.tag.TagKey; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.random.Random; import net.minecraft.world.BlockRenderView; diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/SeaSlugEntity.java b/src/main/java/com/eightsidedsquare/angling/common/entity/SeaSlugEntity.java index 5b878cd..e01349e 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/SeaSlugEntity.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/SeaSlugEntity.java @@ -7,7 +7,11 @@ import com.eightsidedsquare.angling.core.AnglingItems; import com.eightsidedsquare.angling.core.AnglingSounds; import com.eightsidedsquare.angling.core.AnglingUtil; -import net.minecraft.entity.*; +import net.minecraft.entity.Bucketable; +import net.minecraft.entity.EntityData; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.MovementType; +import net.minecraft.entity.SpawnReason; import net.minecraft.entity.ai.goal.EscapeDangerGoal; import net.minecraft.entity.ai.goal.LookAroundGoal; import net.minecraft.entity.ai.goal.LookAtEntityGoal; @@ -35,15 +39,16 @@ import net.minecraft.world.ServerWorldAccess; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; -import software.bernie.geckolib3.core.IAnimatable; -import software.bernie.geckolib3.core.PlayState; -import software.bernie.geckolib3.core.builder.AnimationBuilder; -import software.bernie.geckolib3.core.controller.AnimationController; -import software.bernie.geckolib3.core.event.predicate.AnimationEvent; -import software.bernie.geckolib3.core.manager.AnimationData; -import software.bernie.geckolib3.core.manager.AnimationFactory; +import software.bernie.geckolib.core.animatable.GeoAnimatable; +import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.core.animation.AnimatableManager; +import software.bernie.geckolib.core.animation.AnimationController; +import software.bernie.geckolib.core.animation.AnimationState; +import software.bernie.geckolib.core.animation.RawAnimation; +import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.util.GeckoLibUtil; -public class SeaSlugEntity extends WaterCreatureEntity implements IAnimatable, Bucketable { +public class SeaSlugEntity extends WaterCreatureEntity implements Bucketable, GeoAnimatable { private static final TrackedData PATTERN = DataTracker.registerData(SeaSlugEntity.class, SeaSlugPattern.TRACKED_DATA_HANDLER); private static final TrackedData BASE_COLOR = DataTracker.registerData(SeaSlugEntity.class, SeaSlugColor.TRACKED_DATA_HANDLER); @@ -54,8 +59,10 @@ public class SeaSlugEntity extends WaterCreatureEntity implements IAnimatable, B private static final TrackedData MATE_DATA = DataTracker.registerData(SeaSlugEntity.class, TrackedDataHandlerRegistry.NBT_COMPOUND); private static final TrackedData LOVE_TICKS = DataTracker.registerData(SeaSlugEntity.class, TrackedDataHandlerRegistry.INTEGER); private static final TrackedData LOVE_COOLDOWN = DataTracker.registerData(SeaSlugEntity.class, TrackedDataHandlerRegistry.INTEGER); + private final RawAnimation ambientAnimation = RawAnimation.begin().thenLoop("animation.sea_slug.ambient"); + private final RawAnimation movingAnimation = RawAnimation.begin().thenLoop("animation.sea_slug.moving"); - AnimationFactory factory = new AnimationFactory(this); + AnimatableInstanceCache animatableInstanceCache = GeckoLibUtil.createInstanceCache(this); public SeaSlugEntity(EntityType entityType, World world) { super(entityType, world); @@ -244,22 +251,32 @@ public void readCustomDataFromNbt(NbtCompound nbt) { } @Override - public void registerControllers(AnimationData animationData) { - animationData.addAnimationController(new AnimationController<>(this, "ambient_controller", 0, this::ambientController)); - animationData.addAnimationController(new AnimationController<>(this, "controller", 0, this::controller)); + public AnimatableInstanceCache getAnimatableInstanceCache() { + return animatableInstanceCache; } - private PlayState ambientController(AnimationEvent event) { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.sea_slug.ambient", true)); + @Override + public double getTick(Object o) { + return 0; + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController<>(this, "ambient_controller", 0, this::ambientController)); + controllerRegistrar.add(new AnimationController<>(this, "controller", 0, this::controller)); + } + + private PlayState ambientController(AnimationState event) { + event.getController().setAnimation(ambientAnimation); return PlayState.CONTINUE; } - private PlayState controller(AnimationEvent event) { + private PlayState controller(AnimationState event) { if(new Vec3d(getVelocity().getX(), 0, getVelocity().getZ()).length() > 0.005d) { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.sea_slug.moving", true)); + event.getController().setAnimation(movingAnimation); return PlayState.CONTINUE; } - event.getController().clearAnimationCache(); + event.getController().forceAnimationReset(); return PlayState.STOP; } @@ -292,11 +309,6 @@ protected void mobTick() { super.mobTick(); } - @Override - public AnimationFactory getFactory() { - return factory; - } - @Override public boolean isFromBucket() { return dataTracker.get(FROM_BUCKET); diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/SeahorseEntity.java b/src/main/java/com/eightsidedsquare/angling/common/entity/SeahorseEntity.java index 5601db1..df702bc 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/SeahorseEntity.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/SeahorseEntity.java @@ -14,17 +14,20 @@ import net.minecraft.world.World; import net.minecraft.world.WorldView; import org.jetbrains.annotations.Nullable; -import software.bernie.geckolib3.core.IAnimatable; -import software.bernie.geckolib3.core.PlayState; -import software.bernie.geckolib3.core.builder.AnimationBuilder; -import software.bernie.geckolib3.core.controller.AnimationController; -import software.bernie.geckolib3.core.event.predicate.AnimationEvent; -import software.bernie.geckolib3.core.manager.AnimationData; -import software.bernie.geckolib3.core.manager.AnimationFactory; +import software.bernie.geckolib.core.animatable.GeoAnimatable; +import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.core.animation.AnimatableManager; +import software.bernie.geckolib.core.animation.AnimationController; +import software.bernie.geckolib.core.animation.AnimationState; +import software.bernie.geckolib.core.animation.RawAnimation; +import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.util.GeckoLibUtil; -public class SeahorseEntity extends FishEntity implements IAnimatable { +public class SeahorseEntity extends FishEntity implements GeoAnimatable { - AnimationFactory factory = new AnimationFactory(this); + private final RawAnimation flopAnimation = RawAnimation.begin().thenLoop("animation.seahorse.flop"); + private final RawAnimation idleAnimation = RawAnimation.begin().thenLoop("animation.seahorse.idle"); + AnimatableInstanceCache animatableInstanceCache = GeckoLibUtil.createInstanceCache(this); public SeahorseEntity(EntityType entityType, World world) { super(entityType, world); @@ -59,24 +62,29 @@ public ItemStack getBucketItem() { } @Override - public void registerControllers(AnimationData animationData) { - animationData.addAnimationController(new AnimationController<>(this, "controller", 2, this::controller)); + public double getTick(Object o) { + return 0; } - private PlayState controller(AnimationEvent event) { + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController<>(this, "controller", 2, this::controller)); + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return animatableInstanceCache; + } + + private PlayState controller(AnimationState state) { if(!touchingWater) { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.seahorse.flop", true)); + state.getController().setAnimation(flopAnimation); }else { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.seahorse.idle", true)); + state.getController().setAnimation(idleAnimation); } return PlayState.CONTINUE; } - @Override - public AnimationFactory getFactory() { - return factory; - } - static class MoveToKelpGoal extends MoveToTargetPosGoal { public MoveToKelpGoal(SeahorseEntity mob) { diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/StarfishBlockEntity.java b/src/main/java/com/eightsidedsquare/angling/common/entity/StarfishBlockEntity.java index f88c537..afcfffc 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/StarfishBlockEntity.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/StarfishBlockEntity.java @@ -14,19 +14,22 @@ import net.minecraft.util.math.Vec3i; import net.minecraft.world.BlockRenderView; import org.jetbrains.annotations.Nullable; -import software.bernie.geckolib3.core.IAnimatable; -import software.bernie.geckolib3.core.PlayState; -import software.bernie.geckolib3.core.builder.AnimationBuilder; -import software.bernie.geckolib3.core.controller.AnimationController; -import software.bernie.geckolib3.core.event.predicate.AnimationEvent; -import software.bernie.geckolib3.core.manager.AnimationData; -import software.bernie.geckolib3.core.manager.AnimationFactory; +import software.bernie.geckolib.core.animatable.GeoAnimatable; +import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.core.animation.AnimatableManager; +import software.bernie.geckolib.core.animation.AnimationController; +import software.bernie.geckolib.core.animation.AnimationState; +import software.bernie.geckolib.core.animation.RawAnimation; +import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.util.GeckoLibUtil; import java.awt.*; -public class StarfishBlockEntity extends BlockEntity implements IAnimatable { +public class StarfishBlockEntity extends BlockEntity implements GeoAnimatable { - AnimationFactory factory = new AnimationFactory(this); + private final RawAnimation deadAnimation = RawAnimation.begin().thenLoop("animation.starfish.dead"); + private final RawAnimation idleAnimation = RawAnimation.begin().thenLoop("animation.starfish.idle"); + AnimatableInstanceCache animatableInstanceCache = GeckoLibUtil.createInstanceCache(this); private double randomRotation; private int color; private boolean rainbow; @@ -43,15 +46,25 @@ public StarfishBlockEntity(BlockPos pos, BlockState state) { } @Override - public void registerControllers(AnimationData data) { - data.addAnimationController(new AnimationController<>(this, "controller", 0, this::controller)); + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController<>(this, "controller", 0, this::controller)); } - private PlayState controller(AnimationEvent event) { + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return animatableInstanceCache; + } + + @Override + public double getTick(Object o) { + return 0; + } + + private PlayState controller(AnimationState state) { if(((StarfishBlock) getCachedState().getBlock()).isDead()) { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.starfish.dead", true)); + state.getController().setAnimation(deadAnimation); }else { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.starfish.idle", true)); + state.getController().setAnimation(idleAnimation); } return PlayState.CONTINUE; } @@ -143,9 +156,4 @@ public Vec3i getRotation() { case DOWN -> new Vec3i(180, 180, 0); }; } - - @Override - public AnimationFactory getFactory() { - return factory; - } } diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/SunfishEntity.java b/src/main/java/com/eightsidedsquare/angling/common/entity/SunfishEntity.java index ccccf8e..90b1155 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/SunfishEntity.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/SunfishEntity.java @@ -19,19 +19,22 @@ import net.minecraft.world.ServerWorldAccess; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; -import software.bernie.geckolib3.core.IAnimatable; -import software.bernie.geckolib3.core.PlayState; -import software.bernie.geckolib3.core.builder.AnimationBuilder; -import software.bernie.geckolib3.core.controller.AnimationController; -import software.bernie.geckolib3.core.event.predicate.AnimationEvent; -import software.bernie.geckolib3.core.manager.AnimationData; -import software.bernie.geckolib3.core.manager.AnimationFactory; +import software.bernie.geckolib.core.animatable.GeoAnimatable; +import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.core.animation.AnimatableManager; +import software.bernie.geckolib.core.animation.AnimationController; +import software.bernie.geckolib.core.animation.AnimationState; +import software.bernie.geckolib.core.animation.RawAnimation; +import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.util.GeckoLibUtil; import java.util.Objects; -public class SunfishEntity extends SchoolingFishEntity implements IAnimatable { +public class SunfishEntity extends SchoolingFishEntity implements GeoAnimatable { - AnimationFactory factory = new AnimationFactory(this); + private final RawAnimation idleAnimation = RawAnimation.begin().thenLoop("animation.sunfish.idle"); + private final RawAnimation flopAnimation = RawAnimation.begin().thenLoop("animation.sunfish.flop"); + AnimatableInstanceCache animatableInstanceCache = GeckoLibUtil.createInstanceCache(this); private static final TrackedData VARIANT; @@ -117,21 +120,27 @@ public void readCustomDataFromNbt(NbtCompound nbt) { } @Override - public void registerControllers(AnimationData animationData) { - animationData.addAnimationController(new AnimationController<>(this, "controller", 2, this::controller)); + public AnimatableInstanceCache getAnimatableInstanceCache() { + return animatableInstanceCache; } - private PlayState controller(AnimationEvent event) { + @Override + public double getTick(Object o) { + return 0; + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController<>(this, "controller", 2, this::controller)); + } + + private PlayState controller(AnimationState state) { if(!touchingWater) { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.sunfish.flop", true)); + state.getController().setAnimation(flopAnimation); }else { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.sunfish.idle", true)); + state.getController().setAnimation(idleAnimation); } return PlayState.CONTINUE; } - @Override - public AnimationFactory getFactory() { - return factory; - } } diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/UrchinBlockEntity.java b/src/main/java/com/eightsidedsquare/angling/common/entity/UrchinBlockEntity.java index 4839099..3765ea7 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/UrchinBlockEntity.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/UrchinBlockEntity.java @@ -7,23 +7,26 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtElement; -import net.minecraft.network.Packet; import net.minecraft.network.listener.ClientPlayPacketListener; +import net.minecraft.network.packet.Packet; import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.Nullable; -import software.bernie.geckolib3.core.IAnimatable; -import software.bernie.geckolib3.core.PlayState; -import software.bernie.geckolib3.core.builder.AnimationBuilder; -import software.bernie.geckolib3.core.controller.AnimationController; -import software.bernie.geckolib3.core.event.predicate.AnimationEvent; -import software.bernie.geckolib3.core.manager.AnimationData; -import software.bernie.geckolib3.core.manager.AnimationFactory; +import software.bernie.geckolib.core.animatable.GeoAnimatable; +import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.core.animatable.instance.InstancedAnimatableInstanceCache; +import software.bernie.geckolib.core.animation.AnimatableManager; +import software.bernie.geckolib.core.animation.Animation; +import software.bernie.geckolib.core.animation.AnimationController; +import software.bernie.geckolib.core.animation.AnimationState; +import software.bernie.geckolib.core.animation.RawAnimation; +import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.util.GeckoLibUtil; -public class UrchinBlockEntity extends BlockEntity implements IAnimatable { +public class UrchinBlockEntity extends BlockEntity implements GeoAnimatable { private ItemStack hat = ItemStack.EMPTY; - AnimationFactory factory = new AnimationFactory(this); + AnimatableInstanceCache animatableInstanceCache = GeckoLibUtil.createInstanceCache(this); public UrchinBlockEntity(BlockPos pos, BlockState state) { super(AnglingEntities.URCHIN, pos, state); @@ -64,18 +67,24 @@ public NbtCompound toInitialChunkDataNbt() { return createNbt(); } + + private PlayState controller(AnimationState state) { + state.getController().setAnimation(RawAnimation.begin().then("animation.urchin.idle", Animation.LoopType.LOOP)); + return PlayState.CONTINUE; + } + @Override - public void registerControllers(AnimationData data) { - data.addAnimationController(new AnimationController<>(this, "controller", 0, this::controller)); + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController<>(this, "controller", 0, this::controller)); } - private PlayState controller(AnimationEvent event) { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.urchin.idle", true)); - return PlayState.CONTINUE; + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return null; } @Override - public AnimationFactory getFactory() { - return factory; + public double getTick(Object o) { + return 0; } } diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/UrchinEntity.java b/src/main/java/com/eightsidedsquare/angling/common/entity/UrchinEntity.java index 521e56b..b4545c8 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/UrchinEntity.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/UrchinEntity.java @@ -25,17 +25,19 @@ import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; -import software.bernie.geckolib3.core.IAnimatable; -import software.bernie.geckolib3.core.PlayState; -import software.bernie.geckolib3.core.builder.AnimationBuilder; -import software.bernie.geckolib3.core.controller.AnimationController; -import software.bernie.geckolib3.core.event.predicate.AnimationEvent; -import software.bernie.geckolib3.core.manager.AnimationData; -import software.bernie.geckolib3.core.manager.AnimationFactory; - -public class UrchinEntity extends WaterCreatureEntity implements IAnimatable, Bucketable { - - AnimationFactory factory = new AnimationFactory(this); +import software.bernie.geckolib.core.animatable.GeoAnimatable; +import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.core.animation.AnimatableManager; +import software.bernie.geckolib.core.animation.AnimationController; +import software.bernie.geckolib.core.animation.AnimationState; +import software.bernie.geckolib.core.animation.RawAnimation; +import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.util.GeckoLibUtil; + +public class UrchinEntity extends WaterCreatureEntity implements GeoAnimatable, Bucketable { + + private final RawAnimation idleAnimation = RawAnimation.begin().thenLoop("animation.urchin.idle"); + AnimatableInstanceCache animatableInstanceCache = GeckoLibUtil.createInstanceCache(this); private static final TrackedData FROM_BUCKET = DataTracker.registerData(UrchinEntity.class, TrackedDataHandlerRegistry.BOOLEAN); public UrchinEntity(EntityType entityType, World world) { @@ -92,20 +94,24 @@ protected SoundEvent getDeathSound() { } @Override - public void registerControllers(AnimationData animationData) { - animationData.addAnimationController(new AnimationController<>(this, "controller", 0, this::controller)); + public AnimatableInstanceCache getAnimatableInstanceCache() { + return animatableInstanceCache; } - private PlayState controller(AnimationEvent event) { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.urchin.idle", true)); - return PlayState.CONTINUE; + @Override + public double getTick(Object o) { + return 0; } @Override - public AnimationFactory getFactory() { - return factory; + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController<>(this, "controller", 2, this::controller)); } + private PlayState controller(AnimationState state) { + state.getController().setAnimation(idleAnimation); + return PlayState.CONTINUE; + } @Override public boolean isFromBucket() { return dataTracker.get(FROM_BUCKET); diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/ai/EatAlgaeGoal.java b/src/main/java/com/eightsidedsquare/angling/common/entity/ai/EatAlgaeGoal.java index cd23aa1..f9a256f 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/ai/EatAlgaeGoal.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/ai/EatAlgaeGoal.java @@ -5,7 +5,7 @@ import net.minecraft.block.BlockState; import net.minecraft.entity.ai.goal.MoveToTargetPosGoal; import net.minecraft.entity.mob.PathAwareEntity; -import net.minecraft.tag.FluidTags; +import net.minecraft.registry.tag.FluidTags; import net.minecraft.util.math.BlockPos; import net.minecraft.world.WorldView; diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/ai/GoToWaterGoal.java b/src/main/java/com/eightsidedsquare/angling/common/entity/ai/GoToWaterGoal.java index a25d973..c608bf0 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/ai/GoToWaterGoal.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/ai/GoToWaterGoal.java @@ -2,7 +2,7 @@ import net.minecraft.entity.ai.goal.MoveToTargetPosGoal; import net.minecraft.entity.mob.PathAwareEntity; -import net.minecraft.tag.FluidTags; +import net.minecraft.registry.tag.FluidTags; import net.minecraft.util.math.BlockPos; import net.minecraft.world.WorldView; diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/ai/PelicanAttackTask.java b/src/main/java/com/eightsidedsquare/angling/common/entity/ai/PelicanAttackTask.java index 4fb50b9..aa81897 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/ai/PelicanAttackTask.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/ai/PelicanAttackTask.java @@ -6,10 +6,11 @@ import net.minecraft.entity.ai.brain.MemoryModuleState; import net.minecraft.entity.ai.brain.MemoryModuleType; import net.minecraft.entity.ai.brain.task.LookTargetUtil; +import net.minecraft.entity.ai.brain.task.MultiTickTask; import net.minecraft.entity.ai.brain.task.Task; import net.minecraft.server.world.ServerWorld; -public class PelicanAttackTask extends Task { +public class PelicanAttackTask extends MultiTickTask { private final long interval; private Phase phase; private int catchingTicks; diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/ai/PelicanBrain.java b/src/main/java/com/eightsidedsquare/angling/common/entity/ai/PelicanBrain.java index 371c0f9..29b113e 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/ai/PelicanBrain.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/ai/PelicanBrain.java @@ -33,6 +33,7 @@ public static Brain create(Brain brain) { } private static void addCoreActivities(Brain brain) { + /* brain.setTaskList(Activity.CORE, 0, ImmutableList.of( new StayAboveWaterTask(0.8F), new WalkTask(2.5F), @@ -40,9 +41,11 @@ private static void addCoreActivities(Brain brain) { new WanderAroundTask(), new UpdateAttackTargetTask<>(entity -> entity.getBrain().getOptionalMemory(MemoryModuleType.NEAREST_ATTACKABLE)) )); + */ } private static void addIdleActivities(Brain brain) { + /* brain.setTaskList(Activity.IDLE, ImmutableList.of( Pair.of(0, new UpdateAttackTargetTask<>(entity -> entity.getBrain().getOptionalMemory(MemoryModuleType.NEAREST_ATTACKABLE))), Pair.of(1, new PelicanTradeTask()), @@ -53,17 +56,23 @@ private static void addIdleActivities(Brain brain) { Pair.of(new ConditionalTask<>(Entity::isOnGround, new WaitTask(5, 20)), 2), Pair.of(new ConditionalTask<>(PelicanEntity::isFlying, new NoPenaltyStrollTask(1f)), 2)))) )); + + */ } private static void addFightActivities(Brain brain) { + /* brain.setTaskList(Activity.FIGHT,0, ImmutableList.of( new ForgetAttackTargetTask<>(), new RangedApproachTask(entity -> 1f), new PelicanAttackTask(5) ), MemoryModuleType.ATTACK_TARGET); + + */ } private static void addSoarActivities(Brain brain) { + /* brain.setTaskList(Activity.RIDE, ImmutableList.of( Pair.of(0, new UpdateAttackTargetTask<>(entity -> entity.getBrain().getOptionalMemory(MemoryModuleType.NEAREST_ATTACKABLE))), Pair.of(1, new PelicanEatTask()), @@ -72,6 +81,8 @@ private static void addSoarActivities(Brain brain) { Pair.of(AnglingMemoryModuleTypes.SOARING_COOLDOWN, MemoryModuleState.VALUE_ABSENT), Pair.of(AnglingMemoryModuleTypes.CAN_TRADE, MemoryModuleState.VALUE_ABSENT)) ); + + */ } public static void updateActivities(PelicanEntity entity) { diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/ai/PelicanEatTask.java b/src/main/java/com/eightsidedsquare/angling/common/entity/ai/PelicanEatTask.java index ed18ae1..a66d7ee 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/ai/PelicanEatTask.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/ai/PelicanEatTask.java @@ -4,11 +4,11 @@ import com.eightsidedsquare.angling.core.ai.AnglingMemoryModuleTypes; import com.google.common.collect.ImmutableMap; import net.minecraft.entity.ai.brain.MemoryModuleState; -import net.minecraft.entity.ai.brain.task.Task; +import net.minecraft.entity.ai.brain.task.MultiTickTask; import net.minecraft.nbt.NbtCompound; import net.minecraft.server.world.ServerWorld; -public class PelicanEatTask extends Task { +public class PelicanEatTask extends MultiTickTask { public PelicanEatTask() { super(ImmutableMap.of(AnglingMemoryModuleTypes.HAS_TRADED, MemoryModuleState.VALUE_PRESENT)); } diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/ai/PelicanSoarTask.java b/src/main/java/com/eightsidedsquare/angling/common/entity/ai/PelicanSoarTask.java index 8c33a59..3b6aab7 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/ai/PelicanSoarTask.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/ai/PelicanSoarTask.java @@ -6,14 +6,14 @@ import net.minecraft.entity.ai.brain.MemoryModuleState; import net.minecraft.entity.ai.brain.MemoryModuleType; import net.minecraft.entity.ai.brain.WalkTarget; -import net.minecraft.entity.ai.brain.task.Task; +import net.minecraft.entity.ai.brain.task.MultiTickTask; +import net.minecraft.registry.tag.FluidTags; import net.minecraft.server.world.ServerWorld; -import net.minecraft.tag.FluidTags; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.Heightmap; -public class PelicanSoarTask extends Task { +public class PelicanSoarTask extends MultiTickTask { public PelicanSoarTask() { super(ImmutableMap.of( AnglingMemoryModuleTypes.SOARING_COOLDOWN, MemoryModuleState.VALUE_ABSENT, @@ -30,9 +30,9 @@ protected boolean shouldRun(ServerWorld world, PelicanEntity entity) { protected void run(ServerWorld world, PelicanEntity entity, long time) { Vec3d pos = entity.raycast(16, 0, false).getPos(); int topY = world.getTopY(Heightmap.Type.WORLD_SURFACE, (int) pos.x, (int) pos.z); - boolean isWater = world.getFluidState(new BlockPos(pos.x, topY - 1, pos.z)).isIn(FluidTags.WATER); + boolean isWater = world.getFluidState(new BlockPos((int) pos.x, topY - 1, (int) pos.z)).isIn(FluidTags.WATER); int y = topY + (isWater ? entity.getRandom().nextBetween(3, 8) : entity.getRandom().nextBetween(5, 25)); - BlockPos blockPos = new BlockPos(pos.x, y, pos.z); + BlockPos blockPos = new BlockPos((int) pos.x, y, (int) pos.z); if(world.getBlockState(blockPos).isAir()) { entity.getBrain().remember(MemoryModuleType.WALK_TARGET, new WalkTarget(blockPos, 1.5f, 1)); } diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/ai/PelicanTradeTask.java b/src/main/java/com/eightsidedsquare/angling/common/entity/ai/PelicanTradeTask.java index a31c771..377da1c 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/ai/PelicanTradeTask.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/ai/PelicanTradeTask.java @@ -6,12 +6,12 @@ import net.minecraft.entity.ai.brain.MemoryModuleState; import net.minecraft.entity.ai.brain.MemoryModuleType; import net.minecraft.entity.ai.brain.task.LookTargetUtil; -import net.minecraft.entity.ai.brain.task.Task; +import net.minecraft.entity.ai.brain.task.MultiTickTask; import net.minecraft.server.world.ServerWorld; import java.util.stream.Stream; -public class PelicanTradeTask extends Task { +public class PelicanTradeTask extends MultiTickTask { public PelicanTradeTask() { super(ImmutableMap.of( MemoryModuleType.WALK_TARGET, MemoryModuleState.VALUE_ABSENT, diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/ai/SeaSlugLayEggsGoal.java b/src/main/java/com/eightsidedsquare/angling/common/entity/ai/SeaSlugLayEggsGoal.java index 603ae7a..d945122 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/ai/SeaSlugLayEggsGoal.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/ai/SeaSlugLayEggsGoal.java @@ -10,8 +10,8 @@ import net.minecraft.entity.mob.PathAwareEntity; import net.minecraft.fluid.Fluids; import net.minecraft.nbt.NbtCompound; +import net.minecraft.registry.tag.BlockTags; import net.minecraft.state.property.Properties; -import net.minecraft.tag.BlockTags; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/ai/WanderAroundWaterGoal.java b/src/main/java/com/eightsidedsquare/angling/common/entity/ai/WanderAroundWaterGoal.java index 7c17211..5625f32 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/ai/WanderAroundWaterGoal.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/ai/WanderAroundWaterGoal.java @@ -2,7 +2,7 @@ import net.minecraft.entity.ai.goal.WanderAroundGoal; import net.minecraft.entity.mob.PathAwareEntity; -import net.minecraft.tag.FluidTags; +import net.minecraft.registry.tag.FluidTags; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import org.jetbrains.annotations.Nullable; @@ -25,7 +25,7 @@ public boolean canStart() { @Override protected Vec3d getWanderTarget() { Vec3d target = super.getWanderTarget(); - if(target != null && entity.world.getFluidState(new BlockPos(target.x, target.y, target.z)).isIn(FluidTags.WATER)) + if(target != null && entity.world.getFluidState(BlockPos.ofFloored(target.x, target.y, target.z)).isIn(FluidTags.WATER)) return target; return null; } diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/util/CrabVariant.java b/src/main/java/com/eightsidedsquare/angling/common/entity/util/CrabVariant.java index 7966b01..20f1969 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/util/CrabVariant.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/util/CrabVariant.java @@ -5,9 +5,9 @@ import net.fabricmc.fabric.api.event.registry.RegistryAttribute; import net.minecraft.entity.data.TrackedDataHandler; import net.minecraft.entity.data.TrackedDataHandlerRegistry; -import net.minecraft.tag.TagKey; +import net.minecraft.registry.Registry; +import net.minecraft.registry.tag.TagKey; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; import net.minecraft.world.biome.Biome; import java.util.LinkedHashMap; diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/util/PelicanBeakEntityInitializer.java b/src/main/java/com/eightsidedsquare/angling/common/entity/util/PelicanBeakEntityInitializer.java index c0ad40e..1e0ce84 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/util/PelicanBeakEntityInitializer.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/util/PelicanBeakEntityInitializer.java @@ -9,10 +9,10 @@ import net.minecraft.entity.passive.TropicalFishEntity; import net.minecraft.item.SpawnEggItem; import net.minecraft.nbt.NbtCompound; +import net.minecraft.registry.Registries; import net.minecraft.util.Identifier; import net.minecraft.util.Util; import net.minecraft.util.math.random.Random; -import net.minecraft.util.registry.Registry; import net.minecraft.world.World; import org.jetbrains.annotations.NotNull; @@ -50,7 +50,7 @@ public NbtCompound initialize(NbtCompound nbt, Random random, World world) { public NbtCompound initialize(NbtCompound nbt, Random random, World world) { int variant = random.nextInt(5) == 0 ? (random.nextInt(2) | random.nextInt(6) << 8 | random.nextInt(15) << 16 | random.nextInt(15) << 24) - : Util.getRandom(TropicalFishEntity.COMMON_VARIANTS, random); + : TropicalFishEntity.COMMON_VARIANTS.indexOf(Util.getRandom(TropicalFishEntity.COMMON_VARIANTS.toArray(), random)); nbt.putInt("Variant", variant); return nbt; } @@ -65,7 +65,7 @@ public NbtCompound initialize(NbtCompound nbt, Random random, World world) { registerInitializer(EntityType.FROG, new PelicanBeakEntityInitializer() { @Override public NbtCompound initialize(NbtCompound nbt, Random random, World world) { - Identifier variant = Registry.FROG_VARIANT.getId(Util.getRandom(Registry.FROG_VARIANT.stream().toList(), random)); + Identifier variant = Registries.FROG_VARIANT.getId(Util.getRandom(Registries.FROG_VARIANT.stream().toList(), random)); if(variant != null) nbt.putString("variant", variant.toString()); return nbt; @@ -93,7 +93,7 @@ public NbtCompound initialize(NbtCompound nbt, Random random, World world) { @Override public NbtCompound initialize(NbtCompound nbt, Random random, World world) { EntityType growUpTo = AnglingUtil.getRandomTagValue(world, AnglingEntityTypeTags.SPAWNING_FISH, random); - nbt.putString("GrowUpTo", Registry.ENTITY_TYPE.getId(growUpTo).toString()); + nbt.putString("GrowUpTo", Registries.ENTITY_TYPE.getId(growUpTo).toString()); NbtCompound variant = new NbtCompound(); if(!growUpTo.equals(AnglingEntities.FRY)) getInitializer(growUpTo).initialize(variant, random, world); diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/util/SeaSlugColor.java b/src/main/java/com/eightsidedsquare/angling/common/entity/util/SeaSlugColor.java index f589ce8..5559769 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/util/SeaSlugColor.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/util/SeaSlugColor.java @@ -4,9 +4,9 @@ import net.fabricmc.fabric.api.event.registry.RegistryAttribute; import net.minecraft.entity.data.TrackedDataHandler; import net.minecraft.entity.data.TrackedDataHandlerRegistry; -import net.minecraft.tag.TagKey; +import net.minecraft.registry.Registry; +import net.minecraft.registry.tag.TagKey; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; import java.util.LinkedHashMap; import java.util.Map; diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/util/SeaSlugPattern.java b/src/main/java/com/eightsidedsquare/angling/common/entity/util/SeaSlugPattern.java index 59b120f..c391048 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/util/SeaSlugPattern.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/util/SeaSlugPattern.java @@ -4,9 +4,9 @@ import net.fabricmc.fabric.api.event.registry.RegistryAttribute; import net.minecraft.entity.data.TrackedDataHandler; import net.minecraft.entity.data.TrackedDataHandlerRegistry; -import net.minecraft.tag.TagKey; +import net.minecraft.registry.Registry; +import net.minecraft.registry.tag.TagKey; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; import org.jetbrains.annotations.Nullable; import java.util.LinkedHashMap; diff --git a/src/main/java/com/eightsidedsquare/angling/common/entity/util/SunfishVariant.java b/src/main/java/com/eightsidedsquare/angling/common/entity/util/SunfishVariant.java index ec4db5e..cce22df 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/entity/util/SunfishVariant.java +++ b/src/main/java/com/eightsidedsquare/angling/common/entity/util/SunfishVariant.java @@ -4,9 +4,9 @@ import net.fabricmc.fabric.api.event.registry.RegistryAttribute; import net.minecraft.entity.data.TrackedDataHandler; import net.minecraft.entity.data.TrackedDataHandlerRegistry; -import net.minecraft.tag.TagKey; +import net.minecraft.registry.Registry; +import net.minecraft.registry.tag.TagKey; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; import java.util.LinkedHashMap; import java.util.Map; diff --git a/src/main/java/com/eightsidedsquare/angling/common/feature/NoisePatchFeature.java b/src/main/java/com/eightsidedsquare/angling/common/feature/NoisePatchFeature.java index a733849..54a7bc1 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/feature/NoisePatchFeature.java +++ b/src/main/java/com/eightsidedsquare/angling/common/feature/NoisePatchFeature.java @@ -4,12 +4,14 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.intprovider.UniformIntProvider; import net.minecraft.util.math.noise.DoublePerlinNoiseSampler; import net.minecraft.util.math.random.Random; import net.minecraft.world.StructureWorldAccess; import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.gen.feature.util.FeatureContext; import net.minecraft.world.gen.stateprovider.BlockStateProvider; +import net.minecraft.world.gen.stateprovider.SimpleBlockStateProvider; public class NoisePatchFeature extends Feature { @@ -17,6 +19,7 @@ public NoisePatchFeature(Codec configCodec) { super(configCodec); } + @Override @SuppressWarnings("deprecation") public boolean generate(FeatureContext ctx) { @@ -38,7 +41,7 @@ public boolean generate(FeatureContext ctx) { BlockPos blockPos = pos.add(x, 0, z); if(value > threshold) { - BlockState state = blockStateProvider.getBlockState(random, blockPos); + BlockState state = blockStateProvider.get(random, blockPos); if(state.canPlaceAt(world, blockPos)) world.setBlockState(blockPos, state, Block.NOTIFY_LISTENERS); } diff --git a/src/main/java/com/eightsidedsquare/angling/common/feature/WaterAdjacentPatchFeature.java b/src/main/java/com/eightsidedsquare/angling/common/feature/WaterAdjacentPatchFeature.java index e603574..cdbc0d5 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/feature/WaterAdjacentPatchFeature.java +++ b/src/main/java/com/eightsidedsquare/angling/common/feature/WaterAdjacentPatchFeature.java @@ -1,7 +1,7 @@ package com.eightsidedsquare.angling.common.feature; import com.mojang.serialization.Codec; -import net.minecraft.tag.FluidTags; +import net.minecraft.registry.tag.FluidTags; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import net.minecraft.world.StructureWorldAccess; diff --git a/src/main/java/com/eightsidedsquare/angling/common/feature/WaterloggablePatchFeature.java b/src/main/java/com/eightsidedsquare/angling/common/feature/WaterloggablePatchFeature.java index 11ceedc..6778110 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/feature/WaterloggablePatchFeature.java +++ b/src/main/java/com/eightsidedsquare/angling/common/feature/WaterloggablePatchFeature.java @@ -5,8 +5,8 @@ import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.fluid.Fluids; +import net.minecraft.registry.tag.BlockTags; import net.minecraft.state.property.Properties; -import net.minecraft.tag.BlockTags; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.random.Random; import net.minecraft.world.Heightmap; @@ -33,7 +33,7 @@ public boolean generate(FeatureContext ctx) { int dz = random.nextInt(range) - random.nextInt(range); int y = structureWorldAccess.getTopY(Heightmap.Type.OCEAN_FLOOR, blockPos.getX() + dx, blockPos.getZ() + dz); BlockPos blockPos2 = new BlockPos(blockPos.getX() + dx, y, blockPos.getZ() + dz); - BlockState state = ctx.getConfig().toPlace().getBlockState(random, blockPos2); + BlockState state = ctx.getConfig().toPlace().get(random, blockPos2); if (state.canPlaceAt(structureWorldAccess, blockPos2) && !structureWorldAccess.getBlockState(blockPos2.up()).isOf(Blocks.TALL_SEAGRASS) && !structureWorldAccess.getBlockState(blockPos2.down()).isIn(BlockTags.ICE)) { diff --git a/src/main/java/com/eightsidedsquare/angling/common/feature/WormyBlockFeature.java b/src/main/java/com/eightsidedsquare/angling/common/feature/WormyBlockFeature.java index 3bd4b57..86edf66 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/feature/WormyBlockFeature.java +++ b/src/main/java/com/eightsidedsquare/angling/common/feature/WormyBlockFeature.java @@ -6,7 +6,7 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; -import net.minecraft.tag.BlockTags; +import net.minecraft.registry.tag.BlockTags; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.util.math.random.Random; diff --git a/src/main/java/com/eightsidedsquare/angling/common/item/RoeBlockItem.java b/src/main/java/com/eightsidedsquare/angling/common/item/RoeBlockItem.java index 699bd97..1ad6c29 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/item/RoeBlockItem.java +++ b/src/main/java/com/eightsidedsquare/angling/common/item/RoeBlockItem.java @@ -11,11 +11,11 @@ import net.minecraft.item.SpawnEggItem; import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtElement; +import net.minecraft.registry.Registries; import net.minecraft.text.Text; import net.minecraft.util.Formatting; import net.minecraft.util.Identifier; import net.minecraft.util.collection.DefaultedList; -import net.minecraft.util.registry.Registry; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; @@ -33,15 +33,15 @@ public void appendTooltip(ItemStack stack, @Nullable World world, List too super.appendTooltip(stack, world, tooltip, context); NbtCompound nbt = getBlockEntityNbt(stack); if(nbt != null && nbt.contains("EntityType", NbtElement.STRING_TYPE)) { - String key = Registry.ENTITY_TYPE.get(Identifier.tryParse(nbt.getString("EntityType"))).getTranslationKey(); + String key = Registries.ENTITY_TYPE.get(Identifier.tryParse(nbt.getString("EntityType"))).getTranslationKey(); tooltip.add(Text.translatable(key).formatted(Formatting.GRAY)); } } - @Override +/* public void appendStacks(ItemGroup group, DefaultedList stacks) { if(this.isIn(group)) { - Registry.ENTITY_TYPE.stream() + Registries.ENTITY_TYPE.stream() .filter(type -> type.isIn(AnglingEntityTypeTags.SPAWNING_FISH)) .map(SpawnEggItem::forEntity) .filter(Objects::nonNull) @@ -50,10 +50,11 @@ public void appendStacks(ItemGroup group, DefaultedList stacks) { NbtCompound nbt = new NbtCompound(); nbt.putInt("PrimaryColor", egg.getColor(0)); nbt.putInt("SecondaryColor", egg.getColor(0)); - nbt.putString("EntityType", Registry.ENTITY_TYPE.getId(egg.getEntityType(null)).toString()); + nbt.putString("EntityType", Registries.ENTITY_TYPE.getId(egg.getEntityType(null)).toString()); setBlockEntityNbt(stack, AnglingEntities.ROE, nbt); stacks.add(stack); }); } } + */ } diff --git a/src/main/java/com/eightsidedsquare/angling/common/item/UrchinBucketItem.java b/src/main/java/com/eightsidedsquare/angling/common/item/UrchinBucketItem.java index 5e6e0e5..76edee8 100644 --- a/src/main/java/com/eightsidedsquare/angling/common/item/UrchinBucketItem.java +++ b/src/main/java/com/eightsidedsquare/angling/common/item/UrchinBucketItem.java @@ -23,7 +23,7 @@ public UrchinBucketItem(Settings settings) { protected boolean postPlacement(BlockPos pos, World world, @Nullable PlayerEntity player, ItemStack stack, BlockState state) { if(player != null && !player.isCreative() && !player.giveItemStack(new ItemStack(Items.BUCKET))) player.dropItem(new ItemStack(Items.BUCKET), true); - world.createAndScheduleFluidTick(pos, world.getFluidState(pos).getFluid(), 1); + world.scheduleFluidTick(pos, world.getFluidState(pos).getFluid(), 1); if(world.getDimension().ultrawarm()) world.setBlockState(pos, state.with(Properties.WATERLOGGED, false)); return super.postPlacement(pos, world, player, stack, state); diff --git a/src/main/java/com/eightsidedsquare/angling/core/AnglingBlocks.java b/src/main/java/com/eightsidedsquare/angling/core/AnglingBlocks.java index 768e402..17ed62b 100644 --- a/src/main/java/com/eightsidedsquare/angling/core/AnglingBlocks.java +++ b/src/main/java/com/eightsidedsquare/angling/core/AnglingBlocks.java @@ -1,13 +1,31 @@ package com.eightsidedsquare.angling.core; -import com.eightsidedsquare.angling.common.block.*; -import net.minecraft.block.*; +import com.eightsidedsquare.angling.common.block.AlgaeBlock; +import com.eightsidedsquare.angling.common.block.AnemoneBlock; +import com.eightsidedsquare.angling.common.block.ClamBlock; +import com.eightsidedsquare.angling.common.block.OystersBlock; +import com.eightsidedsquare.angling.common.block.PapyrusBlock; +import com.eightsidedsquare.angling.common.block.RoeBlock; +import com.eightsidedsquare.angling.common.block.SeaSlugEggsBlock; +import com.eightsidedsquare.angling.common.block.StarfishBlock; +import com.eightsidedsquare.angling.common.block.UrchinBlock; +import com.eightsidedsquare.angling.common.block.WaterFloatingPlant; +import com.eightsidedsquare.angling.common.block.WormyDirtBlock; +import com.eightsidedsquare.angling.common.block.WormyMudBlock; +import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; +import net.minecraft.block.AbstractBlock; +import net.minecraft.block.Block; +import net.minecraft.block.Blocks; +import net.minecraft.block.MapColor; +import net.minecraft.block.Material; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; +import net.minecraft.item.ItemGroups; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; import net.minecraft.sound.BlockSoundGroup; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; import java.util.LinkedHashMap; import java.util.Map; @@ -19,31 +37,34 @@ public class AnglingBlocks { private static final Map ITEMS = new LinkedHashMap<>(); public static final Block ROE = create("roe", new RoeBlock(AbstractBlock.Settings.of(Material.FROGSPAWN, MapColor.ORANGE).noCollision().nonOpaque().breakInstantly().sounds(BlockSoundGroup.FROGSPAWN)), null); - public static final Block SEA_SLUG_EGGS = create("sea_slug_eggs", new SeaSlugEggsBlock(AbstractBlock.Settings.copy(ROE).offsetType(AbstractBlock.OffsetType.XZ).dynamicBounds()), null); + public static final Block SEA_SLUG_EGGS = create("sea_slug_eggs", new SeaSlugEggsBlock(AbstractBlock.Settings.copy(ROE).offset(AbstractBlock.OffsetType.XZ).dynamicBounds()), null); public static final Block DUCKWEED = create("duckweed", new WaterFloatingPlant(AbstractBlock.Settings.of(Material.REPLACEABLE_PLANT, MapColor.LIME).breakInstantly().nonOpaque().noCollision().sounds(BlockSoundGroup.WET_GRASS)), null); - public static final Block ALGAE = create("algae", new AlgaeBlock(AbstractBlock.Settings.of(Material.REPLACEABLE_PLANT, MapColor.GREEN).sounds(BlockSoundGroup.FROGSPAWN).noCollision().nonOpaque().strength(0.1f).ticksRandomly()), ItemGroup.DECORATIONS); - public static final Block WORMY_DIRT = create("wormy_dirt", new WormyDirtBlock(AbstractBlock.Settings.copy(Blocks.DIRT)), ItemGroup.BUILDING_BLOCKS); - public static final Block WORMY_MUD = create("wormy_mud", new WormyMudBlock(AbstractBlock.Settings.copy(Blocks.MUD)), ItemGroup.BUILDING_BLOCKS); - public static final Block OYSTERS = create("oysters", new OystersBlock(AbstractBlock.Settings.of(Material.SOLID_ORGANIC, MapColor.OAK_TAN).strength(0.5f).nonOpaque().sounds(AnglingSounds.SHELL_SOUND_GROUP)), ItemGroup.DECORATIONS); - public static final Block STARFISH = create("starfish", new StarfishBlock(AbstractBlock.Settings.of(Material.UNDERWATER_PLANT, MapColor.WHITE).strength(0.1f).nonOpaque().noCollision().sounds(AnglingSounds.SHELL_SOUND_GROUP).ticksRandomly(), false), ItemGroup.DECORATIONS); - public static final Block DEAD_STARFISH = create("dead_starfish", new StarfishBlock(AbstractBlock.Settings.copy(STARFISH), true), ItemGroup.DECORATIONS); - public static final Block CLAM = create("clam", new ClamBlock(AbstractBlock.Settings.of(Material.UNDERWATER_PLANT, MapColor.WHITE).sounds(AnglingSounds.SHELL_SOUND_GROUP).offsetType(AbstractBlock.OffsetType.XZ).strength(0.05f).nonOpaque()), ItemGroup.DECORATIONS); - public static final Block ANEMONE = create("anemone", new AnemoneBlock(AbstractBlock.Settings.of(Material.UNDERWATER_PLANT, MapColor.WHITE).strength(0.1f).nonOpaque().noCollision().sounds(BlockSoundGroup.SLIME).ticksRandomly()), ItemGroup.DECORATIONS); + public static final Block ALGAE = create("algae", new AlgaeBlock(AbstractBlock.Settings.of(Material.REPLACEABLE_PLANT, MapColor.GREEN).sounds(BlockSoundGroup.FROGSPAWN).noCollision().nonOpaque().strength(0.1f).ticksRandomly()), ItemGroups.SPAWN_EGGS); + public static final Block WORMY_DIRT = create("wormy_dirt", new WormyDirtBlock(AbstractBlock.Settings.copy(Blocks.DIRT)), ItemGroups.BUILDING_BLOCKS); + public static final Block WORMY_MUD = create("wormy_mud", new WormyMudBlock(AbstractBlock.Settings.copy(Blocks.MUD)), ItemGroups.BUILDING_BLOCKS); + public static final Block OYSTERS = create("oysters", new OystersBlock(AbstractBlock.Settings.of(Material.SOLID_ORGANIC, MapColor.OAK_TAN).strength(0.5f).nonOpaque().sounds(AnglingSounds.SHELL_SOUND_GROUP)), ItemGroups.SPAWN_EGGS); + public static final Block STARFISH = create("starfish", new StarfishBlock(AbstractBlock.Settings.of(Material.UNDERWATER_PLANT, MapColor.WHITE).strength(0.1f).nonOpaque().noCollision().sounds(AnglingSounds.SHELL_SOUND_GROUP).ticksRandomly(), false), ItemGroups.SPAWN_EGGS); + public static final Block DEAD_STARFISH = create("dead_starfish", new StarfishBlock(AbstractBlock.Settings.copy(STARFISH), true), ItemGroups.SPAWN_EGGS); + public static final Block CLAM = create("clam", new ClamBlock(AbstractBlock.Settings.of(Material.UNDERWATER_PLANT, MapColor.WHITE).sounds(AnglingSounds.SHELL_SOUND_GROUP).offset(AbstractBlock.OffsetType.XZ).strength(0.05f).nonOpaque()), ItemGroups.SPAWN_EGGS); + public static final Block ANEMONE = create("anemone", new AnemoneBlock(AbstractBlock.Settings.of(Material.UNDERWATER_PLANT, MapColor.WHITE).strength(0.1f).nonOpaque().noCollision().sounds(BlockSoundGroup.SLIME).ticksRandomly()), ItemGroups.SPAWN_EGGS); public static final Block URCHIN = create("urchin", new UrchinBlock(AbstractBlock.Settings.of(Material.UNDERWATER_PLANT, MapColor.TERRACOTTA_BLUE).strength(0.1f).nonOpaque().noCollision().sounds(AnglingSounds.SHELL_SOUND_GROUP)), null); public static final Block SARGASSUM = create("sargassum", new WaterFloatingPlant(AbstractBlock.Settings.of(Material.REPLACEABLE_PLANT, MapColor.YELLOW).breakInstantly().nonOpaque().noCollision().sounds(BlockSoundGroup.WET_GRASS)), null); - public static final Block PAPYRUS = create("papyrus", new PapyrusBlock(AbstractBlock.Settings.of(Material.UNDERWATER_PLANT, MapColor.GREEN).strength(0).breakInstantly().nonOpaque().noCollision().sounds(BlockSoundGroup.AZALEA).ticksRandomly().offsetType(AbstractBlock.OffsetType.XZ).dynamicBounds()), ItemGroup.DECORATIONS); + public static final Block PAPYRUS = create("papyrus", new PapyrusBlock(AbstractBlock.Settings.of(Material.UNDERWATER_PLANT, MapColor.GREEN).strength(0).breakInstantly().nonOpaque().noCollision().sounds(BlockSoundGroup.AZALEA).ticksRandomly().offset(AbstractBlock.OffsetType.XZ).dynamicBounds()), ItemGroups.SPAWN_EGGS); private static T create(String name, T block, ItemGroup itemGroup) { - BLOCKS.put(block, new Identifier(MOD_ID, name)); if (itemGroup != null) { - ITEMS.put(new BlockItem(block, new Item.Settings().group(itemGroup)), BLOCKS.get(block)); + BlockItem blockItem = new BlockItem(block, new Item.Settings()); + ITEMS.put(blockItem, BLOCKS.get(block)); + ItemGroupEvents.modifyEntriesEvent(itemGroup).register(entries -> { + entries.add(blockItem); + }); } return block; } public static void init() { - BLOCKS.keySet().forEach(block -> Registry.register(Registry.BLOCK, BLOCKS.get(block), block)); - ITEMS.keySet().forEach(item -> Registry.register(Registry.ITEM, ITEMS.get(item), item)); + BLOCKS.keySet().forEach(block -> Registry.register(Registries.BLOCK, BLOCKS.get(block), block)); + ITEMS.keySet().forEach(item -> Registry.register(Registries.ITEM, ITEMS.get(item), item)); } } diff --git a/src/main/java/com/eightsidedsquare/angling/core/AnglingDataGenerator.java b/src/main/java/com/eightsidedsquare/angling/core/AnglingDataGenerator.java new file mode 100644 index 0000000..8bcde2e --- /dev/null +++ b/src/main/java/com/eightsidedsquare/angling/core/AnglingDataGenerator.java @@ -0,0 +1,21 @@ +package com.eightsidedsquare.angling.core; + +import com.eightsidedsquare.angling.core.world.AnglingConfiguredFeatures; +import com.eightsidedsquare.angling.core.world.AnglingPlacedFeatures; +import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint; +import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator; +import net.minecraft.registry.RegistryBuilder; +import net.minecraft.registry.RegistryKeys; + +public class AnglingDataGenerator implements DataGeneratorEntrypoint { + @Override + public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) { + + } + + @Override + public void buildRegistry(RegistryBuilder registryBuilder) { + registryBuilder.addRegistry(RegistryKeys.PLACED_FEATURE, AnglingPlacedFeatures::bootstrap); + registryBuilder.addRegistry(RegistryKeys.CONFIGURED_FEATURE, AnglingConfiguredFeatures::bootstrap); + } +} diff --git a/src/main/java/com/eightsidedsquare/angling/core/AnglingEntities.java b/src/main/java/com/eightsidedsquare/angling/core/AnglingEntities.java index 66eab06..fcd682b 100644 --- a/src/main/java/com/eightsidedsquare/angling/core/AnglingEntities.java +++ b/src/main/java/com/eightsidedsquare/angling/core/AnglingEntities.java @@ -13,8 +13,9 @@ import net.minecraft.entity.mob.MobEntity; import net.minecraft.entity.mob.WaterCreatureEntity; import net.minecraft.entity.passive.FishEntity; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; import net.minecraft.world.Heightmap; import static com.eightsidedsquare.angling.core.AnglingMod.MOD_ID; @@ -22,7 +23,7 @@ public class AnglingEntities { public static final BlockEntityType ROE = Registry.register( - Registry.BLOCK_ENTITY_TYPE, + Registries.BLOCK_ENTITY_TYPE, new Identifier(MOD_ID, "roe"), FabricBlockEntityTypeBuilder .create(RoeBlockEntity::new) @@ -31,7 +32,7 @@ public class AnglingEntities { ); public static final BlockEntityType STARFISH = Registry.register( - Registry.BLOCK_ENTITY_TYPE, + Registries.BLOCK_ENTITY_TYPE, new Identifier(MOD_ID, "starfish"), FabricBlockEntityTypeBuilder .create(StarfishBlockEntity::new) @@ -40,7 +41,7 @@ public class AnglingEntities { ); public static final BlockEntityType SEA_SLUG_EGGS = Registry.register( - Registry.BLOCK_ENTITY_TYPE, + Registries.BLOCK_ENTITY_TYPE, new Identifier(MOD_ID, "sea_slug_eggs"), FabricBlockEntityTypeBuilder .create(SeaSlugEggsBlockEntity::new) @@ -49,7 +50,7 @@ public class AnglingEntities { ); public static final BlockEntityType ANEMONE = Registry.register( - Registry.BLOCK_ENTITY_TYPE, + Registries.BLOCK_ENTITY_TYPE, new Identifier(MOD_ID, "anemone"), FabricBlockEntityTypeBuilder .create(AnemoneBlockEntity::new) @@ -58,7 +59,7 @@ public class AnglingEntities { ); public static final BlockEntityType URCHIN = Registry.register( - Registry.BLOCK_ENTITY_TYPE, + Registries.BLOCK_ENTITY_TYPE, new Identifier(MOD_ID, "urchin"), FabricBlockEntityTypeBuilder .create(UrchinBlockEntity::new) @@ -67,7 +68,7 @@ public class AnglingEntities { ); public static final EntityType FRY = Registry.register( - Registry.ENTITY_TYPE, + Registries.ENTITY_TYPE, new Identifier(MOD_ID, "fry"), FabricEntityTypeBuilder.createMob() .entityFactory(FryEntity::new) @@ -79,7 +80,7 @@ public class AnglingEntities { ); public static final EntityType SUNFISH = Registry.register( - Registry.ENTITY_TYPE, + Registries.ENTITY_TYPE, new Identifier(MOD_ID, "sunfish"), FabricEntityTypeBuilder.createMob() .entityFactory(SunfishEntity::new) @@ -91,7 +92,7 @@ public class AnglingEntities { ); public static final EntityType PELICAN = Registry.register( - Registry.ENTITY_TYPE, + Registries.ENTITY_TYPE, new Identifier(MOD_ID, "pelican"), FabricEntityTypeBuilder.createMob() .entityFactory(PelicanEntity::new) @@ -103,7 +104,7 @@ public class AnglingEntities { ); public static final EntityType NAUTILUS = Registry.register( - Registry.ENTITY_TYPE, + Registries.ENTITY_TYPE, new Identifier(MOD_ID, "nautilus"), FabricEntityTypeBuilder.createMob() .entityFactory(NautilusEntity::new) @@ -115,7 +116,7 @@ public class AnglingEntities { ); public static final EntityType SEA_SLUG = Registry.register( - Registry.ENTITY_TYPE, + Registries.ENTITY_TYPE, new Identifier(MOD_ID, "sea_slug"), FabricEntityTypeBuilder.createMob() .entityFactory(SeaSlugEntity::new) @@ -127,7 +128,7 @@ public class AnglingEntities { ); public static final EntityType CRAB = Registry.register( - Registry.ENTITY_TYPE, + Registries.ENTITY_TYPE, new Identifier(MOD_ID, "crab"), FabricEntityTypeBuilder.createMob() .entityFactory(CrabEntity::new) @@ -139,7 +140,7 @@ public class AnglingEntities { ); public static final EntityType DONGFISH = Registry.register( - Registry.ENTITY_TYPE, + Registries.ENTITY_TYPE, new Identifier(MOD_ID, "dongfish"), FabricEntityTypeBuilder.createMob() .entityFactory(DongfishEntity::new) @@ -151,7 +152,7 @@ public class AnglingEntities { ); public static final EntityType CATFISH = Registry.register( - Registry.ENTITY_TYPE, + Registries.ENTITY_TYPE, new Identifier(MOD_ID, "catfish"), FabricEntityTypeBuilder.createMob() .entityFactory(CatfishEntity::new) @@ -163,7 +164,7 @@ public class AnglingEntities { ); public static final EntityType SEAHORSE = Registry.register( - Registry.ENTITY_TYPE, + Registries.ENTITY_TYPE, new Identifier(MOD_ID, "seahorse"), FabricEntityTypeBuilder.createMob() .entityFactory(SeahorseEntity::new) @@ -175,7 +176,7 @@ public class AnglingEntities { ); public static final EntityType BUBBLE_EYE = Registry.register( - Registry.ENTITY_TYPE, + Registries.ENTITY_TYPE, new Identifier(MOD_ID, "bubble_eye"), FabricEntityTypeBuilder.createMob() .entityFactory(BubbleEyeEntity::new) @@ -187,7 +188,7 @@ public class AnglingEntities { ); public static final EntityType ANOMALOCARIS = Registry.register( - Registry.ENTITY_TYPE, + Registries.ENTITY_TYPE, new Identifier(MOD_ID, "anomalocaris"), FabricEntityTypeBuilder.createMob() .entityFactory(AnomalocarisEntity::new) @@ -199,7 +200,7 @@ public class AnglingEntities { ); public static final EntityType ANGLERFISH = Registry.register( - Registry.ENTITY_TYPE, + Registries.ENTITY_TYPE, new Identifier(MOD_ID, "anglerfish"), FabricEntityTypeBuilder.createMob() .entityFactory(AnglerfishEntity::new) @@ -211,7 +212,7 @@ public class AnglingEntities { ); public static final EntityType MAHI_MAHI = Registry.register( - Registry.ENTITY_TYPE, + Registries.ENTITY_TYPE, new Identifier(MOD_ID, "mahi_mahi"), FabricEntityTypeBuilder.createMob() .entityFactory(MahiMahiEntity::new) diff --git a/src/main/java/com/eightsidedsquare/angling/core/AnglingItems.java b/src/main/java/com/eightsidedsquare/angling/core/AnglingItems.java index 70eaa45..afe86f8 100644 --- a/src/main/java/com/eightsidedsquare/angling/core/AnglingItems.java +++ b/src/main/java/com/eightsidedsquare/angling/core/AnglingItems.java @@ -3,14 +3,16 @@ import com.eightsidedsquare.angling.common.item.RoeBlockItem; import com.eightsidedsquare.angling.common.item.UrchinBucketItem; import com.eightsidedsquare.angling.common.item.WormItem; +import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; import net.fabricmc.fabric.api.registry.CompostingChanceRegistry; import net.minecraft.entity.EntityType; import net.minecraft.entity.mob.MobEntity; import net.minecraft.fluid.Fluids; import net.minecraft.item.*; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; import net.minecraft.sound.SoundEvents; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; import java.util.LinkedHashMap; import java.util.Map; @@ -35,10 +37,10 @@ public class AnglingItems { public static final Item ANOMALOCARIS_SPAWN_EGG = createSpawnEgg("anomalocaris", AnglingEntities.ANOMALOCARIS, 0xebb595, 0x333333); public static final Item ANGLERFISH_SPAWN_EGG = createSpawnEgg("anglerfish", AnglingEntities.ANGLERFISH, 0x58251c, 0xd9fffc); public static final Item MAHI_MAHI_SPAWN_EGG = createSpawnEgg("mahi_mahi", AnglingEntities.MAHI_MAHI, 0xb2b729, 0x4f8f2f); - public static final Item ROE = create("roe", new RoeBlockItem(AnglingBlocks.ROE, new Item.Settings().group(ItemGroup.MISC).maxCount(1))); - public static final Item SEA_SLUG_EGGS = create("sea_slug_eggs", new BlockItem(AnglingBlocks.SEA_SLUG_EGGS, new Item.Settings().group(ItemGroup.MISC).maxCount(1))); - public static final Item DUCKWEED = create("duckweed", new PlaceableOnWaterItem(AnglingBlocks.DUCKWEED, new Item.Settings().group(ItemGroup.DECORATIONS))); - public static final Item SARGASSUM = create("sargassum", new PlaceableOnWaterItem(AnglingBlocks.SARGASSUM, new Item.Settings().group(ItemGroup.DECORATIONS))); + public static final Item ROE = create("roe", new RoeBlockItem(AnglingBlocks.ROE, new Item.Settings().maxCount(1)), ItemGroups.NATURAL); + public static final Item SEA_SLUG_EGGS = create("sea_slug_eggs", new BlockItem(AnglingBlocks.SEA_SLUG_EGGS, new Item.Settings().maxCount(1)), ItemGroups.NATURAL); + public static final Item DUCKWEED = create("duckweed", new PlaceableOnWaterItem(AnglingBlocks.DUCKWEED, new Item.Settings()), ItemGroups.NATURAL); + public static final Item SARGASSUM = create("sargassum", new PlaceableOnWaterItem(AnglingBlocks.SARGASSUM, new Item.Settings()), ItemGroups.NATURAL); public static final Item SUNFISH_BUCKET = createBucket("sunfish", AnglingEntities.SUNFISH); public static final Item NAUTILUS_BUCKET = createBucket("nautilus", AnglingEntities.NAUTILUS); public static final Item FRY_BUCKET = createBucket("fry", AnglingEntities.FRY); @@ -51,14 +53,14 @@ public class AnglingItems { public static final Item ANOMALOCARIS_BUCKET = createBucket("anomalocaris", AnglingEntities.ANOMALOCARIS); public static final Item ANGLERFISH_BUCKET = createBucket("anglerfish", AnglingEntities.ANGLERFISH); public static final Item MAHI_MAHI_BUCKET = createBucket("mahi_mahi", AnglingEntities.MAHI_MAHI); - public static final Item URCHIN_BUCKET = create("urchin_bucket", new UrchinBucketItem(new Item.Settings().group(ItemGroup.MISC).maxCount(1))); - public static final Item WORM = create("worm", new WormItem(new Item.Settings().group(ItemGroup.MISC))); - public static final Item SUNFISH = create("sunfish", new Item(new Item.Settings().group(ItemGroup.FOOD).food(new FoodComponent.Builder().hunger(2).saturationModifier(0.2f).build()))); - public static final Item FRIED_SUNFISH = create("fried_sunfish", new Item(new Item.Settings().group(ItemGroup.FOOD).food(new FoodComponent.Builder().hunger(6).saturationModifier(0.9f).build()))); + public static final Item URCHIN_BUCKET = create("urchin_bucket", new UrchinBucketItem(new Item.Settings().maxCount(1)), ItemGroups.TOOLS); + public static final Item WORM = create("worm", new WormItem(new Item.Settings()), ItemGroups.NATURAL); + public static final Item SUNFISH = create("sunfish", new Item(new Item.Settings().food(new FoodComponent.Builder().hunger(2).saturationModifier(0.2f).build())), ItemGroups.FOOD_AND_DRINK); + public static final Item FRIED_SUNFISH = create("fried_sunfish", new Item(new Item.Settings().food(new FoodComponent.Builder().hunger(6).saturationModifier(0.9f).build())), ItemGroups.FOOD_AND_DRINK); public static void init() { - ITEMS.keySet().forEach(item -> Registry.register(Registry.ITEM, ITEMS.get(item), item)); + ITEMS.keySet().forEach(item -> Registry.register(Registries.ITEM, ITEMS.get(item), item)); registerCompostable(DUCKWEED, 0.3f); registerCompostable(SARGASSUM, 0.3f); registerCompostable(WORM, 1f); @@ -67,17 +69,22 @@ public static void init() { } - private static T create(String name, T item) { + private static T create(String name, T item, ItemGroup group) { ITEMS.put(item, new Identifier(MOD_ID, name)); + + ItemGroupEvents.modifyEntriesEvent(group).register(entries -> { + entries.add(item); + }); + return item; } private static Item createBucket(String name, EntityType type) { - return create(name + "_bucket", new EntityBucketItem(type, Fluids.WATER, SoundEvents.ITEM_BUCKET_EMPTY_FISH, new Item.Settings().group(ItemGroup.MISC).maxCount(1))); + return create(name + "_bucket", new EntityBucketItem(type, Fluids.WATER, SoundEvents.ITEM_BUCKET_EMPTY_FISH, new Item.Settings().maxCount(1)), ItemGroups.TOOLS); } private static Item createSpawnEgg(String name, EntityType type, int primary, int secondary) { - return create(name + "_spawn_egg", new SpawnEggItem(type, primary, secondary, new Item.Settings().group(ItemGroup.MISC))); + return create(name + "_spawn_egg", new SpawnEggItem(type, primary, secondary, new Item.Settings()), ItemGroups.SPAWN_EGGS); } private static void registerCompostable(T item, float chance){ diff --git a/src/main/java/com/eightsidedsquare/angling/core/AnglingMixinPlugin.java b/src/main/java/com/eightsidedsquare/angling/core/AnglingMixinPlugin.java index 6fb2c80..edb63bf 100644 --- a/src/main/java/com/eightsidedsquare/angling/core/AnglingMixinPlugin.java +++ b/src/main/java/com/eightsidedsquare/angling/core/AnglingMixinPlugin.java @@ -21,7 +21,7 @@ public String getRefMapperConfig() { @Override public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { - if(mixinClassName.toLowerCase().contains("sodium")) { + if (mixinClassName.toLowerCase().contains("sodium")) { return FabricLoader.getInstance().isModLoaded("sodium"); } return true; diff --git a/src/main/java/com/eightsidedsquare/angling/core/AnglingMod.java b/src/main/java/com/eightsidedsquare/angling/core/AnglingMod.java index 0c428ba..c9438d5 100644 --- a/src/main/java/com/eightsidedsquare/angling/core/AnglingMod.java +++ b/src/main/java/com/eightsidedsquare/angling/core/AnglingMod.java @@ -1,6 +1,11 @@ package com.eightsidedsquare.angling.core; -import com.eightsidedsquare.angling.common.entity.util.*; +import com.eightsidedsquare.angling.common.entity.util.CrabVariant; +import com.eightsidedsquare.angling.common.entity.util.FishVariantInheritance; +import com.eightsidedsquare.angling.common.entity.util.PelicanBeakEntityInitializer; +import com.eightsidedsquare.angling.common.entity.util.SeaSlugColor; +import com.eightsidedsquare.angling.common.entity.util.SeaSlugPattern; +import com.eightsidedsquare.angling.common.entity.util.SunfishVariant; import com.eightsidedsquare.angling.common.world.PelicanSpawner; import com.eightsidedsquare.angling.config.AnglingConfig; import com.eightsidedsquare.angling.core.world.AnglingPlacedFeatures; @@ -8,33 +13,32 @@ import me.shedaniel.autoconfig.serializer.JanksonConfigSerializer; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; -import software.bernie.geckolib3.GeckoLib; +import software.bernie.geckolib.GeckoLib; public class AnglingMod implements ModInitializer { - public static final String MOD_ID = "angling"; - public static AnglingConfig CONFIG; + public static final String MOD_ID = "angling"; + public static AnglingConfig CONFIG; - @Override - public void onInitialize() { - GeckoLib.initialize(); - AnglingBlocks.init(); - AnglingItems.init(); - AnglingSounds.init(); - AnglingEntities.init(); - SunfishVariant.init(); - SeaSlugPattern.init(); - SeaSlugColor.init(); - CrabVariant.init(); - AnglingCriteria.init(); - AnglingPlacedFeatures.init(); - AnglingParticles.init(); - FishVariantInheritance.init(); - PelicanBeakEntityInitializer.init(); + @Override + public void onInitialize() { + GeckoLib.initialize(); + AnglingBlocks.init(); + AnglingItems.init(); + AnglingSounds.init(); + AnglingEntities.init(); + SunfishVariant.init(); + SeaSlugPattern.init(); + SeaSlugColor.init(); + CrabVariant.init(); + AnglingCriteria.init(); + AnglingParticles.init(); + FishVariantInheritance.init(); + PelicanBeakEntityInitializer.init(); - PelicanSpawner spawner = new PelicanSpawner(); - ServerTickEvents.END_WORLD_TICK.register(world -> spawner.spawn(world, world.getServer().isMonsterSpawningEnabled(), world.getServer().shouldSpawnAnimals())); + PelicanSpawner spawner = new PelicanSpawner(); + ServerTickEvents.END_WORLD_TICK.register(world -> spawner.spawn(world, world.getServer().isMonsterSpawningEnabled(), world.getServer().shouldSpawnAnimals())); - AutoConfig.register(AnglingConfig.class, JanksonConfigSerializer::new); - CONFIG = AutoConfig.getConfigHolder(AnglingConfig.class).getConfig(); - } + AutoConfig.register(AnglingConfig.class, JanksonConfigSerializer::new); + CONFIG = AutoConfig.getConfigHolder(AnglingConfig.class).getConfig(); + } } diff --git a/src/main/java/com/eightsidedsquare/angling/core/AnglingParticles.java b/src/main/java/com/eightsidedsquare/angling/core/AnglingParticles.java index 2059003..15027f6 100644 --- a/src/main/java/com/eightsidedsquare/angling/core/AnglingParticles.java +++ b/src/main/java/com/eightsidedsquare/angling/core/AnglingParticles.java @@ -2,15 +2,16 @@ import net.fabricmc.fabric.api.particle.v1.FabricParticleTypes; import net.minecraft.particle.DefaultParticleType; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; import static com.eightsidedsquare.angling.core.AnglingMod.MOD_ID; public class AnglingParticles { - public static DefaultParticleType ALGAE = Registry.register(Registry.PARTICLE_TYPE, new Identifier(MOD_ID, "algae"), FabricParticleTypes.simple(true)); - public static DefaultParticleType WORM = Registry.register(Registry.PARTICLE_TYPE, new Identifier(MOD_ID, "worm"), FabricParticleTypes.simple(true)); + public static DefaultParticleType ALGAE = Registry.register(Registries.PARTICLE_TYPE, new Identifier(MOD_ID, "algae"), FabricParticleTypes.simple(true)); + public static DefaultParticleType WORM = Registry.register(Registries.PARTICLE_TYPE, new Identifier(MOD_ID, "worm"), FabricParticleTypes.simple(true)); public static void init() { diff --git a/src/main/java/com/eightsidedsquare/angling/core/AnglingSounds.java b/src/main/java/com/eightsidedsquare/angling/core/AnglingSounds.java index 60a9678..05c2716 100644 --- a/src/main/java/com/eightsidedsquare/angling/core/AnglingSounds.java +++ b/src/main/java/com/eightsidedsquare/angling/core/AnglingSounds.java @@ -1,10 +1,11 @@ package com.eightsidedsquare.angling.core; import com.google.common.collect.Lists; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.SoundEvent; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; import java.util.List; @@ -64,11 +65,11 @@ public class AnglingSounds { public static final BlockSoundGroup SHELL_SOUND_GROUP = new BlockSoundGroup(1, 1.25f, BLOCK_SHELL_BREAK, BLOCK_SHELL_STEP, BLOCK_SHELL_PLACE, BLOCK_SHELL_HIT, BLOCK_SHELL_FALL); public static void init() { - SOUNDS.forEach(sound -> Registry.register(Registry.SOUND_EVENT, sound.getId(), sound)); + SOUNDS.forEach(sound -> Registry.register(Registries.SOUND_EVENT, sound.getId(), sound)); } private static SoundEvent create(String id) { - SoundEvent soundEvent = new SoundEvent(new Identifier(MOD_ID, id)); + SoundEvent soundEvent = SoundEvent.of(new Identifier(MOD_ID, id)); SOUNDS.add(soundEvent); return soundEvent; } diff --git a/src/main/java/com/eightsidedsquare/angling/core/AnglingUtil.java b/src/main/java/com/eightsidedsquare/angling/core/AnglingUtil.java index 1936335..9e49eec 100644 --- a/src/main/java/com/eightsidedsquare/angling/core/AnglingUtil.java +++ b/src/main/java/com/eightsidedsquare/angling/core/AnglingUtil.java @@ -7,11 +7,11 @@ import net.minecraft.entity.EntityType; import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtElement; -import net.minecraft.tag.TagKey; +import net.minecraft.registry.Registries; +import net.minecraft.registry.entry.RegistryEntry; +import net.minecraft.registry.tag.TagKey; import net.minecraft.util.Util; import net.minecraft.util.math.random.Random; -import net.minecraft.util.registry.Registry; -import net.minecraft.util.registry.RegistryEntry; import net.minecraft.world.World; import java.util.List; @@ -30,7 +30,7 @@ public static T getRandomTagValue(World world, TagKey tagKey, Random rand public static NbtCompound entityToNbt(Entity entity, boolean stripData) { NbtCompound nbt = entity.writeNbt(new NbtCompound()); - nbt.putString("id", Registry.ENTITY_TYPE.getId(entity.getType()).toString()); + nbt.putString("id", Registries.ENTITY_TYPE.getId(entity.getType()).toString()); if(stripData){ stripEntityNbt(nbt); } diff --git a/src/main/java/com/eightsidedsquare/angling/core/ai/AnglingMemoryModuleTypes.java b/src/main/java/com/eightsidedsquare/angling/core/ai/AnglingMemoryModuleTypes.java index 450041e..56667ba 100644 --- a/src/main/java/com/eightsidedsquare/angling/core/ai/AnglingMemoryModuleTypes.java +++ b/src/main/java/com/eightsidedsquare/angling/core/ai/AnglingMemoryModuleTypes.java @@ -2,9 +2,10 @@ import com.mojang.serialization.Codec; import net.minecraft.entity.ai.brain.MemoryModuleType; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; import net.minecraft.util.Identifier; import net.minecraft.util.Unit; -import net.minecraft.util.registry.Registry; import java.util.Optional; @@ -17,6 +18,6 @@ public class AnglingMemoryModuleTypes { public static final MemoryModuleType HAS_TRADED = register("has_traded", Codec.unit(Unit.INSTANCE)); private static MemoryModuleType register(String id, Codec codec) { - return Registry.register(Registry.MEMORY_MODULE_TYPE, new Identifier(MOD_ID, id), new MemoryModuleType<>(Optional.of(codec))); + return Registry.register(Registries.MEMORY_MODULE_TYPE, new Identifier(MOD_ID, id), new MemoryModuleType<>(Optional.of(codec))); } } diff --git a/src/main/java/com/eightsidedsquare/angling/core/ai/AnglingSensorTypes.java b/src/main/java/com/eightsidedsquare/angling/core/ai/AnglingSensorTypes.java index c194295..89a3b60 100644 --- a/src/main/java/com/eightsidedsquare/angling/core/ai/AnglingSensorTypes.java +++ b/src/main/java/com/eightsidedsquare/angling/core/ai/AnglingSensorTypes.java @@ -3,8 +3,9 @@ import com.eightsidedsquare.angling.common.entity.ai.PelicanAttackablesSensor; import net.minecraft.entity.ai.brain.sensor.Sensor; import net.minecraft.entity.ai.brain.sensor.SensorType; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; import java.util.function.Supplier; @@ -15,6 +16,6 @@ public class AnglingSensorTypes { public static final SensorType PELICAN_ATTACKABLES = register("pelican_attackables", PelicanAttackablesSensor::new); private static > SensorType register(String id, Supplier factory) { - return Registry.register(Registry.SENSOR_TYPE, new Identifier(MOD_ID, id), new SensorType<>(factory)); + return Registry.register(Registries.SENSOR_TYPE, new Identifier(MOD_ID, id), new SensorType<>(factory)); } } diff --git a/src/main/java/com/eightsidedsquare/angling/core/tags/AnglingBiomeTags.java b/src/main/java/com/eightsidedsquare/angling/core/tags/AnglingBiomeTags.java index 30bcb40..9ec0c93 100644 --- a/src/main/java/com/eightsidedsquare/angling/core/tags/AnglingBiomeTags.java +++ b/src/main/java/com/eightsidedsquare/angling/core/tags/AnglingBiomeTags.java @@ -1,34 +1,32 @@ package com.eightsidedsquare.angling.core.tags; -import net.minecraft.tag.TagKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.tag.TagKey; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; import net.minecraft.world.biome.Biome; -import static com.eightsidedsquare.angling.core.AnglingMod.MOD_ID; - public class AnglingBiomeTags { - public static final TagKey SUNFISH_SPAWN_IN = create("sunfish_spawn_in"); - public static final TagKey NAUTILUS_SPAWN_IN = create("nautilus_spawn_in"); - public static final TagKey SEA_SLUG_SPAWN_IN = create("sea_slug_spawn_in"); - public static final TagKey CATFISH_SPAWN_IN = create("catfish_spawn_in"); - public static final TagKey SEAHORSE_SPAWN_IN = create("seahorse_spawn_in"); - public static final TagKey BUBBLE_EYE_SPAWN_IN = create("bubble_eye_spawn_in"); - public static final TagKey ANOMALOCARIS_SPAWN_IN = create("anomalocaris_spawn_in"); - public static final TagKey ANGLERFISH_SPAWN_IN = create("anglerfish_spawn_in"); - public static final TagKey MAHI_MAHI_SPAWN_IN = create("mahi_mahi_spawn_in"); - public static final TagKey CRAB_SPAWN_IN = create("crab_spawn_in"); - public static final TagKey DUNGENESS_CRAB_BIOMES = create("dungeness_crab_biomes"); - public static final TagKey GHOST_CRAB_BIOMES = create("ghost_crab_biomes"); - public static final TagKey BLUE_CLAW_CRAB_BIOMES = create("blue_claw_crab_biomes"); - public static final TagKey OYSTER_REEF_BIOMES = create("oyster_reef_biomes"); - public static final TagKey CLAMS_BIOMES = create("clams_biomes"); - public static final TagKey DUCKWEED_BIOMES = create("duckweed_biomes"); - public static final TagKey SARGASSUM_BIOMES = create("sargassum_biomes"); - public static final TagKey PAPYRUS_BIOMES = create("papyrus_biomes"); + public static final TagKey SUNFISH_SPAWN_IN = of("sunfish_spawn_in"); + public static final TagKey NAUTILUS_SPAWN_IN = of("nautilus_spawn_in"); + public static final TagKey SEA_SLUG_SPAWN_IN = of("sea_slug_spawn_in"); + public static final TagKey CATFISH_SPAWN_IN = of("catfish_spawn_in"); + public static final TagKey SEAHORSE_SPAWN_IN = of("seahorse_spawn_in"); + public static final TagKey BUBBLE_EYE_SPAWN_IN = of("bubble_eye_spawn_in"); + public static final TagKey ANOMALOCARIS_SPAWN_IN = of("anomalocaris_spawn_in"); + public static final TagKey ANGLERFISH_SPAWN_IN = of("anglerfish_spawn_in"); + public static final TagKey MAHI_MAHI_SPAWN_IN = of("mahi_mahi_spawn_in"); + public static final TagKey CRAB_SPAWN_IN = of("crab_spawn_in"); + public static final TagKey DUNGENESS_CRAB_BIOMES = of("dungeness_crab_biomes"); + public static final TagKey GHOST_CRAB_BIOMES = of("ghost_crab_biomes"); + public static final TagKey BLUE_CLAW_CRAB_BIOMES = of("blue_claw_crab_biomes"); + public static final TagKey OYSTER_REEF_BIOMES = of("oyster_reef_biomes"); + public static final TagKey CLAMS_BIOMES = of("clams_biomes"); + public static final TagKey DUCKWEED_BIOMES = of("duckweed_biomes"); + public static final TagKey SARGASSUM_BIOMES = of("sargassum_biomes"); + public static final TagKey PAPYRUS_BIOMES = of("papyrus_biomes"); - private static TagKey create(String id) { - return TagKey.of(Registry.BIOME_KEY, new Identifier(MOD_ID, id)); + private static TagKey of(String id) { + return TagKey.of(RegistryKeys.BIOME, new Identifier(id)); } } diff --git a/src/main/java/com/eightsidedsquare/angling/core/tags/AnglingBlockTags.java b/src/main/java/com/eightsidedsquare/angling/core/tags/AnglingBlockTags.java index 0c976c8..1e2c861 100644 --- a/src/main/java/com/eightsidedsquare/angling/core/tags/AnglingBlockTags.java +++ b/src/main/java/com/eightsidedsquare/angling/core/tags/AnglingBlockTags.java @@ -1,20 +1,20 @@ package com.eightsidedsquare.angling.core.tags; import net.minecraft.block.Block; -import net.minecraft.tag.TagKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.tag.TagKey; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; import static com.eightsidedsquare.angling.core.AnglingMod.MOD_ID; public class AnglingBlockTags { - public static final TagKey FILTER_FEEDERS = create("filter_feeders"); - public static final TagKey STARFISH_FOOD = create("starfish_food"); - public static final TagKey CRAB_SPAWNABLE_ON = create("crab_spawnable_on"); + public static final TagKey FILTER_FEEDERS = of("filter_feeders"); + public static final TagKey STARFISH_FOOD = of("starfish_food"); + public static final TagKey CRAB_SPAWNABLE_ON = of("crab_spawnable_on"); - private static TagKey create(String id) { - return TagKey.of(Registry.BLOCK_KEY, new Identifier(MOD_ID, id)); + private static TagKey of(String id) { + return TagKey.of(RegistryKeys.BLOCK, new Identifier(MOD_ID, id)); } } diff --git a/src/main/java/com/eightsidedsquare/angling/core/tags/AnglingEntityTypeTags.java b/src/main/java/com/eightsidedsquare/angling/core/tags/AnglingEntityTypeTags.java index cac441e..8f7ddbf 100644 --- a/src/main/java/com/eightsidedsquare/angling/core/tags/AnglingEntityTypeTags.java +++ b/src/main/java/com/eightsidedsquare/angling/core/tags/AnglingEntityTypeTags.java @@ -1,21 +1,21 @@ package com.eightsidedsquare.angling.core.tags; import net.minecraft.entity.EntityType; -import net.minecraft.tag.TagKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.tag.TagKey; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; import static com.eightsidedsquare.angling.core.AnglingMod.MOD_ID; public class AnglingEntityTypeTags { - public static final TagKey> SPAWNING_FISH = create("spawning_fish"); - public static final TagKey> COMMON_ENTITIES_IN_PELICAN_BEAK = create("common_entities_in_pelican_beak"); - public static final TagKey> UNCOMMON_ENTITIES_IN_PELICAN_BEAK = create("uncommon_entities_in_pelican_beak"); - public static final TagKey> HUNTED_BY_PELICAN = create("hunted_by_pelican"); - public static final TagKey> HUNTED_BY_PELICAN_WHEN_BABY = create("hunted_by_pelican_when_baby"); + public static final TagKey> SPAWNING_FISH = of("spawning_fish"); + public static final TagKey> COMMON_ENTITIES_IN_PELICAN_BEAK = of("common_entities_in_pelican_beak"); + public static final TagKey> UNCOMMON_ENTITIES_IN_PELICAN_BEAK = of("uncommon_entities_in_pelican_beak"); + public static final TagKey> HUNTED_BY_PELICAN = of("hunted_by_pelican"); + public static final TagKey> HUNTED_BY_PELICAN_WHEN_BABY = of("hunted_by_pelican_when_baby"); - private static TagKey> create(String id) { - return TagKey.of(Registry.ENTITY_TYPE_KEY, new Identifier(MOD_ID, id)); + private static TagKey> of(String id) { + return TagKey.of(RegistryKeys.ENTITY_TYPE, new Identifier(MOD_ID, id)); } } diff --git a/src/main/java/com/eightsidedsquare/angling/core/world/AnglingConfiguredFeatures.java b/src/main/java/com/eightsidedsquare/angling/core/world/AnglingConfiguredFeatures.java index 43716d3..ee697e5 100644 --- a/src/main/java/com/eightsidedsquare/angling/core/world/AnglingConfiguredFeatures.java +++ b/src/main/java/com/eightsidedsquare/angling/core/world/AnglingConfiguredFeatures.java @@ -3,19 +3,30 @@ import com.eightsidedsquare.angling.common.feature.NoisePatchFeatureConfig; import com.eightsidedsquare.angling.core.AnglingBlocks; import net.minecraft.block.BlockState; +import net.minecraft.registry.Registerable; +import net.minecraft.registry.RegistryKey; import net.minecraft.state.property.Properties; import net.minecraft.util.collection.DataPool; import net.minecraft.util.math.Direction; import net.minecraft.util.math.intprovider.UniformIntProvider; -import net.minecraft.util.registry.RegistryEntry; -import net.minecraft.world.gen.feature.*; +import net.minecraft.world.gen.feature.ConfiguredFeature; +import net.minecraft.world.gen.feature.ConfiguredFeatures; +import net.minecraft.world.gen.feature.DefaultFeatureConfig; +import net.minecraft.world.gen.feature.Feature; +import net.minecraft.world.gen.feature.PlacedFeatures; +import net.minecraft.world.gen.feature.RandomPatchFeatureConfig; +import net.minecraft.world.gen.feature.SimpleBlockFeatureConfig; import net.minecraft.world.gen.stateprovider.BlockStateProvider; import net.minecraft.world.gen.stateprovider.WeightedBlockStateProvider; -import static com.eightsidedsquare.angling.core.AnglingMod.MOD_ID; - -public class AnglingConfiguredFeatures { +public class AnglingConfiguredFeatures { + public static final RegistryKey> PATCH_DUCKWEED = ConfiguredFeatures.of("patch_duckweed"); + public static final RegistryKey> PATCH_SARGASSUM = ConfiguredFeatures.of("patch_sargassum"); + public static final RegistryKey> OYSTER_REEF = ConfiguredFeatures.of("oyster_reef"); + public static final RegistryKey> CLAMS = ConfiguredFeatures.of("clams"); + public static final RegistryKey> WORMY_BLOCK = ConfiguredFeatures.of("wormy_block"); + public static final RegistryKey> PATCH_PAPYRUS = ConfiguredFeatures.of("patch_papyrus"); private static final WeightedBlockStateProvider PAPYRUS_BLOCK_STATE_PROVIDER = new WeightedBlockStateProvider( DataPool.builder() .add(AnglingBlocks.PAPYRUS.getDefaultState().with(Properties.AGE_2, 0), 1) @@ -23,50 +34,22 @@ public class AnglingConfiguredFeatures { .add(AnglingBlocks.PAPYRUS.getDefaultState().with(Properties.AGE_2, 2), 3).build() ); - public static final RegistryEntry> OYSTER_REEF = - register("oyster_reef", AnglingFeatures.WATERLOGGABLE_PATCH, - new SimpleBlockFeatureConfig(BlockStateProvider.of(AnglingBlocks.OYSTERS))); - - public static final RegistryEntry> CLAMS = - register("clams", AnglingFeatures.WATERLOGGABLE_PATCH, - new SimpleBlockFeatureConfig( - new WeightedBlockStateProvider(DataPool.builder() - .add(AnglingBlocks.CLAM.getDefaultState().with(Properties.HORIZONTAL_FACING, Direction.NORTH), 1) - .add(AnglingBlocks.CLAM.getDefaultState().with(Properties.HORIZONTAL_FACING, Direction.EAST), 1) - .add(AnglingBlocks.CLAM.getDefaultState().with(Properties.HORIZONTAL_FACING, Direction.SOUTH), 1) - .add(AnglingBlocks.CLAM.getDefaultState().with(Properties.HORIZONTAL_FACING, Direction.WEST), 1) - .build()))); - - public static final RegistryEntry> WORMY_BLOCK = - register("wormy_block", AnglingFeatures.WORMY_BLOCK, new DefaultFeatureConfig()); - - public static final RegistryEntry> PATCH_SARGASSUM = - register("patch_sargassum", AnglingFeatures.NOISE_PATCH, new NoisePatchFeatureConfig( - BlockStateProvider.of(AnglingBlocks.SARGASSUM), - -3, - 2d, - 0.25d, - UniformIntProvider.create(8, 16) - )); - - public static final RegistryEntry> PATCH_DUCKWEED = - register("patch_duckweed", AnglingFeatures.NOISE_PATCH, new NoisePatchFeatureConfig( - BlockStateProvider.of(AnglingBlocks.DUCKWEED), - -2, - 2d, - 0.35d, - UniformIntProvider.create(6, 12) - )); - - public static final RegistryEntry> PATCH_PAPYRUS = - register("patch_papyrus", AnglingFeatures.WATER_ADJACENT_PATCH, new RandomPatchFeatureConfig( - 64, - 6, - 2, - PlacedFeatures.createEntry(Feature.SIMPLE_BLOCK, new SimpleBlockFeatureConfig(PAPYRUS_BLOCK_STATE_PROVIDER)) - )); - - public static > RegistryEntry> register(String id, F feature, FC config) { - return ConfiguredFeatures.register(MOD_ID + ":" + id, feature, config); + public static void bootstrap(Registerable> featureRegisterable) { + ConfiguredFeatures.register(featureRegisterable, PATCH_DUCKWEED, AnglingFeatures.NOISE_PATCH, new NoisePatchFeatureConfig(BlockStateProvider.of(AnglingBlocks.SARGASSUM), -3, 2d, 0.25d, UniformIntProvider.create(8, 16))); + ConfiguredFeatures.register(featureRegisterable, PATCH_SARGASSUM, AnglingFeatures.NOISE_PATCH, new NoisePatchFeatureConfig(BlockStateProvider.of(AnglingBlocks.SARGASSUM), -3, 2d, 0.25d, UniformIntProvider.create(8, 16))); + ConfiguredFeatures.register(featureRegisterable, OYSTER_REEF, AnglingFeatures.WATERLOGGABLE_PATCH, new SimpleBlockFeatureConfig(BlockStateProvider.of(AnglingBlocks.OYSTERS))); + ConfiguredFeatures.register(featureRegisterable, CLAMS, AnglingFeatures.WATERLOGGABLE_PATCH, new SimpleBlockFeatureConfig(new WeightedBlockStateProvider(DataPool.builder() + .add(AnglingBlocks.CLAM.getDefaultState().with(Properties.HORIZONTAL_FACING, Direction.NORTH), 1) + .add(AnglingBlocks.CLAM.getDefaultState().with(Properties.HORIZONTAL_FACING, Direction.EAST), 1) + .add(AnglingBlocks.CLAM.getDefaultState().with(Properties.HORIZONTAL_FACING, Direction.SOUTH), 1) + .add(AnglingBlocks.CLAM.getDefaultState().with(Properties.HORIZONTAL_FACING, Direction.WEST), 1) + .build()))); + ConfiguredFeatures.register(featureRegisterable, WORMY_BLOCK, AnglingFeatures.WORMY_BLOCK, new DefaultFeatureConfig()); + ConfiguredFeatures.register(featureRegisterable, PATCH_PAPYRUS, AnglingFeatures.WATER_ADJACENT_PATCH, new RandomPatchFeatureConfig( + 64, + 6, + 2, + PlacedFeatures.createEntry(Feature.SIMPLE_BLOCK, new SimpleBlockFeatureConfig(PAPYRUS_BLOCK_STATE_PROVIDER)) + )); } } diff --git a/src/main/java/com/eightsidedsquare/angling/core/world/AnglingFeatures.java b/src/main/java/com/eightsidedsquare/angling/core/world/AnglingFeatures.java index db22da7..174c938 100644 --- a/src/main/java/com/eightsidedsquare/angling/core/world/AnglingFeatures.java +++ b/src/main/java/com/eightsidedsquare/angling/core/world/AnglingFeatures.java @@ -1,8 +1,9 @@ package com.eightsidedsquare.angling.core.world; import com.eightsidedsquare.angling.common.feature.*; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; import net.minecraft.world.gen.feature.*; import static com.eightsidedsquare.angling.core.AnglingMod.MOD_ID; @@ -15,6 +16,6 @@ public class AnglingFeatures { public static final Feature WATER_ADJACENT_PATCH = register("water_adjacent_patch", new WaterAdjacentPatchFeature(RandomPatchFeatureConfig.CODEC)); private static > F register(String name, F feature) { - return Registry.register(Registry.FEATURE, new Identifier(MOD_ID, name), feature); + return Registry.register(Registries.FEATURE, new Identifier(MOD_ID, name), feature); } } diff --git a/src/main/java/com/eightsidedsquare/angling/core/world/AnglingPlacedFeatures.java b/src/main/java/com/eightsidedsquare/angling/core/world/AnglingPlacedFeatures.java index 6a0153d..bca7c0d 100644 --- a/src/main/java/com/eightsidedsquare/angling/core/world/AnglingPlacedFeatures.java +++ b/src/main/java/com/eightsidedsquare/angling/core/world/AnglingPlacedFeatures.java @@ -1,79 +1,74 @@ package com.eightsidedsquare.angling.core.world; -import com.eightsidedsquare.angling.core.tags.AnglingBiomeTags; -import net.fabricmc.fabric.api.biome.v1.BiomeModifications; -import net.minecraft.tag.BiomeTags; -import net.minecraft.tag.TagKey; -import net.minecraft.util.registry.RegistryEntry; -import net.minecraft.world.biome.Biome; -import net.minecraft.world.gen.GenerationStep; +import net.minecraft.registry.Registerable; +import net.minecraft.registry.RegistryEntryLookup; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.world.gen.feature.ConfiguredFeature; import net.minecraft.world.gen.feature.PlacedFeature; import net.minecraft.world.gen.feature.PlacedFeatures; -import net.minecraft.world.gen.placementmodifier.*; - -import java.util.List; - -import static com.eightsidedsquare.angling.core.AnglingMod.MOD_ID; +import net.minecraft.world.gen.placementmodifier.BiomePlacementModifier; +import net.minecraft.world.gen.placementmodifier.RarityFilterPlacementModifier; +import net.minecraft.world.gen.placementmodifier.SquarePlacementModifier; public class AnglingPlacedFeatures { - public static final RegistryEntry PATCH_DUCKWEED = register("patch_duckweed", - AnglingConfiguredFeatures.PATCH_DUCKWEED, - List.of(RarityFilterPlacementModifier.of(3), - SquarePlacementModifier.of(), - PlacedFeatures.WORLD_SURFACE_WG_HEIGHTMAP, - BiomePlacementModifier.of())); + public static final RegistryKey PATCH_DUCKWEED = PlacedFeatures.of("patch_duckweed"); + public static final RegistryKey PATCH_SARGASSUM = PlacedFeatures.of("patch_sargassum"); + public static final RegistryKey OYSTER_REEF = PlacedFeatures.of("oyster_reef"); + public static final RegistryKey CLAMS = PlacedFeatures.of("clams"); + public static final RegistryKey WORMY_BLOCK = PlacedFeatures.of("wormy_block"); + public static final RegistryKey PATCH_PAPYRUS = PlacedFeatures.of("patch_papyrus"); - public static final RegistryEntry PATCH_SARGASSUM = register("patch_sargassum", - AnglingConfiguredFeatures.PATCH_SARGASSUM, - List.of(RarityFilterPlacementModifier.of(70), - SquarePlacementModifier.of(), - PlacedFeatures.WORLD_SURFACE_WG_HEIGHTMAP, - BiomePlacementModifier.of())); + public static void bootstrap(Registerable featureRegisterable) { + RegistryEntryLookup> registryEntryLookup = featureRegisterable.getRegistryLookup(RegistryKeys.CONFIGURED_FEATURE); + RegistryEntry.Reference> patchDuckweedEntry = registryEntryLookup.getOrThrow(AnglingConfiguredFeatures.PATCH_DUCKWEED); + RegistryEntry.Reference> patchSargassumEntry = registryEntryLookup.getOrThrow(AnglingConfiguredFeatures.PATCH_SARGASSUM); + RegistryEntry.Reference> oysterReefEntry = registryEntryLookup.getOrThrow(AnglingConfiguredFeatures.OYSTER_REEF); + RegistryEntry.Reference> clamsEntry = registryEntryLookup.getOrThrow(AnglingConfiguredFeatures.CLAMS); + RegistryEntry.Reference> wormyBlockEntry = registryEntryLookup.getOrThrow(AnglingConfiguredFeatures.WORMY_BLOCK); + RegistryEntry.Reference> patchPapyrusEntry = registryEntryLookup.getOrThrow(AnglingConfiguredFeatures.PATCH_PAPYRUS); - public static final RegistryEntry OYSTER_REEF = register("oyster_reef", - AnglingConfiguredFeatures.OYSTER_REEF, - List.of(RarityFilterPlacementModifier.of(14), - SquarePlacementModifier.of(), - PlacedFeatures.OCEAN_FLOOR_HEIGHTMAP, - BiomePlacementModifier.of())); + PlacedFeatures.register(featureRegisterable, PATCH_DUCKWEED, patchDuckweedEntry, + RarityFilterPlacementModifier.of(3), + SquarePlacementModifier.of(), + PlacedFeatures.WORLD_SURFACE_WG_HEIGHTMAP, + BiomePlacementModifier.of() + ); - public static final RegistryEntry CLAMS = register("clams", - AnglingConfiguredFeatures.CLAMS, - List.of(RarityFilterPlacementModifier.of(12), - SquarePlacementModifier.of(), - PlacedFeatures.OCEAN_FLOOR_HEIGHTMAP, - BiomePlacementModifier.of())); + PlacedFeatures.register(featureRegisterable, PATCH_SARGASSUM, patchSargassumEntry, + RarityFilterPlacementModifier.of(70), + SquarePlacementModifier.of(), + PlacedFeatures.WORLD_SURFACE_WG_HEIGHTMAP, + BiomePlacementModifier.of() + ); - public static final RegistryEntry WORMY_BLOCK = register("wormy_block", - AnglingConfiguredFeatures.WORMY_BLOCK, - List.of(CountPlacementModifier.of(2), - SquarePlacementModifier.of(), - PlacedFeatures.OCEAN_FLOOR_HEIGHTMAP, - BiomePlacementModifier.of())); + PlacedFeatures.register(featureRegisterable, OYSTER_REEF, oysterReefEntry, + RarityFilterPlacementModifier.of(14), + SquarePlacementModifier.of(), + PlacedFeatures.WORLD_SURFACE_WG_HEIGHTMAP, + BiomePlacementModifier.of() + ); - public static final RegistryEntry PATCH_PAPYRUS = register("patch_papyrus", - AnglingConfiguredFeatures.PATCH_PAPYRUS, - List.of(CountPlacementModifier.of(2), - SquarePlacementModifier.of(), - PlacedFeatures.OCEAN_FLOOR_HEIGHTMAP, - BiomePlacementModifier.of())); + PlacedFeatures.register(featureRegisterable, CLAMS, clamsEntry, + RarityFilterPlacementModifier.of(12), + SquarePlacementModifier.of(), + PlacedFeatures.WORLD_SURFACE_WG_HEIGHTMAP, + BiomePlacementModifier.of() + ); - public static RegistryEntry register(String id, RegistryEntry> registryEntry, List modifiers) { - return PlacedFeatures.register(MOD_ID + ":" + id, registryEntry, modifiers); - } - - private static void addFeature(RegistryEntry featureEntry, GenerationStep.Feature step, TagKey tag) { - featureEntry.getKey().ifPresent(key -> - BiomeModifications.addFeature(ctx -> ctx.getBiomeRegistryEntry().isIn(tag), step, key)); - } + PlacedFeatures.register(featureRegisterable, WORMY_BLOCK, wormyBlockEntry, + RarityFilterPlacementModifier.of(2), + SquarePlacementModifier.of(), + PlacedFeatures.WORLD_SURFACE_WG_HEIGHTMAP, + BiomePlacementModifier.of() + ); - public static void init() { - addFeature(OYSTER_REEF, GenerationStep.Feature.VEGETAL_DECORATION, AnglingBiomeTags.OYSTER_REEF_BIOMES); - addFeature(CLAMS, GenerationStep.Feature.VEGETAL_DECORATION, AnglingBiomeTags.CLAMS_BIOMES); - addFeature(PATCH_DUCKWEED, GenerationStep.Feature.VEGETAL_DECORATION, AnglingBiomeTags.DUCKWEED_BIOMES); - addFeature(PATCH_SARGASSUM, GenerationStep.Feature.VEGETAL_DECORATION, AnglingBiomeTags.SARGASSUM_BIOMES); - addFeature(PATCH_PAPYRUS, GenerationStep.Feature.VEGETAL_DECORATION, AnglingBiomeTags.PAPYRUS_BIOMES); - addFeature(WORMY_BLOCK, GenerationStep.Feature.UNDERGROUND_ORES, BiomeTags.IS_OVERWORLD); + PlacedFeatures.register(featureRegisterable, PATCH_PAPYRUS, patchPapyrusEntry, + RarityFilterPlacementModifier.of(2), + SquarePlacementModifier.of(), + PlacedFeatures.WORLD_SURFACE_WG_HEIGHTMAP, + BiomePlacementModifier.of() + ); } } diff --git a/src/main/java/com/eightsidedsquare/angling/mixin/CoralFeatureMixin.java b/src/main/java/com/eightsidedsquare/angling/mixin/CoralFeatureMixin.java index 3460736..b266b3a 100644 --- a/src/main/java/com/eightsidedsquare/angling/mixin/CoralFeatureMixin.java +++ b/src/main/java/com/eightsidedsquare/angling/mixin/CoralFeatureMixin.java @@ -6,8 +6,8 @@ import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.FacingBlock; +import net.minecraft.registry.tag.BlockTags; import net.minecraft.state.property.Properties; -import net.minecraft.tag.BlockTags; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.util.math.random.Random; diff --git a/src/main/java/com/eightsidedsquare/angling/mixin/FluidRendererMixin.java b/src/main/java/com/eightsidedsquare/angling/mixin/FluidRendererMixin.java index ed96bb6..c0f94a3 100644 --- a/src/main/java/com/eightsidedsquare/angling/mixin/FluidRendererMixin.java +++ b/src/main/java/com/eightsidedsquare/angling/mixin/FluidRendererMixin.java @@ -5,7 +5,7 @@ import net.minecraft.block.BlockState; import net.minecraft.client.render.block.FluidRenderer; import net.minecraft.fluid.FluidState; -import net.minecraft.tag.FluidTags; +import net.minecraft.registry.tag.FluidTags; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.BlockRenderView; diff --git a/src/main/java/com/eightsidedsquare/angling/mixin/integration/SodiumFluidRendererMixin.java b/src/main/java/com/eightsidedsquare/angling/mixin/integration/SodiumFluidRendererMixin.java index d852dcc..6d08954 100644 --- a/src/main/java/com/eightsidedsquare/angling/mixin/integration/SodiumFluidRendererMixin.java +++ b/src/main/java/com/eightsidedsquare/angling/mixin/integration/SodiumFluidRendererMixin.java @@ -1,11 +1,11 @@ package com.eightsidedsquare.angling.mixin.integration; import com.eightsidedsquare.angling.core.AnglingMod; -import me.jellysquid.mods.sodium.client.render.pipeline.FluidRenderer; +import me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.FluidRenderer; import net.fabricmc.fabric.api.tag.convention.v1.ConventionalBlockTags; import net.minecraft.block.BlockState; import net.minecraft.fluid.Fluid; -import net.minecraft.tag.FluidTags; +import net.minecraft.registry.tag.FluidTags; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.BlockRenderView; @@ -19,14 +19,16 @@ @Mixin(value = FluidRenderer.class, remap = false) public abstract class SodiumFluidRendererMixin { - @Shadow @Final private BlockPos.Mutable scratchPos; + @Shadow + @Final + private BlockPos.Mutable scratchPos; @Inject(method = "isFluidOccluded", at = @At("RETURN"), cancellable = true) private void isFluidOccluded(BlockRenderView world, int x, int y, int z, Direction dir, Fluid fluid, CallbackInfoReturnable cir) { - if(AnglingMod.CONFIG.hideWaterBehindGlass && !cir.getReturnValue()) { + if (AnglingMod.CONFIG.hideWaterBehindGlass && !cir.getReturnValue()) { BlockState state = world.getBlockState(new BlockPos(scratchPos).offset(dir.getOpposite())); BlockState sideState = world.getBlockState(scratchPos); - if(state.getFluidState().isIn(FluidTags.WATER) && sideState.isIn(ConventionalBlockTags.GLASS_BLOCKS)) { + if (state.getFluidState().isIn(FluidTags.WATER) && sideState.isIn(ConventionalBlockTags.GLASS_BLOCKS)) { cir.setReturnValue(true); } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 510ea1a..3d95a37 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -8,7 +8,8 @@ "authors": [ "EightSidedSquare", "Diansu", - "Sillvia" + "Sillvia", + "byquanton" ], "contact": { "homepage": "https://eightsidedsquare.com/" @@ -33,6 +34,9 @@ ], "modmenu": [ "com.eightsidedsquare.angling.config.ModMenuIntegration" + ], + "fabric-datagen": [ + "com.eightsidedsquare.angling.core.AnglingDataGenerator" ] }, "mixins": [ @@ -43,7 +47,7 @@ "depends": { "fabricloader": ">=0.14.6", "fabric": "*", - "minecraft": "~1.19", + "minecraft": "1.19.4", "java": ">=17", "cloth-config2": ">=8.0.0" },