generated from NeoForgeMDKs/MDK-1.21-ModDevGradle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ef1ef83
commit 14fe3f3
Showing
13 changed files
with
278 additions
and
19 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d
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,6 @@ | ||
// 1.21 2024-09-14T21:29:17.5696664 Loot Tables | ||
8deec3981eb2c38113ee51e44f29f4f71141ce39 data/my_neoforge_mod/loot_table/blocks/earth_crystal_ore.json | ||
d7f885e70a8f88de01e08ee6ea327994190291e2 data/my_neoforge_mod/loot_table/blocks/machalite_block.json | ||
99505b92b5ff9f5a14992c1d2ebaad2cfee07ac1 data/my_neoforge_mod/loot_table/blocks/machalite_ore.json | ||
768940983dee8218141161963a140f2e91d34828 data/my_neoforge_mod/loot_table/blocks/magic_block.json | ||
dfe60eb9ecbdd78107294a18a068a48cabc8b776 data/my_neoforge_mod/loot_table/blocks/nulberry_bush.json |
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
36 changes: 20 additions & 16 deletions
36
...od/loot_table/blocks/machalite_block.json → ...od/loot_table/blocks/machalite_block.json
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 |
---|---|---|
@@ -1,17 +1,21 @@ | ||
{ | ||
"type": "minecraft:block", | ||
"pools": [ | ||
{ | ||
"bonus_rolls": 0.0, | ||
"conditions": [{"condition": "minecraft:survives_explosion"}], | ||
"entries": [ | ||
{ | ||
"type": "minecraft:item", | ||
"name": "my_neoforge_mod:machalite_block" | ||
} | ||
], | ||
"rolls": 1.0 | ||
} | ||
], | ||
"random_sequence": "my_neoforge_mod:blocks/machalite_block" | ||
{ | ||
"type": "minecraft:block", | ||
"pools": [ | ||
{ | ||
"bonus_rolls": 0.0, | ||
"conditions": [ | ||
{ | ||
"condition": "minecraft:survives_explosion" | ||
} | ||
], | ||
"entries": [ | ||
{ | ||
"type": "minecraft:item", | ||
"name": "my_neoforge_mod:machalite_block" | ||
} | ||
], | ||
"rolls": 1.0 | ||
} | ||
], | ||
"random_sequence": "my_neoforge_mod:blocks/machalite_block" | ||
} |
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
21 changes: 21 additions & 0 deletions
21
src/generated/resources/data/my_neoforge_mod/loot_table/blocks/magic_block.json
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,21 @@ | ||
{ | ||
"type": "minecraft:block", | ||
"pools": [ | ||
{ | ||
"bonus_rolls": 0.0, | ||
"conditions": [ | ||
{ | ||
"condition": "minecraft:survives_explosion" | ||
} | ||
], | ||
"entries": [ | ||
{ | ||
"type": "minecraft:item", | ||
"name": "my_neoforge_mod:magic_block" | ||
} | ||
], | ||
"rolls": 1.0 | ||
} | ||
], | ||
"random_sequence": "my_neoforge_mod:blocks/magic_block" | ||
} |
87 changes: 87 additions & 0 deletions
87
src/generated/resources/data/my_neoforge_mod/loot_table/blocks/nulberry_bush.json
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,87 @@ | ||
{ | ||
"type": "minecraft:block", | ||
"functions": [ | ||
{ | ||
"function": "minecraft:explosion_decay" | ||
} | ||
], | ||
"pools": [ | ||
{ | ||
"bonus_rolls": 0.0, | ||
"conditions": [ | ||
{ | ||
"block": "my_neoforge_mod:nulberry_bush", | ||
"condition": "minecraft:block_state_property", | ||
"properties": { | ||
"age": "3" | ||
} | ||
} | ||
], | ||
"entries": [ | ||
{ | ||
"type": "minecraft:item", | ||
"name": "my_neoforge_mod:nulberry" | ||
} | ||
], | ||
"functions": [ | ||
{ | ||
"add": false, | ||
"count": { | ||
"type": "minecraft:uniform", | ||
"max": 3.0, | ||
"min": 2.0 | ||
}, | ||
"function": "minecraft:set_count" | ||
}, | ||
{ | ||
"enchantment": "minecraft:fortune", | ||
"formula": "minecraft:uniform_bonus_count", | ||
"function": "minecraft:apply_bonus", | ||
"parameters": { | ||
"bonusMultiplier": 1 | ||
} | ||
} | ||
], | ||
"rolls": 1.0 | ||
}, | ||
{ | ||
"bonus_rolls": 0.0, | ||
"conditions": [ | ||
{ | ||
"block": "my_neoforge_mod:nulberry_bush", | ||
"condition": "minecraft:block_state_property", | ||
"properties": { | ||
"age": "2" | ||
} | ||
} | ||
], | ||
"entries": [ | ||
{ | ||
"type": "minecraft:item", | ||
"name": "my_neoforge_mod:nulberry" | ||
} | ||
], | ||
"functions": [ | ||
{ | ||
"add": false, | ||
"count": { | ||
"type": "minecraft:uniform", | ||
"max": 2.0, | ||
"min": 1.0 | ||
}, | ||
"function": "minecraft:set_count" | ||
}, | ||
{ | ||
"enchantment": "minecraft:fortune", | ||
"formula": "minecraft:uniform_bonus_count", | ||
"function": "minecraft:apply_bonus", | ||
"parameters": { | ||
"bonusMultiplier": 1 | ||
} | ||
} | ||
], | ||
"rolls": 1.0 | ||
} | ||
], | ||
"random_sequence": "my_neoforge_mod:blocks/nulberry_bush" | ||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/com/nateplays/my_neoforge_mod/datagen/DataGenerators.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,31 @@ | ||
package com.nateplays.my_neoforge_mod.datagen; | ||
|
||
import com.nateplays.my_neoforge_mod.MyNeoForgeMod; | ||
import net.minecraft.core.HolderLookup; | ||
import net.minecraft.data.DataGenerator; | ||
import net.minecraft.data.PackOutput; | ||
import net.minecraft.data.loot.LootTableProvider; | ||
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; | ||
import net.neoforged.bus.api.SubscribeEvent; | ||
import net.neoforged.fml.common.EventBusSubscriber; | ||
import net.neoforged.neoforge.common.data.ExistingFileHelper; | ||
import net.neoforged.neoforge.data.event.GatherDataEvent; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
@EventBusSubscriber(modid = MyNeoForgeMod.MODID, bus = EventBusSubscriber.Bus.MOD) | ||
public class DataGenerators { | ||
|
||
@SubscribeEvent | ||
public static void gatherData(GatherDataEvent event) { | ||
DataGenerator generator = event.getGenerator(); | ||
PackOutput packOutput = generator.getPackOutput(); | ||
ExistingFileHelper existingFileHelper = event.getExistingFileHelper(); | ||
CompletableFuture<HolderLookup.Provider> lookupProvider = event.getLookupProvider(); | ||
|
||
generator.addProvider(event.includeServer(), new LootTableProvider(packOutput, Collections.emptySet(), | ||
List.of(new LootTableProvider.SubProviderEntry(ModBlockLootTableProvider::new, LootContextParamSets.BLOCK)), lookupProvider)); | ||
} | ||
} |
90 changes: 90 additions & 0 deletions
90
src/main/java/com/nateplays/my_neoforge_mod/datagen/ModBlockLootTableProvider.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,90 @@ | ||
package com.nateplays.my_neoforge_mod.datagen; | ||
|
||
import com.nateplays.my_neoforge_mod.block.ModBlocks; | ||
import com.nateplays.my_neoforge_mod.block.NulberryBushBlock; | ||
import com.nateplays.my_neoforge_mod.item.ModItems; | ||
import net.minecraft.advancements.critereon.StatePropertiesPredicate; | ||
import net.minecraft.core.Holder; | ||
import net.minecraft.core.HolderLookup; | ||
import net.minecraft.core.registries.Registries; | ||
import net.minecraft.data.loot.BlockLootSubProvider; | ||
import net.minecraft.world.flag.FeatureFlagSet; | ||
import net.minecraft.world.flag.FeatureFlags; | ||
import net.minecraft.world.item.Item; | ||
import net.minecraft.world.item.Items; | ||
import net.minecraft.world.item.enchantment.Enchantment; | ||
import net.minecraft.world.item.enchantment.Enchantments; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.Blocks; | ||
import net.minecraft.world.level.block.SweetBerryBushBlock; | ||
import net.minecraft.world.level.storage.loot.LootPool; | ||
import net.minecraft.world.level.storage.loot.LootTable; | ||
import net.minecraft.world.level.storage.loot.entries.LootItem; | ||
import net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer; | ||
import net.minecraft.world.level.storage.loot.functions.ApplyBonusCount; | ||
import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction; | ||
import net.minecraft.world.level.storage.loot.predicates.LootItemBlockStatePropertyCondition; | ||
import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator; | ||
|
||
import java.util.Set; | ||
|
||
public class ModBlockLootTableProvider extends BlockLootSubProvider { | ||
protected ModBlockLootTableProvider(HolderLookup.Provider registries) { | ||
super(Set.of(), FeatureFlags.REGISTRY.allFlags(), registries); | ||
} | ||
|
||
@Override | ||
protected void generate() { | ||
HolderLookup.RegistryLookup<Enchantment> enchantmentRegistryLookup = this.registries.lookupOrThrow(Registries.ENCHANTMENT); | ||
|
||
dropSelf(ModBlocks.MACHALITE_BLOCK.get()); | ||
dropSelf(ModBlocks.MAGIC_BLOCK.get()); | ||
|
||
add(ModBlocks.EARTH_CRYSTAL_ORE.get(), | ||
block -> createMultipleOreDrops(ModBlocks.EARTH_CRYSTAL_ORE.get(), ModItems.EARTH_CRYSTAL.get(), 1.0F, 3.0F)); | ||
add(ModBlocks.MACHALITE_ORE.get(), | ||
block -> createOreDrop(ModBlocks.MACHALITE_ORE.get(), ModItems.MALACHITE_CHUNK.get())); | ||
|
||
add(ModBlocks.NULBERRY_BUSH.get(), | ||
block -> this.applyExplosionDecay(block, LootTable.lootTable() | ||
.withPool( | ||
LootPool.lootPool() | ||
.when( | ||
LootItemBlockStatePropertyCondition.hasBlockStateProperties(ModBlocks.NULBERRY_BUSH.get()) | ||
.setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(NulberryBushBlock.AGE, 3)) | ||
) | ||
.add(LootItem.lootTableItem(ModItems.NULBERRY.get())) | ||
.apply(SetItemCountFunction.setCount(UniformGenerator.between(2.0F, 3.0F))) | ||
.apply(ApplyBonusCount.addUniformBonusCount(enchantmentRegistryLookup.getOrThrow(Enchantments.FORTUNE))) | ||
) | ||
.withPool( | ||
LootPool.lootPool() | ||
.when( | ||
LootItemBlockStatePropertyCondition.hasBlockStateProperties(ModBlocks.NULBERRY_BUSH.get()) | ||
.setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(NulberryBushBlock.AGE, 2)) | ||
) | ||
.add(LootItem.lootTableItem(ModItems.NULBERRY.get())) | ||
.apply(SetItemCountFunction.setCount(UniformGenerator.between(1.0F, 2.0F))) | ||
.apply(ApplyBonusCount.addUniformBonusCount(enchantmentRegistryLookup.getOrThrow(Enchantments.FORTUNE))) | ||
))); | ||
} | ||
|
||
protected LootTable.Builder createMultipleOreDrops(Block block, Item item, float minDrops, float maxDrops) { | ||
HolderLookup.RegistryLookup<Enchantment> registrylookup = this.registries.lookupOrThrow(Registries.ENCHANTMENT); | ||
return this.createSilkTouchDispatchTable( | ||
block, | ||
(LootPoolEntryContainer.Builder<?>)this.applyExplosionDecay( | ||
block, | ||
LootItem.lootTableItem(item) | ||
.apply(SetItemCountFunction.setCount(UniformGenerator.between(minDrops, maxDrops))) | ||
.apply(ApplyBonusCount.addOreBonusCount(registrylookup.getOrThrow(Enchantments.FORTUNE))) | ||
//.apply(ApplyBonusCount.addOreBonusCount(registrylookup.getOrThrow(ModEnchantments.MINING_MASTER.get()))) | ||
) | ||
); | ||
} | ||
|
||
@Override | ||
protected Iterable<Block> getKnownBlocks() { | ||
return ModBlocks.BLOCKS.getEntries().stream().map(Holder::value)::iterator; | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/com/nateplays/my_neoforge_mod/datagen/ModBlockStateProvider.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,4 @@ | ||
package com.nateplays.my_neoforge_mod.datagen; | ||
|
||
public class ModBlockStateProvider { | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/com/nateplays/my_neoforge_mod/datagen/ModBlockTagProvider.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,4 @@ | ||
package com.nateplays.my_neoforge_mod.datagen; | ||
|
||
public class ModBlockTagProvider { | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/com/nateplays/my_neoforge_mod/datagen/ModItemModelProvider.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,4 @@ | ||
package com.nateplays.my_neoforge_mod.datagen; | ||
|
||
public class ModItemModelProvider { | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/com/nateplays/my_neoforge_mod/datagen/ModItemTagProvider.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,4 @@ | ||
package com.nateplays.my_neoforge_mod.datagen; | ||
|
||
public class ModItemTagProvider { | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/com/nateplays/my_neoforge_mod/datagen/ModRecipeProvider.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,4 @@ | ||
package com.nateplays.my_neoforge_mod.datagen; | ||
|
||
public class ModRecipeProvider { | ||
} |