Skip to content

Commit

Permalink
1.20.3 port
Browse files Browse the repository at this point in the history
  • Loading branch information
luxtracon committed Jun 2, 2024
1 parent a26a216 commit fb1fb82
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 32 deletions.
2 changes: 0 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
18 changes: 8 additions & 10 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -27,6 +29,8 @@
@ParametersAreNonnullByDefault

public class CactusPlantBlock extends BushBlock {
public static final MapCodec<CactusPlantBlock> 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) {
Expand Down Expand Up @@ -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<CactusPlantBlock> codec() {
return CactusPlantBlock.CODEC;
}

@Override
public VoxelShape getCollisionShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) {
var vec3 = pState.getOffset(pLevel, pPos);
Expand Down
22 changes: 22 additions & 0 deletions src/main/java/com/luxtracon/floralis/block/DyeBlock.java
Original file line number Diff line number Diff line change
@@ -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<DyeBlock> CODEC = Block.simpleCodec(DyeBlock::new);

public DyeBlock(Properties pProperties) {
super(pProperties);
}

@Override
protected MapCodec<DyeBlock> codec() {
return DyeBlock.CODEC;
}
}
11 changes: 10 additions & 1 deletion src/main/java/com/luxtracon/floralis/block/FlowerPlantBlock.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -21,6 +23,8 @@
@ParametersAreNonnullByDefault

public class FlowerPlantBlock extends BushBlock {
public static final MapCodec<FlowerPlantBlock> 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) {
Expand Down Expand Up @@ -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<FlowerPlantBlock> 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);
}
}
37 changes: 20 additions & 17 deletions src/main/java/com/luxtracon/floralis/registry/FloralisBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -20,22 +23,22 @@
public class FloralisBlocks {
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(Registries.BLOCK, FloralisConstant.ID);

public static final Supplier<Block> WHITE_DYE_BLOCK = FloralisBlocks.BLOCKS.register("white_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.SNOW)));
public static final Supplier<Block> LIGHT_GRAY_DYE_BLOCK = FloralisBlocks.BLOCKS.register("light_gray_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_LIGHT_GRAY)));
public static final Supplier<Block> GRAY_DYE_BLOCK = FloralisBlocks.BLOCKS.register("gray_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_GRAY)));
public static final Supplier<Block> BLACK_DYE_BLOCK = FloralisBlocks.BLOCKS.register("black_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_BLACK)));
public static final Supplier<Block> BROWN_DYE_BLOCK = FloralisBlocks.BLOCKS.register("brown_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_BROWN)));
public static final Supplier<Block> RED_DYE_BLOCK = FloralisBlocks.BLOCKS.register("red_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_RED)));
public static final Supplier<Block> ORANGE_DYE_BLOCK = FloralisBlocks.BLOCKS.register("orange_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_ORANGE)));
public static final Supplier<Block> YELLOW_DYE_BLOCK = FloralisBlocks.BLOCKS.register("yellow_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_YELLOW)));
public static final Supplier<Block> LIME_DYE_BLOCK = FloralisBlocks.BLOCKS.register("lime_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_LIGHT_GREEN)));
public static final Supplier<Block> GREEN_DYE_BLOCK = FloralisBlocks.BLOCKS.register("green_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_GREEN)));
public static final Supplier<Block> CYAN_DYE_BLOCK = FloralisBlocks.BLOCKS.register("cyan_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_CYAN)));
public static final Supplier<Block> LIGHT_BLUE_DYE_BLOCK = FloralisBlocks.BLOCKS.register("light_blue_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_LIGHT_BLUE)));
public static final Supplier<Block> BLUE_DYE_BLOCK = FloralisBlocks.BLOCKS.register("blue_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_BLUE)));
public static final Supplier<Block> PURPLE_DYE_BLOCK = FloralisBlocks.BLOCKS.register("purple_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_PURPLE)));
public static final Supplier<Block> MAGENTA_DYE_BLOCK = FloralisBlocks.BLOCKS.register("magenta_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_MAGENTA)));
public static final Supplier<Block> PINK_DYE_BLOCK = FloralisBlocks.BLOCKS.register("pink_dye_block", () -> new FallingBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_PINK)));
public static final Supplier<Block> WHITE_DYE_BLOCK = FloralisBlocks.BLOCKS.register("white_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.SNOW)));
public static final Supplier<Block> LIGHT_GRAY_DYE_BLOCK = FloralisBlocks.BLOCKS.register("light_gray_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_LIGHT_GRAY)));
public static final Supplier<Block> GRAY_DYE_BLOCK = FloralisBlocks.BLOCKS.register("gray_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_GRAY)));
public static final Supplier<Block> BLACK_DYE_BLOCK = FloralisBlocks.BLOCKS.register("black_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_BLACK)));
public static final Supplier<Block> BROWN_DYE_BLOCK = FloralisBlocks.BLOCKS.register("brown_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_BROWN)));
public static final Supplier<Block> RED_DYE_BLOCK = FloralisBlocks.BLOCKS.register("red_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_RED)));
public static final Supplier<Block> ORANGE_DYE_BLOCK = FloralisBlocks.BLOCKS.register("orange_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_ORANGE)));
public static final Supplier<Block> YELLOW_DYE_BLOCK = FloralisBlocks.BLOCKS.register("yellow_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_YELLOW)));
public static final Supplier<Block> LIME_DYE_BLOCK = FloralisBlocks.BLOCKS.register("lime_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_LIGHT_GREEN)));
public static final Supplier<Block> GREEN_DYE_BLOCK = FloralisBlocks.BLOCKS.register("green_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_GREEN)));
public static final Supplier<Block> CYAN_DYE_BLOCK = FloralisBlocks.BLOCKS.register("cyan_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_CYAN)));
public static final Supplier<Block> LIGHT_BLUE_DYE_BLOCK = FloralisBlocks.BLOCKS.register("light_blue_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_LIGHT_BLUE)));
public static final Supplier<Block> BLUE_DYE_BLOCK = FloralisBlocks.BLOCKS.register("blue_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_BLUE)));
public static final Supplier<Block> PURPLE_DYE_BLOCK = FloralisBlocks.BLOCKS.register("purple_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_PURPLE)));
public static final Supplier<Block> MAGENTA_DYE_BLOCK = FloralisBlocks.BLOCKS.register("magenta_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_MAGENTA)));
public static final Supplier<Block> PINK_DYE_BLOCK = FloralisBlocks.BLOCKS.register("pink_dye_block", () -> new DyeBlock(FloralisBlocks.propertiesDyeBlock(MapColor.COLOR_PINK)));

public static final Supplier<Block> PLANT_FIBERS_BLOCK = FloralisBlocks.BLOCKS.register("plant_fibers_block", () -> new PlantFibersBlock(FloralisBlocks.propertiesFibersBlock()));

Expand Down

0 comments on commit fb1fb82

Please sign in to comment.