-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BoneMealing Tall Alliums Makes Giant Alliums
- Loading branch information
Showing
4 changed files
with
73 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...nstudios/biomeswevegone/world/level/block/plants/flower/BWGTallFlowerBlockTreeGrower.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package net.potionstudios.biomeswevegone.world.level.block.plants.flower; | ||
|
||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.server.level.ServerLevel; | ||
import net.minecraft.tags.TagKey; | ||
import net.minecraft.util.RandomSource; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.Blocks; | ||
import net.minecraft.world.level.block.grower.AbstractTreeGrower; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.function.Supplier; | ||
|
||
public class BWGTallFlowerBlockTreeGrower extends BWGTallFlowerBlock { | ||
|
||
private final Supplier<AbstractTreeGrower> treeGrower; | ||
|
||
public BWGTallFlowerBlockTreeGrower(Properties properties, TagKey<Block> validGround, Supplier<AbstractTreeGrower> treeGrower) { | ||
super(properties, validGround); | ||
this.treeGrower = treeGrower; | ||
} | ||
|
||
public BWGTallFlowerBlockTreeGrower(Properties properties, Supplier<AbstractTreeGrower> treeGrower) { | ||
super(properties); | ||
this.treeGrower = treeGrower; | ||
} | ||
|
||
@Override | ||
public boolean isBonemealSuccess(@NotNull Level level, RandomSource random, @NotNull BlockPos pos, @NotNull BlockState state) { | ||
return random.nextBoolean(); | ||
} | ||
|
||
@Override | ||
public void performBonemeal(@NotNull ServerLevel level, @NotNull RandomSource random, @NotNull BlockPos pos, @NotNull BlockState state) { | ||
level.setBlockAndUpdate(state.getValue(HALF) == DoubleBlockHalf.LOWER ? pos : pos.below(), Blocks.AIR.defaultBlockState()); | ||
treeGrower.get().growTree(level, level.getChunkSource().getGenerator(), pos, state, random); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters