CrystalCave
- 2 Devlogs
- 3 Total hours
A minecraft mod, that adds new little caves and geodes, where new blocks (crystals and ores) spawn. All 3 new ores have different usecases.
A minecraft mod, that adds new little caves and geodes, where new blocks (crystals and ores) spawn. All 3 new ores have different usecases.
Whats new:
-An extra inventory tab for the items that the mods adds
-Registered the crafting recipe
-Feature of sapphire added
The creation of the new Tab was pretty easy. I only needed to register it with
“CreativeModeTab = Registry.register”
then just add every item in this format:
output.accept(ModItems.SAPPHIRE)
output.accept(ModItems.MOONSTONE)
…
The custom recipes were a bit more difficult.
I created SapphireUpgradeRecipe. It scans the crafting grid to check if the center slot has an item with durability, surrounded by Sapphires. Inside assemble(), it copies the item and calculates a +20% increase to its MAX_DAMAGE.
I first was confused because i thought damage would be the damage you are dealing with it (just like in the ItemEdit Plugin or Paper)
Though, the damage on the item is meant. So basically the durability.
val currentMax = result.maxDamage
val newMax = currentMax + ceil(currentMax * 0.20).toInt().coerceAtLeast(1)
result.set(DataComponents.MAX_DAMAGE, newMax)
In MoonstoneUpgradeRecipe, when you craft a item with 8 Moonstones around it, it attaches a custom NBT marker (crystalcave_moonstone_upgrade) to the item’s data components.
I will add a ServerTickEvents event loop in the future which then will target every monster in a 64 block radius or soemthing like that.
I registered new blocks and items. It was difficult to find how to register these. In my mods before ive never added new blocks biomes ore anything like that.
As the unobfuscated versions of minecraft arent out that long, it is difficult to find good documentations of the class names.
I first tried fabrics AbstractBlock settings which looked like this:
val SAPPHIRE_ORE = registerBlock(
“sapphire_ore”,
Block(AbstractBlock.Settings.create()
.mapColor(MapColor.STONE_GRAY)
.instrument(Instrument.BASE_DRUM)
.requiresTool()
.strength(3.0f, 3.0f)
.sounds(BlockSoundGroup.STONE))
)
After asking Gemini and telling it that I am working with the latest minecraft version (and that it is NOT 1.21.4) I made the system use lateinit var and an helper function.