Skip to content

Commit

Permalink
qeldry berry changes + texture
Browse files Browse the repository at this point in the history
  • Loading branch information
gemsb committed Jan 14, 2025
1 parent 1cad437 commit 368f8a6
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 14 deletions.
2 changes: 2 additions & 0 deletions src/client/java/net/ugi/sculk_depths/SculkDepthsClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ public void onInitializeClient() {
BlockRenderLayerMap.INSTANCE.putBlock(ModBlocks.AURIC_VINES, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(ModBlocks.AURIC_VINES_END, RenderLayer.getCutout());

BlockRenderLayerMap.INSTANCE.putBlock(ModBlocks.QELDRY_BERRY_BUSH, RenderLayer.getCutout());


ParticleFactoryRegistry.getInstance().register(ModParticleTypes.PENEBRIUM_SPORES, PenebriumSporeParticle.Factory::new);
ParticleFactoryRegistry.getInstance().register(ModParticleTypes.SCULK_DEPTHS_PORTAL_PARTICLE, ModPortalParticle.Factory::new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

public class QeldryBerryBush extends PlantBlock implements Fertilizable {
public static final MapCodec<QeldryBerryBush> CODEC = createCodec(QeldryBerryBush::new);
public static final int MAX_AGE = 3;
public static final int MAX_AGE = 2;
public static final IntProperty AGE;
private static final VoxelShape SMALL_SHAPE;
private static final VoxelShape LARGE_SHAPE;
Expand All @@ -55,17 +55,17 @@ protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos
if ((Integer)state.get(AGE) == 0) {
return SMALL_SHAPE;
} else {
return (Integer)state.get(AGE) < 3 ? LARGE_SHAPE : super.getOutlineShape(state, world, pos, context);
return LARGE_SHAPE;
}
}

protected boolean hasRandomTicks(BlockState state) {
return (Integer)state.get(AGE) < 3;
return (Integer)state.get(AGE) < 2;
}

protected void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
int i = (Integer)state.get(AGE);
if (i < 3 && random.nextInt(5) == 0 && world.getBaseLightLevel(pos.up(), 0) >= 9) {
if (i < 2 && random.nextInt(5) == 0 /*&& world.getBaseLightLevel(pos.up(), 0) >= 9*/) {
BlockState blockState = (BlockState)state.with(AGE, i + 1);
world.setBlockState(pos, blockState, 2);
world.emitGameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Emitter.of(blockState));
Expand All @@ -78,13 +78,13 @@ protected void onEntityCollision(BlockState state, World world, BlockPos pos, En

protected ItemActionResult onUseWithItem(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
int i = (Integer)state.get(AGE);
boolean bl = i == 3;
boolean bl = i == 2;
return !bl && stack.isOf(Items.BONE_MEAL) ? ItemActionResult.SKIP_DEFAULT_BLOCK_INTERACTION : super.onUseWithItem(stack, state, world, pos, player, hand, hit);
}

protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) {
int i = (Integer)state.get(AGE);
boolean bl = i == 3;
boolean bl = i == 2;
if (i > 1) {
dropStack(world, pos, new ItemStack(ModItems.QELDRY_BERRY, 1));
world.playSound((PlayerEntity)null, pos, SoundEvents.BLOCK_SWEET_BERRY_BUSH_PICK_BERRIES, SoundCategory.BLOCKS, 1.0F, 0.8F + world.random.nextFloat() * 0.4F);
Expand All @@ -102,22 +102,22 @@ protected void appendProperties(StateManager.Builder<Block, BlockState> builder)
}

public boolean isFertilizable(WorldView world, BlockPos pos, BlockState state) {
return (Integer)state.get(AGE) < 3;
return (Integer)state.get(AGE) < 2;
}

public boolean canGrow(World world, Random random, BlockPos pos, BlockState state) {
return true;
}

public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state) {
int i = Math.min(3, (Integer)state.get(AGE) + 1);
int i = Math.min(2, (Integer)state.get(AGE) + 1);
world.setBlockState(pos, (BlockState)state.with(AGE, i), 2);
}

static {
AGE = Properties.AGE_3;
SMALL_SHAPE = Block.createCuboidShape((double)3.0F, (double)0.0F, (double)3.0F, (double)13.0F, (double)8.0F, (double)13.0F);
LARGE_SHAPE = Block.createCuboidShape((double)1.0F, (double)0.0F, (double)1.0F, (double)15.0F, (double)16.0F, (double)15.0F);
AGE = Properties.AGE_2;
SMALL_SHAPE = Block.createCuboidShape((double)5.0F, (double)0.0F, (double)5.0F, (double)11.0F, (double)6.0F, (double)11.0F);
LARGE_SHAPE = Block.createCuboidShape((double)3.0F, (double)0.0F, (double)3.0F, (double)13.0F, (double)8.0F, (double)13.0F);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"variants": {
"age=0": {
"model": "sculk_depths:block/qeldry_berry_bush_stage0"
},
"age=1": {
"model": "sculk_depths:block/qeldry_berry_bush_stage1"
},
"age=2": {
"model": "sculk_depths:block/qeldry_berry_bush_stage2"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cross",
"textures": {
"cross": "sculk_depths:block/qeldry_berry_bush_stage0"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cross",
"textures": {
"cross": "sculk_depths:block/qeldry_berry_bush_stage1"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cross",
"textures": {
"cross": "sculk_depths:block/qeldry_berry_bush_stage2"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
"to_place": {
"type": "minecraft:simple_state_provider",
"state": {
"Name": "minecraft:sweet_berry_bush"
"Name": "sculk_depths:qeldry_berry_bush",
"Properties": {
"age": "2"
}
}
}
}
Expand All @@ -24,15 +27,15 @@
}
]
},
"tries": 32,
"tries": 8,
"xz_spread": 7,
"y_spread": 3
}
},
"placement": [
{
"type": "minecraft:count",
"count": 3
"count": 2
},
{
"type": "minecraft:in_square"
Expand Down

0 comments on commit 368f8a6

Please sign in to comment.