From d8cf166fbae4c6b40a5be443629b8bf1b0abaa5c Mon Sep 17 00:00:00 2001 From: luxtracon Date: Sun, 2 Jun 2024 02:27:38 +0200 Subject: [PATCH] 1.20.3 port --- build.gradle | 2 - gradle.properties | 18 ++++----- .../floralis/block/CactusCropBlock.java | 4 +- .../floralis/block/CactusPlantBlock.java | 9 +++++ .../luxtracon/floralis/block/DyeBlock.java | 22 +++++++++++ .../floralis/block/FlowerPlantBlock.java | 11 +++++- .../floralis/registry/FloralisBlocks.java | 37 ++++++++++--------- 7 files changed, 71 insertions(+), 32 deletions(-) create mode 100644 src/main/java/com/luxtracon/floralis/block/DyeBlock.java diff --git a/build.gradle b/build.gradle index 1ce1e00e..4ff5e9f9 100644 --- a/build.gradle +++ b/build.gradle @@ -87,8 +87,6 @@ dependencies { // For all intends and purposes: You can treat this dependency as if it is a normal library you would use. implementation "net.neoforged:neoforge:${neo_version}" - implementation "curse.maven:jade-324717:${jade_version}" - // Example mod dependency with JEI // The JEI API is declared for compile time use, while the full JEI artifact is used at runtime // compileOnly "mezz.jei:jei-${mc_version}-common-api:${jei_version}" diff --git a/gradle.properties b/gradle.properties index c7126455..aed133d2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,24 +7,22 @@ org.gradle.debug=false # Read more on this at https://github.com/neoforged/NeoGradle/blob/NG_7.0/README.md#apply-parchment-mappings # You can find the latest versions here: https://parchmentmc.org/docs/getting-started -neogradle.subsystems.parchment.minecraftVersion=1.20.2 -neogradle.subsystems.parchment.mappingsVersion=2023.12.10 +neogradle.subsystems.parchment.minecraftVersion=1.20.3 +neogradle.subsystems.parchment.mappingsVersion=2023.12.31 # The Minecraft version must agree with the Neo version to get a valid artifact -minecraft_version=1.20.2 +minecraft_version=1.20.3 # The Minecraft version range can use any release version of Minecraft as bounds. # Snapshots, pre-releases, and release candidates are not guaranteed to sort properly # as they do not follow standard versioning conventions. -minecraft_version_range=[1.20.2,1.21) +minecraft_version_range=[1.20.3,1.21) # The Neo version must agree with the Minecraft version to get a valid artifact -neo_version=20.2.88 +neo_version=20.3.8-beta # The Neo version range can use any version of Neo as bounds or match the loader version range -neo_version_range=[20.2,) +neo_version_range=[20.3,) # The loader version range can only use the major version of Neo/FML as bounds loader_version_range=[1,) -jade_version=4979237 - ## Mod Properties # The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63} @@ -35,7 +33,7 @@ mod_name=Floralis # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. mod_license=MIT License # The mod version. See https://semver.org/ -mod_version=11.0.0 +mod_version=12.0.0 # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # This should match the base package used for the mod sources. # See https://maven.apache.org/guides/mini/guide-naming-conventions.html @@ -45,4 +43,4 @@ mod_authors=luxtracon # The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list. mod_description=Floralis adds farmable cacti and flowers for an automatable way to obtain all dyes. # Pack version - this changes each minecraft release, in general. -pack_format_number=18 +pack_format_number=22 diff --git a/src/main/java/com/luxtracon/floralis/block/CactusCropBlock.java b/src/main/java/com/luxtracon/floralis/block/CactusCropBlock.java index 18f6df3b..b5e32a62 100644 --- a/src/main/java/com/luxtracon/floralis/block/CactusCropBlock.java +++ b/src/main/java/com/luxtracon/floralis/block/CactusCropBlock.java @@ -5,6 +5,7 @@ import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.tags.BlockTags; import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Mob; @@ -14,7 +15,6 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.CropBlock; -import net.minecraft.world.level.block.SandBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.IntegerProperty; @@ -49,7 +49,7 @@ public boolean canSurvive(BlockState pState, LevelReader pLevel, BlockPos pPos) @Override public boolean mayPlaceOn(BlockState pState, BlockGetter pLevel, BlockPos pPos) { - return pState.getBlock() instanceof SandBlock; + return pState.is(BlockTags.SAND); } @Override diff --git a/src/main/java/com/luxtracon/floralis/block/CactusPlantBlock.java b/src/main/java/com/luxtracon/floralis/block/CactusPlantBlock.java index 7ac130ea..03b76415 100644 --- a/src/main/java/com/luxtracon/floralis/block/CactusPlantBlock.java +++ b/src/main/java/com/luxtracon/floralis/block/CactusPlantBlock.java @@ -1,5 +1,7 @@ package com.luxtracon.floralis.block; +import com.mojang.serialization.MapCodec; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -27,6 +29,8 @@ @ParametersAreNonnullByDefault public class CactusPlantBlock extends BushBlock { + public static final MapCodec CODEC = Block.simpleCodec(CactusPlantBlock::new); + public static final VoxelShape SHAPE = Block.box(4.0D, 0.0D, 4.0D, 12.0D, 8.0D, 12.0D); public CactusPlantBlock(Properties pProperties) { @@ -72,6 +76,11 @@ public BlockState updateShape(BlockState pState, Direction pFacing, BlockState p return !pState.canSurvive(pLevel, pCurrentPos) ? Blocks.AIR.defaultBlockState() : super.updateShape(pState, pFacing, pFacingState, pLevel, pCurrentPos, pFacingPos); } + @Override + public MapCodec codec() { + return CactusPlantBlock.CODEC; + } + @Override public VoxelShape getCollisionShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) { var vec3 = pState.getOffset(pLevel, pPos); diff --git a/src/main/java/com/luxtracon/floralis/block/DyeBlock.java b/src/main/java/com/luxtracon/floralis/block/DyeBlock.java new file mode 100644 index 00000000..b2f76582 --- /dev/null +++ b/src/main/java/com/luxtracon/floralis/block/DyeBlock.java @@ -0,0 +1,22 @@ +package com.luxtracon.floralis.block; + +import com.mojang.serialization.MapCodec; + +import net.minecraft.MethodsReturnNonnullByDefault; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.FallingBlock; + +@MethodsReturnNonnullByDefault + +public class DyeBlock extends FallingBlock { + public static final MapCodec CODEC = Block.simpleCodec(DyeBlock::new); + + public DyeBlock(Properties pProperties) { + super(pProperties); + } + + @Override + protected MapCodec codec() { + return DyeBlock.CODEC; + } +} diff --git a/src/main/java/com/luxtracon/floralis/block/FlowerPlantBlock.java b/src/main/java/com/luxtracon/floralis/block/FlowerPlantBlock.java index 17d7b5ed..6cd2c9aa 100644 --- a/src/main/java/com/luxtracon/floralis/block/FlowerPlantBlock.java +++ b/src/main/java/com/luxtracon/floralis/block/FlowerPlantBlock.java @@ -1,5 +1,7 @@ package com.luxtracon.floralis.block; +import com.mojang.serialization.MapCodec; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -21,6 +23,8 @@ @ParametersAreNonnullByDefault public class FlowerPlantBlock extends BushBlock { + public static final MapCodec CODEC = Block.simpleCodec(FlowerPlantBlock::new); + public static final VoxelShape SHAPE = Block.box(5.25D, 0.0D, 5.25D, 10.75D, 12.0D, 10.75D); public FlowerPlantBlock(Properties pProperties) { @@ -52,9 +56,14 @@ public BlockState updateShape(BlockState pState, Direction pFacing, BlockState p return !pState.canSurvive(pLevel, pCurrentPos) ? Blocks.AIR.defaultBlockState() : super.updateShape(pState, pFacing, pFacingState, pLevel, pCurrentPos, pFacingPos); } + @Override + public MapCodec codec() { + return FlowerPlantBlock.CODEC; + } + @Override public VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) { var vec3 = pState.getOffset(pLevel, pPos); - return SHAPE.move(vec3.x, vec3.y, vec3.z); + return FlowerPlantBlock.SHAPE.move(vec3.x, vec3.y, vec3.z); } } diff --git a/src/main/java/com/luxtracon/floralis/registry/FloralisBlocks.java b/src/main/java/com/luxtracon/floralis/registry/FloralisBlocks.java index eef77e1b..84930faf 100644 --- a/src/main/java/com/luxtracon/floralis/registry/FloralisBlocks.java +++ b/src/main/java/com/luxtracon/floralis/registry/FloralisBlocks.java @@ -4,7 +4,10 @@ import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.registries.Registries; -import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.FlowerPotBlock; +import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.properties.NoteBlockInstrument; import net.minecraft.world.level.material.MapColor; @@ -20,22 +23,22 @@ public class FloralisBlocks { public static final DeferredRegister BLOCKS = DeferredRegister.create(Registries.BLOCK, FloralisConstant.ID); - public static final Supplier WHITE_DYE_BLOCK = FloralisBlocks.BLOCKS.register("white_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.SNOW))); - public static final Supplier LIGHT_GRAY_DYE_BLOCK = FloralisBlocks.BLOCKS.register("light_gray_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_LIGHT_GRAY))); - public static final Supplier GRAY_DYE_BLOCK = FloralisBlocks.BLOCKS.register("gray_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_GRAY))); - public static final Supplier BLACK_DYE_BLOCK = FloralisBlocks.BLOCKS.register("black_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_BLACK))); - public static final Supplier BROWN_DYE_BLOCK = FloralisBlocks.BLOCKS.register("brown_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_BROWN))); - public static final Supplier RED_DYE_BLOCK = FloralisBlocks.BLOCKS.register("red_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_RED))); - public static final Supplier ORANGE_DYE_BLOCK = FloralisBlocks.BLOCKS.register("orange_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_ORANGE))); - public static final Supplier YELLOW_DYE_BLOCK = FloralisBlocks.BLOCKS.register("yellow_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_YELLOW))); - public static final Supplier LIME_DYE_BLOCK = FloralisBlocks.BLOCKS.register("lime_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_LIGHT_GREEN))); - public static final Supplier GREEN_DYE_BLOCK = FloralisBlocks.BLOCKS.register("green_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_GREEN))); - public static final Supplier CYAN_DYE_BLOCK = FloralisBlocks.BLOCKS.register("cyan_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_CYAN))); - public static final Supplier LIGHT_BLUE_DYE_BLOCK = FloralisBlocks.BLOCKS.register("light_blue_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_LIGHT_BLUE))); - public static final Supplier BLUE_DYE_BLOCK = FloralisBlocks.BLOCKS.register("blue_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_BLUE))); - public static final Supplier PURPLE_DYE_BLOCK = FloralisBlocks.BLOCKS.register("purple_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_PURPLE))); - public static final Supplier MAGENTA_DYE_BLOCK = FloralisBlocks.BLOCKS.register("magenta_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_MAGENTA))); - public static final Supplier PINK_DYE_BLOCK = FloralisBlocks.BLOCKS.register("pink_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_PINK))); + public static final Supplier WHITE_DYE_BLOCK = FloralisBlocks.BLOCKS.register("white_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.SNOW))); + public static final Supplier LIGHT_GRAY_DYE_BLOCK = FloralisBlocks.BLOCKS.register("light_gray_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_LIGHT_GRAY))); + public static final Supplier GRAY_DYE_BLOCK = FloralisBlocks.BLOCKS.register("gray_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_GRAY))); + public static final Supplier BLACK_DYE_BLOCK = FloralisBlocks.BLOCKS.register("black_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_BLACK))); + public static final Supplier BROWN_DYE_BLOCK = FloralisBlocks.BLOCKS.register("brown_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_BROWN))); + public static final Supplier RED_DYE_BLOCK = FloralisBlocks.BLOCKS.register("red_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_RED))); + public static final Supplier ORANGE_DYE_BLOCK = FloralisBlocks.BLOCKS.register("orange_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_ORANGE))); + public static final Supplier YELLOW_DYE_BLOCK = FloralisBlocks.BLOCKS.register("yellow_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_YELLOW))); + public static final Supplier LIME_DYE_BLOCK = FloralisBlocks.BLOCKS.register("lime_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_LIGHT_GREEN))); + public static final Supplier GREEN_DYE_BLOCK = FloralisBlocks.BLOCKS.register("green_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_GREEN))); + public static final Supplier CYAN_DYE_BLOCK = FloralisBlocks.BLOCKS.register("cyan_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_CYAN))); + public static final Supplier LIGHT_BLUE_DYE_BLOCK = FloralisBlocks.BLOCKS.register("light_blue_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_LIGHT_BLUE))); + public static final Supplier BLUE_DYE_BLOCK = FloralisBlocks.BLOCKS.register("blue_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_BLUE))); + public static final Supplier PURPLE_DYE_BLOCK = FloralisBlocks.BLOCKS.register("purple_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_PURPLE))); + public static final Supplier MAGENTA_DYE_BLOCK = FloralisBlocks.BLOCKS.register("magenta_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_MAGENTA))); + public static final Supplier PINK_DYE_BLOCK = FloralisBlocks.BLOCKS.register("pink_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_PINK))); public static final Supplier PLANT_FIBERS_BLOCK = FloralisBlocks.BLOCKS.register("plant_fibers_block", () -> new PlantFibersBlock(FloralisBlocks.propertiesFibersBlock()));