Skip to content

Commit 51fe656

Browse files
committed
- Fixed missing interaction animation for harvesting Pine Litter and Leaf Litter
- Pine Litter now generates more often (every 4 instead of 6) - Improved PineLitterBlock and LeafLitterBlock ItemInteractionResults - Added Leaf Litter world generation, similar to Pine Litter - Added Leaf Litter do loot table of Oak Leaves and Dark Oak Leaves, 10% chance when decaying, similar to Pine Litter for Spruce Leaves
1 parent 2821f83 commit 51fe656

File tree

11 files changed

+281
-16
lines changed

11 files changed

+281
-16
lines changed
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
// 1.21.1 2025-10-11T18:08:52.3240325 Registries
1+
// 1.21.1 2025-10-12T22:37:05.6265128 Registries
2+
28eb2614252c03ae732ab8267723f69a3b455d2c data/floraexpansion/neoforge/biome_modifier/add_leaf_litter.json
23
711f3684b5125ecbf7aedc0cd8de7091f662017c data/floraexpansion/neoforge/biome_modifier/add_pine_litter.json
4+
95867b72e083aa8e783e27b1723eafcd223f7f86 data/floraexpansion/worldgen/configured_feature/leaf_litter.json
35
a29dc1a441b94d271e5641fc4571119b90179936 data/floraexpansion/worldgen/configured_feature/pine_litter.json
4-
808300495952012cfdf78e7fcdf623763288073c data/floraexpansion/worldgen/placed_feature/pine_litter_placed.json
6+
69a810cb6df133bf75210b6eca36ad8c43287b10 data/floraexpansion/worldgen/placed_feature/leaf_litter_placed.json
7+
57b39c3d0369e310f6cf0a67b0cb85bdb5254640 data/floraexpansion/worldgen/placed_feature/pine_litter_placed.json
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"type": "neoforge:add_features",
3+
"biomes": "#minecraft:is_forest",
4+
"features": "floraexpansion:leaf_litter_placed",
5+
"step": "vegetal_decoration"
6+
}
Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
{
2+
"type": "minecraft:random_patch",
3+
"config": {
4+
"feature": {
5+
"feature": {
6+
"type": "minecraft:simple_block",
7+
"config": {
8+
"to_place": {
9+
"type": "minecraft:weighted_state_provider",
10+
"entries": [
11+
{
12+
"data": {
13+
"Name": "floraexpansion:leaf_litter",
14+
"Properties": {
15+
"facing": "north",
16+
"segment_amount": "1"
17+
}
18+
},
19+
"weight": 1
20+
},
21+
{
22+
"data": {
23+
"Name": "floraexpansion:leaf_litter",
24+
"Properties": {
25+
"facing": "north",
26+
"segment_amount": "2"
27+
}
28+
},
29+
"weight": 1
30+
},
31+
{
32+
"data": {
33+
"Name": "floraexpansion:leaf_litter",
34+
"Properties": {
35+
"facing": "north",
36+
"segment_amount": "3"
37+
}
38+
},
39+
"weight": 1
40+
},
41+
{
42+
"data": {
43+
"Name": "floraexpansion:leaf_litter",
44+
"Properties": {
45+
"facing": "north",
46+
"segment_amount": "4"
47+
}
48+
},
49+
"weight": 1
50+
},
51+
{
52+
"data": {
53+
"Name": "floraexpansion:leaf_litter",
54+
"Properties": {
55+
"facing": "east",
56+
"segment_amount": "1"
57+
}
58+
},
59+
"weight": 1
60+
},
61+
{
62+
"data": {
63+
"Name": "floraexpansion:leaf_litter",
64+
"Properties": {
65+
"facing": "east",
66+
"segment_amount": "2"
67+
}
68+
},
69+
"weight": 1
70+
},
71+
{
72+
"data": {
73+
"Name": "floraexpansion:leaf_litter",
74+
"Properties": {
75+
"facing": "east",
76+
"segment_amount": "3"
77+
}
78+
},
79+
"weight": 1
80+
},
81+
{
82+
"data": {
83+
"Name": "floraexpansion:leaf_litter",
84+
"Properties": {
85+
"facing": "east",
86+
"segment_amount": "4"
87+
}
88+
},
89+
"weight": 1
90+
},
91+
{
92+
"data": {
93+
"Name": "floraexpansion:leaf_litter",
94+
"Properties": {
95+
"facing": "south",
96+
"segment_amount": "1"
97+
}
98+
},
99+
"weight": 1
100+
},
101+
{
102+
"data": {
103+
"Name": "floraexpansion:leaf_litter",
104+
"Properties": {
105+
"facing": "south",
106+
"segment_amount": "2"
107+
}
108+
},
109+
"weight": 1
110+
},
111+
{
112+
"data": {
113+
"Name": "floraexpansion:leaf_litter",
114+
"Properties": {
115+
"facing": "south",
116+
"segment_amount": "3"
117+
}
118+
},
119+
"weight": 1
120+
},
121+
{
122+
"data": {
123+
"Name": "floraexpansion:leaf_litter",
124+
"Properties": {
125+
"facing": "south",
126+
"segment_amount": "4"
127+
}
128+
},
129+
"weight": 1
130+
},
131+
{
132+
"data": {
133+
"Name": "floraexpansion:leaf_litter",
134+
"Properties": {
135+
"facing": "west",
136+
"segment_amount": "1"
137+
}
138+
},
139+
"weight": 1
140+
},
141+
{
142+
"data": {
143+
"Name": "floraexpansion:leaf_litter",
144+
"Properties": {
145+
"facing": "west",
146+
"segment_amount": "2"
147+
}
148+
},
149+
"weight": 1
150+
},
151+
{
152+
"data": {
153+
"Name": "floraexpansion:leaf_litter",
154+
"Properties": {
155+
"facing": "west",
156+
"segment_amount": "3"
157+
}
158+
},
159+
"weight": 1
160+
},
161+
{
162+
"data": {
163+
"Name": "floraexpansion:leaf_litter",
164+
"Properties": {
165+
"facing": "west",
166+
"segment_amount": "4"
167+
}
168+
},
169+
"weight": 1
170+
}
171+
]
172+
}
173+
}
174+
},
175+
"placement": [
176+
{
177+
"type": "minecraft:block_predicate_filter",
178+
"predicate": {
179+
"type": "minecraft:all_of",
180+
"predicates": [
181+
{
182+
"type": "minecraft:matching_blocks",
183+
"blocks": "minecraft:air"
184+
},
185+
{
186+
"type": "minecraft:matching_blocks",
187+
"blocks": [
188+
"minecraft:grass_block",
189+
"minecraft:podzol",
190+
"minecraft:coarse_dirt"
191+
],
192+
"offset": [
193+
0,
194+
-1,
195+
0
196+
]
197+
}
198+
]
199+
}
200+
}
201+
]
202+
},
203+
"tries": 96,
204+
"xz_spread": 7,
205+
"y_spread": 3
206+
}
207+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"feature": "floraexpansion:leaf_litter",
3+
"placement": [
4+
{
5+
"type": "minecraft:rarity_filter",
6+
"chance": 4
7+
},
8+
{
9+
"type": "minecraft:in_square"
10+
},
11+
{
12+
"type": "minecraft:heightmap",
13+
"heightmap": "OCEAN_FLOOR_WG"
14+
},
15+
{
16+
"type": "minecraft:biome"
17+
}
18+
]
19+
}

