Skip to content

Commit

Permalink
tree on different block
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaupenjoe committed Nov 27, 2024
1 parent 1948fa8 commit 0733d28
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.21.1 2024-11-27T16:30:11.7066247 Registries
// 1.21.1 2024-11-27T16:38:34.7798617 Registries
3fd2de41d7f56602b24c8c3db6189289bbbe5aec data/tutorialmod/enchantment/lightning_striker.json
7f12bbcc0196a5e16c72dbee4a65a0c54ecd8131 data/tutorialmod/neoforge/biome_modifier/add_bismuth_ore.json
c04e2d2718fe82b49b71b226ced92e16b3899de5 data/tutorialmod/neoforge/biome_modifier/add_end_bismuth_ore.json
Expand All @@ -7,7 +7,7 @@ aaf11e04d11a88b56a609c7dfd1d1c1a5271ae31 data/tutorialmod/neoforge/biome_modifie
3cd890dbde0b55f88785d874de11fa6efdf407d2 data/tutorialmod/trim_material/bismuth.json
a248f3d2ed7262ab9e3ba1194d67ffd6b2e0d1cb data/tutorialmod/trim_pattern/kaupen.json
6c8fa2cc6887e1af235ae1d6b9d047abc187bf0e data/tutorialmod/worldgen/configured_feature/bismuth_ore.json
ec29f104c0a48f205bf953be5e0cfd04b9253b1a data/tutorialmod/worldgen/configured_feature/bloodwood.json
6cc4d867cd0d1d1d6b091b18db0d44ab27116d48 data/tutorialmod/worldgen/configured_feature/bloodwood.json
74ca087876b83762b1419f55951e41d2424829c7 data/tutorialmod/worldgen/configured_feature/end_bismuth_ore.json
a1941ebc5c0ae20b1731e019a3aa49df359cb846 data/tutorialmod/worldgen/configured_feature/nether_bismuth_ore.json
890981b29638f9a8066156170d0b4026983cda96 data/tutorialmod/worldgen/placed_feature/bismuth_ore_placed.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"dirt_provider": {
"type": "minecraft:simple_state_provider",
"state": {
"Name": "minecraft:dirt"
"Name": "minecraft:netherrack"
}
},
"foliage_placer": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public int getFireSpreadSpeed(BlockState state, BlockGetter level, BlockPos pos,
});

public static final DeferredBlock<Block> BLOODWOOD_SAPLING = registerBlock("bloodwood_sapling",
() -> new SaplingBlock(ModTreeGrowers.BLOODWOOD, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_SAPLING)));
() -> new ModSaplingBlock(ModTreeGrowers.BLOODWOOD, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_SAPLING), () -> Blocks.NETHERRACK));


private static <T extends Block> DeferredBlock<T> registerBlock(String name, Supplier<T> block) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package net.kaupenjoe.tutorialmod.block.custom;

import net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SaplingBlock;
import net.minecraft.world.level.block.grower.TreeGrower;
import net.minecraft.world.level.block.state.BlockState;

import java.util.function.Supplier;

public class ModSaplingBlock extends SaplingBlock {
private final Supplier<Block> blockToSurviveOn;

public ModSaplingBlock(TreeGrower treeGrower, Properties properties, Supplier<Block> block) {
super(treeGrower, properties);
this.blockToSurviveOn = block;
}

@Override
protected boolean mayPlaceOn(BlockState state, BlockGetter level, BlockPos pos) {
return blockToSurviveOn.get() == state.getBlock();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static void bootstrap(BootstrapContext<ConfiguredFeature<?, ?>> context)
BlockStateProvider.simple(ModBlocks.BLOODWOOD_LEAVES.get()),
new BlobFoliagePlacer(ConstantInt.of(2), ConstantInt.of(3), 3),

new TwoLayersFeatureSize(1, 0, 2)).build());
new TwoLayersFeatureSize(1, 0, 2)).dirt(BlockStateProvider.simple(Blocks.NETHERRACK)).build());

}

Expand Down

0 comments on commit 0733d28

Please sign in to comment.