-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1353 from YocyCraft/dev/anvil_conversion_hotfix
Fix conversion chance of spectral anvil 修复幻灵铁砧的转换概率
- Loading branch information
Showing
2 changed files
with
26 additions
and
15 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
23 changes: 23 additions & 0 deletions
23
src/main/java/dev/dubhe/anvilcraft/util/SpectralAnvilConversionUtil.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,23 @@ | ||
package dev.dubhe.anvilcraft.util; | ||
|
||
import dev.dubhe.anvilcraft.init.ModBlocks; | ||
import it.unimi.dsi.fastutil.objects.Object2DoubleMap; | ||
import it.unimi.dsi.fastutil.objects.Object2DoubleOpenHashMap; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.Blocks; | ||
|
||
public class SpectralAnvilConversionUtil { | ||
private static final Object2DoubleMap<Block> SPECTRAL_ANVIL_CONVERSION_CHANCE = new Object2DoubleOpenHashMap<>(); | ||
|
||
static { | ||
SPECTRAL_ANVIL_CONVERSION_CHANCE.put(Blocks.DAMAGED_ANVIL, 0.01); | ||
SPECTRAL_ANVIL_CONVERSION_CHANCE.put(Blocks.CHIPPED_ANVIL, 0.02); | ||
SPECTRAL_ANVIL_CONVERSION_CHANCE.put(Blocks.ANVIL, 0.03); | ||
SPECTRAL_ANVIL_CONVERSION_CHANCE.put(ModBlocks.ROYAL_ANVIL.get(), 0.5); | ||
SPECTRAL_ANVIL_CONVERSION_CHANCE.put(ModBlocks.EMBER_ANVIL.get(), 1.0); | ||
} | ||
|
||
public static double chance(Block block) { | ||
return SPECTRAL_ANVIL_CONVERSION_CHANCE.getOrDefault(block, 0.03); | ||
} | ||
} |