-
-
Notifications
You must be signed in to change notification settings - Fork 513
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add composting support (fixes #4263)
- Loading branch information
1 parent
ed1d45e
commit 9d3d3f1
Showing
3 changed files
with
36 additions
and
0 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
32 changes: 32 additions & 0 deletions
32
Xplat/src/main/java/vazkii/botania/common/handler/CompostingData.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,32 @@ | ||
package vazkii.botania.common.handler; | ||
|
||
import it.unimi.dsi.fastutil.floats.FloatConsumer; | ||
import net.minecraft.world.item.DyeColor; | ||
import net.minecraft.world.level.ItemLike; | ||
|
||
import vazkii.botania.common.block.BotaniaBlocks; | ||
import vazkii.botania.common.item.BotaniaItems; | ||
|
||
import java.util.function.BiConsumer; | ||
|
||
public class CompostingData { | ||
public static void init(BiConsumer<ItemLike, Float> registrationMethod) { | ||
// common vanilla composting chances: | ||
final float chanceLowest = 0.3f; | ||
final float chanceLow = 0.5f; | ||
final float chanceMid = 0.65f; | ||
final float chanceHigh = 0.85f; | ||
// unused here: final float chanceHighest = 1.0f; | ||
|
||
// see https://github.com/VazkiiMods/Botania/issues/4263#issuecomment-1529130978 | ||
for (final var dyeColor : DyeColor.values()) { | ||
registrationMethod.accept(BotaniaItems.getPetal(dyeColor), chanceLowest); | ||
registrationMethod.accept(BotaniaBlocks.getPetalBlock(dyeColor), chanceLow); | ||
registrationMethod.accept(BotaniaBlocks.getFlower(dyeColor), chanceMid); | ||
registrationMethod.accept(BotaniaBlocks.getDoubleFlower(dyeColor), chanceMid); | ||
registrationMethod.accept(BotaniaBlocks.getMushroom(dyeColor), chanceMid); | ||
} | ||
|
||
registrationMethod.accept(BotaniaBlocks.cellBlock, chanceHigh); | ||
} | ||
} |