src/generated/resources/data/floraexpansion/worldgen/placed_feature/pine_litter_placed.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"placement": [
44
{
55
"type": "minecraft:rarity_filter",
6-
"chance": 6
6+
"chance": 4
77
},
88
{
99
"type": "minecraft:in_square"

src/main/java/de/artemis/floraexpansion/common/block/LeafLitterBlock.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public LeafLitterBlock(Properties properties) {
3434
@Override
3535
protected @NotNull ItemInteractionResult useItemOn(@NotNull ItemStack itemStack, @NotNull BlockState blockState, @NotNull Level level, @NotNull BlockPos blockPos, @NotNull Player player, @NotNull InteractionHand interactionHand, @NotNull BlockHitResult blockHitResult) {
3636

37-
if (player.getItemInHand(interactionHand).isEmpty()) {
37+
if (player.getItemInHand(interactionHand).isEmpty() && interactionHand == InteractionHand.MAIN_HAND) {
3838
level.addFreshEntity(new ItemEntity(level,
3939
blockPos.getX() + 0.5,
4040
blockPos.getY() + 0.5,
@@ -47,6 +47,8 @@ public LeafLitterBlock(Properties properties) {
4747
if (player instanceof ServerPlayer serverPlayer) {
4848
serverPlayer.awardStat(Stats.BLOCK_MINED.get(this));
4949
}
50+
51+
return ItemInteractionResult.sidedSuccess(level.isClientSide);
5052
}
5153

5254
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;

src/main/java/de/artemis/floraexpansion/common/block/PineLitterBlock.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public void performBonemeal(@NotNull ServerLevel serverLevel, @NotNull RandomSou
101101
@Override
102102
protected @NotNull ItemInteractionResult useItemOn(@NotNull ItemStack itemStack, @NotNull BlockState blockState, @NotNull Level level, BlockPos blockPos, @NotNull Player player, @NotNull InteractionHand interactionHand, BlockHitResult blockHitResult) {
103103

104-
if (player.getItemInHand(interactionHand).isEmpty()) {
104+
if (player.getItemInHand(interactionHand).isEmpty() && interactionHand == InteractionHand.MAIN_HAND) {
105105
level.addFreshEntity(new ItemEntity(level,
106106
blockPos.getX() + 0.5,
107107
blockPos.getY() + 0.5,
@@ -119,6 +119,8 @@ public void performBonemeal(@NotNull ServerLevel serverLevel, @NotNull RandomSou
119119
if (player instanceof ServerPlayer serverPlayer) {
120120
serverPlayer.awardStat(Stats.BLOCK_MINED.get(this));
121121
}
122+
123+
return ItemInteractionResult.sidedSuccess(level.isClientSide);
122124
}
123125

124126
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;

src/main/java/de/artemis/floraexpansion/common/datagen/ModGlobalLootModifierProvider.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,14 @@ protected void start() {
3030
new AddItemModifier(new LootItemCondition[] {
3131
LootItemBlockStatePropertyCondition.hasBlockStateProperties(Blocks.SPRUCE_LEAVES).build(),
3232
LootItemRandomChanceCondition.randomChance(0.1f).build() }, ModBlocks.PINE_LITTER.get().asItem()));
33+
34+
this.add("leaf_litter_to_oak_leaves",
35+
new AddItemModifier(new LootItemCondition[] {
36+
LootItemBlockStatePropertyCondition.hasBlockStateProperties(Blocks.OAK_LEAVES).build(),
37+
LootItemRandomChanceCondition.randomChance(0.1f).build() }, ModBlocks.LEAF_LITTER.get().asItem()));
38+
this.add("leaf_litter_to_dark_oak_leaves",
39+
new AddItemModifier(new LootItemCondition[] {
40+
LootItemBlockStatePropertyCondition.hasBlockStateProperties(Blocks.DARK_OAK_LEAVES).build(),
41+
LootItemRandomChanceCondition.randomChance(0.1f).build() }, ModBlocks.LEAF_LITTER.get().asItem()));
3342
}
3443
}

src/main/java/de/artemis/floraexpansion/common/worldgen/ModBiomeModifiers.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,21 @@
1616

1717
public class ModBiomeModifiers {
1818
public static final ResourceKey<BiomeModifier> ADD_PINE_LITTER = registerKey("add_pine_litter");
19+
public static final ResourceKey<BiomeModifier> ADD_LEAF_LITTER = registerKey("add_leaf_litter");
1920

2021
public static void bootstrap(BootstrapContext<BiomeModifier> context) {
21-
// CF -> PF -> BM
2222
var placedFeatures = context.lookup(Registries.PLACED_FEATURE);
2323
var biomes = context.lookup(Registries.BIOME);
2424

2525
context.register(ADD_PINE_LITTER, new BiomeModifiers.AddFeaturesBiomeModifier(
2626
biomes.getOrThrow(BiomeTags.IS_TAIGA),
2727
HolderSet.direct(placedFeatures.getOrThrow(ModPlacedFeatures.PINE_LITTER_PLACED_KEY)),
2828
GenerationStep.Decoration.VEGETAL_DECORATION));
29+
30+
context.register(ADD_LEAF_LITTER, new BiomeModifiers.AddFeaturesBiomeModifier(
31+
biomes.getOrThrow(BiomeTags.IS_FOREST),
32+
HolderSet.direct(placedFeatures.getOrThrow(ModPlacedFeatures.LEAF_LITTER_PLACED_KEY)),
33+
GenerationStep.Decoration.VEGETAL_DECORATION));
2934
}
3035

3136
private static ResourceKey<BiomeModifier> registerKey(String name) {

src/main/java/de/artemis/floraexpansion/common/worldgen/ModConfiguredFeatures.java

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package de.artemis.floraexpansion.common.worldgen;
22

33
import de.artemis.floraexpansion.FloraExpansion;
4+
import de.artemis.floraexpansion.common.block.LeafLitterBlock;
45
import de.artemis.floraexpansion.common.block.ModBlocks;
56
import de.artemis.floraexpansion.common.block.PineLitterBlock;
67
import net.minecraft.core.Direction;
@@ -22,26 +23,33 @@
2223

2324
public class ModConfiguredFeatures {
2425
public static final ResourceKey<ConfiguredFeature<?, ?>> PINE_LITTER_KEY = registerKey("pine_litter");
26+
public static final ResourceKey<ConfiguredFeature<?, ?>> LEAF_LITTER_KEY = registerKey("leaf_litter");
2527

2628
public static void bootstrap(BootstrapContext<ConfiguredFeature<?, ?>> context) {
2729

28-
SimpleWeightedRandomList.Builder<BlockState> randomStates = SimpleWeightedRandomList.builder();
30+
SimpleWeightedRandomList.Builder<BlockState> PineLitterRandomStates = SimpleWeightedRandomList.builder();
31+
SimpleWeightedRandomList.Builder<BlockState> LeafLitterRandomStates = SimpleWeightedRandomList.builder();
2932

3033
for (Direction dir : Direction.Plane.HORIZONTAL) {
3134
for (int amount = 1; amount <= 4; amount++) {
32-
randomStates.add(
33-
ModBlocks.PINE_LITTER.get()
34-
.defaultBlockState()
35-
.setValue(PineLitterBlock.FACING, dir)
36-
.setValue(PineLitterBlock.AMOUNT, amount),
37-
1 // equal weight
38-
);
35+
PineLitterRandomStates.add(ModBlocks.PINE_LITTER.get().defaultBlockState().setValue(PineLitterBlock.FACING, dir).setValue(PineLitterBlock.AMOUNT, amount), 1);
36+
}
37+
}
38+
39+
for (Direction dir : Direction.Plane.HORIZONTAL) {
40+
for (int amount = 1; amount <= 4; amount++) {
41+
LeafLitterRandomStates.add(ModBlocks.LEAF_LITTER.get().defaultBlockState().setValue(LeafLitterBlock.FACING, dir).setValue(LeafLitterBlock.AMOUNT, amount), 1);
3942
}
4043
}
4144

4245
register(context, PINE_LITTER_KEY, Feature.RANDOM_PATCH,
4346
FeatureUtils.simplePatchConfiguration(Feature.SIMPLE_BLOCK,
44-
new SimpleBlockConfiguration(new WeightedStateProvider(randomStates.build())),
47+
new SimpleBlockConfiguration(new WeightedStateProvider(PineLitterRandomStates.build())),
48+
List.of(Blocks.GRASS_BLOCK, Blocks.PODZOL, Blocks.COARSE_DIRT)));
49+
50+
register(context, LEAF_LITTER_KEY, Feature.RANDOM_PATCH,
51+
FeatureUtils.simplePatchConfiguration(Feature.SIMPLE_BLOCK,
52+
new SimpleBlockConfiguration(new WeightedStateProvider(LeafLitterRandomStates.build())),
4553
List.of(Blocks.GRASS_BLOCK, Blocks.PODZOL, Blocks.COARSE_DIRT)));
4654
}
4755

0 commit comments

Comments
 (0)