diff --git a/build.gradle b/build.gradle index 554050e..f44c720 100644 --- a/build.gradle +++ b/build.gradle @@ -103,6 +103,10 @@ minecraft { } } +sourceSets.main.resources { + srcDir("src/generated/resources") +} + dependencies { // Not sure if we need this one, what is a "forge" anyway? minecraft "net.minecraftforge:forge:${mcVersion}-${forgeVersion}" diff --git a/gradle.properties b/gradle.properties index e8cdae2..92ba7fe 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ mcVersion=1.16.5 forgeVersion=36.2.34 mappingsVersion=2022.03.06 -dynamicTreesVersion=0.10.0-Beta-LR6 +dynamicTreesVersion=0.10.0-Beta-LR10 dynamicTreesPlusVersion=0.1.0-Beta-LR1 hwylaVersion=1.10.11-B78_1.16.2 jeiVersion=7.7.1.139 diff --git a/src/main/resources/data/dtatum/loot_tables/blocks/date_fruit.json b/src/generated/resources/data/dtatum/loot_tables/blocks/date_fruit.json similarity index 89% rename from src/main/resources/data/dtatum/loot_tables/blocks/date_fruit.json rename to src/generated/resources/data/dtatum/loot_tables/blocks/date_fruit.json index ace29d4..4555f74 100644 --- a/src/main/resources/data/dtatum/loot_tables/blocks/date_fruit.json +++ b/src/generated/resources/data/dtatum/loot_tables/blocks/date_fruit.json @@ -23,16 +23,14 @@ "max": 5.0, "type": "minecraft:uniform" } + }, + { + "function": "minecraft:explosion_decay" } ], "name": "atum:date" } ] } - ], - "functions": [ - { - "function": "minecraft:explosion_decay" - } ] } \ No newline at end of file diff --git a/src/generated/resources/data/dtatum/loot_tables/blocks/dry_leaves.json b/src/generated/resources/data/dtatum/loot_tables/blocks/dry_leaves.json new file mode 100644 index 0000000..8d0292b --- /dev/null +++ b/src/generated/resources/data/dtatum/loot_tables/blocks/dry_leaves.json @@ -0,0 +1,66 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:alternative", + "terms": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "item": "minecraft:shears" + } + }, + { + "condition": "minecraft:match_tool", + "predicate": { + "enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + ] + } + ], + "name": "atum:dry_leaves" + }, + { + "type": "dynamictrees:seed_item", + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.015625, + 0.03125, + 0.046875, + 0.0625 + ] + }, + { + "condition": "dynamictrees:seasonal_seed_drop_chance" + } + ] + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dtatum/loot_tables/blocks/palm_leaves.json b/src/generated/resources/data/dtatum/loot_tables/blocks/palm_leaves.json new file mode 100644 index 0000000..6d6937a --- /dev/null +++ b/src/generated/resources/data/dtatum/loot_tables/blocks/palm_leaves.json @@ -0,0 +1,66 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:alternative", + "terms": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "item": "minecraft:shears" + } + }, + { + "condition": "minecraft:match_tool", + "predicate": { + "enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + ] + } + ], + "name": "atum:palm_leaves" + }, + { + "type": "dynamictrees:seed_item", + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.015625, + 0.03125, + 0.046875, + 0.0625 + ] + }, + { + "condition": "dynamictrees:seasonal_seed_drop_chance" + } + ] + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dtatum/loot_tables/trees/branches/dead_palm.json b/src/generated/resources/data/dtatum/loot_tables/trees/branches/dead_palm.json new file mode 100644 index 0000000..72b0205 --- /dev/null +++ b/src/generated/resources/data/dtatum/loot_tables/trees/branches/dead_palm.json @@ -0,0 +1,39 @@ +{ + "type": "dynamictrees:branches", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "dynamictrees:multiply_logs_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "atum:deadwood_log" + } + ] + }, + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "dynamictrees:multiply_sticks_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stick" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dtatum/loot_tables/trees/branches/deadwood.json b/src/generated/resources/data/dtatum/loot_tables/trees/branches/deadwood.json new file mode 100644 index 0000000..72b0205 --- /dev/null +++ b/src/generated/resources/data/dtatum/loot_tables/trees/branches/deadwood.json @@ -0,0 +1,39 @@ +{ + "type": "dynamictrees:branches", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "dynamictrees:multiply_logs_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "atum:deadwood_log" + } + ] + }, + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "dynamictrees:multiply_sticks_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stick" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dtatum/loot_tables/trees/branches/palm.json b/src/generated/resources/data/dtatum/loot_tables/trees/branches/palm.json new file mode 100644 index 0000000..6214767 --- /dev/null +++ b/src/generated/resources/data/dtatum/loot_tables/trees/branches/palm.json @@ -0,0 +1,39 @@ +{ + "type": "dynamictrees:branches", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "dynamictrees:multiply_logs_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "atum:palm_log" + } + ] + }, + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "dynamictrees:multiply_sticks_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stick" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dtatum/loot_tables/trees/branches/stripped_dead_palm.json b/src/generated/resources/data/dtatum/loot_tables/trees/branches/stripped_dead_palm.json new file mode 100644 index 0000000..981861d --- /dev/null +++ b/src/generated/resources/data/dtatum/loot_tables/trees/branches/stripped_dead_palm.json @@ -0,0 +1,39 @@ +{ + "type": "dynamictrees:branches", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "dynamictrees:multiply_logs_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "atum:stripped_deadwood_log" + } + ] + }, + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "dynamictrees:multiply_sticks_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stick" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dtatum/loot_tables/trees/branches/stripped_deadwood.json b/src/generated/resources/data/dtatum/loot_tables/trees/branches/stripped_deadwood.json new file mode 100644 index 0000000..981861d --- /dev/null +++ b/src/generated/resources/data/dtatum/loot_tables/trees/branches/stripped_deadwood.json @@ -0,0 +1,39 @@ +{ + "type": "dynamictrees:branches", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "dynamictrees:multiply_logs_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "atum:stripped_deadwood_log" + } + ] + }, + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "dynamictrees:multiply_sticks_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stick" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dtatum/loot_tables/trees/branches/stripped_palm.json b/src/generated/resources/data/dtatum/loot_tables/trees/branches/stripped_palm.json new file mode 100644 index 0000000..81b3463 --- /dev/null +++ b/src/generated/resources/data/dtatum/loot_tables/trees/branches/stripped_palm.json @@ -0,0 +1,39 @@ +{ + "type": "dynamictrees:branches", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "dynamictrees:multiply_logs_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "atum:stripped_palm_log" + } + ] + }, + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "dynamictrees:multiply_sticks_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stick" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dtatum/loot_tables/trees/leaves/dry.json b/src/generated/resources/data/dtatum/loot_tables/trees/leaves/dry.json new file mode 100644 index 0000000..7b3e90b --- /dev/null +++ b/src/generated/resources/data/dtatum/loot_tables/trees/leaves/dry.json @@ -0,0 +1,31 @@ +{ + "type": "dynamictrees:leaves", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "dynamictrees:seed_item", + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.015625, + 0.03125, + 0.046875, + 0.0625 + ] + }, + { + "condition": "dynamictrees:seasonal_seed_drop_chance" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dtatum/loot_tables/trees/leaves/palm.json b/src/generated/resources/data/dtatum/loot_tables/trees/leaves/palm.json new file mode 100644 index 0000000..7b3e90b --- /dev/null +++ b/src/generated/resources/data/dtatum/loot_tables/trees/leaves/palm.json @@ -0,0 +1,31 @@ +{ + "type": "dynamictrees:leaves", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "dynamictrees:seed_item", + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.015625, + 0.03125, + 0.046875, + 0.0625 + ] + }, + { + "condition": "dynamictrees:seasonal_seed_drop_chance" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dtatum/loot_tables/trees/voluntary/palm.json b/src/generated/resources/data/dtatum/loot_tables/trees/voluntary/palm.json new file mode 100644 index 0000000..bf13db5 --- /dev/null +++ b/src/generated/resources/data/dtatum/loot_tables/trees/voluntary/palm.json @@ -0,0 +1,20 @@ +{ + "type": "dynamictrees:voluntary", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "dynamictrees:voluntary_seed_drop_chance", + "rarity": 1.0 + } + ], + "name": "dtatum:palm_seed" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/tags/blocks/branches_that_burn.json b/src/generated/resources/data/dynamictrees/tags/blocks/branches_that_burn.json new file mode 100644 index 0000000..d12a554 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/tags/blocks/branches_that_burn.json @@ -0,0 +1,8 @@ +{ + "replace": false, + "values": [ + "dtatum:deadwood_branch", + "dtatum:dead_palm_branch", + "dtatum:palm_branch" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/tags/blocks/leaves.json b/src/generated/resources/data/dynamictrees/tags/blocks/leaves.json new file mode 100644 index 0000000..ba2ad1b --- /dev/null +++ b/src/generated/resources/data/dynamictrees/tags/blocks/leaves.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "dtatum:dry_leaves", + "dtatum:palm_leaves" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/tags/blocks/saplings.json b/src/generated/resources/data/dynamictrees/tags/blocks/saplings.json new file mode 100644 index 0000000..6cd5cc8 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/tags/blocks/saplings.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "dtatum:palm_sapling" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/tags/blocks/stripped_branches_that_burn.json b/src/generated/resources/data/dynamictrees/tags/blocks/stripped_branches_that_burn.json new file mode 100644 index 0000000..ef0e799 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/tags/blocks/stripped_branches_that_burn.json @@ -0,0 +1,8 @@ +{ + "replace": false, + "values": [ + "dtatum:stripped_deadwood_branch", + "dtatum:stripped_dead_palm_branch", + "dtatum:stripped_palm_branch" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/tags/items/branches_that_burn.json b/src/generated/resources/data/dynamictrees/tags/items/branches_that_burn.json new file mode 100644 index 0000000..d12a554 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/tags/items/branches_that_burn.json @@ -0,0 +1,8 @@ +{ + "replace": false, + "values": [ + "dtatum:deadwood_branch", + "dtatum:dead_palm_branch", + "dtatum:palm_branch" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/tags/items/seeds.json b/src/generated/resources/data/dynamictrees/tags/items/seeds.json new file mode 100644 index 0000000..8d535fd --- /dev/null +++ b/src/generated/resources/data/dynamictrees/tags/items/seeds.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "dtatum:palm_seed" + ] +} \ No newline at end of file diff --git a/src/main/java/maxhyper/dtatum/DynamicTreesAtum.java b/src/main/java/maxhyper/dtatum/DynamicTreesAtum.java index 339bc11..6ae7089 100644 --- a/src/main/java/maxhyper/dtatum/DynamicTreesAtum.java +++ b/src/main/java/maxhyper/dtatum/DynamicTreesAtum.java @@ -1,5 +1,6 @@ package maxhyper.dtatum; +import com.ferreusveritas.dynamictrees.api.GatherDataHelper; import com.ferreusveritas.dynamictrees.api.registry.RegistryHandler; import com.ferreusveritas.dynamictrees.init.DTRegistries; import com.ferreusveritas.dynamictrees.items.DendroPotion; @@ -13,6 +14,7 @@ import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; +import net.minecraftforge.fml.event.lifecycle.GatherDataEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; // The value here should match an entry in the META-INF/mods.toml file @@ -24,6 +26,7 @@ public class DynamicTreesAtum public DynamicTreesAtum() { FMLJavaModLoadingContext.get().getModEventBus().addListener(this::commonSetup); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup); + FMLJavaModLoadingContext.get().getModEventBus().addListener(this::gatherData); MinecraftForge.EVENT_BUS.register(this); @@ -46,4 +49,9 @@ private void clientSetup(final FMLClientSetupEvent event) { // do something that can only be done on the client } + private void gatherData(final GatherDataEvent event) { + GatherDataHelper.gatherTagData(MOD_ID, event); + GatherDataHelper.gatherLootData(MOD_ID, event); + } + } diff --git a/src/main/java/maxhyper/dtatum/blocks/PalmFruit.java b/src/main/java/maxhyper/dtatum/blocks/PalmFruit.java index 657fb0e..c01efb0 100644 --- a/src/main/java/maxhyper/dtatum/blocks/PalmFruit.java +++ b/src/main/java/maxhyper/dtatum/blocks/PalmFruit.java @@ -3,8 +3,18 @@ import com.ferreusveritas.dynamictrees.api.registry.TypedRegistry; import com.ferreusveritas.dynamictrees.blocks.FruitBlock; import com.ferreusveritas.dynamictrees.systems.fruit.Fruit; +import net.minecraft.advancements.criterion.StatePropertiesPredicate; import net.minecraft.block.AbstractBlock; import net.minecraft.block.BlockState; +import net.minecraft.loot.ConstantRange; +import net.minecraft.loot.ItemLootEntry; +import net.minecraft.loot.LootParameterSets; +import net.minecraft.loot.LootPool; +import net.minecraft.loot.LootTable; +import net.minecraft.loot.RandomValueRange; +import net.minecraft.loot.conditions.BlockStateProperty; +import net.minecraft.loot.functions.ExplosionDecay; +import net.minecraft.loot.functions.SetCount; import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; @@ -62,4 +72,22 @@ private BlockState getState(int age, Direction facing) { return getStateForAge(age).setValue(PalmFruitBlock.FACING, facing); } + @Override + public LootTable.Builder createBlockDrops() { + return LootTable.lootTable().withPool( + LootPool.lootPool().setRolls(ConstantRange.exactly(1)).add( + ItemLootEntry.lootTableItem(getItemStack().getItem()) + .when( + BlockStateProperty.hasBlockStateProperties(getBlock()) + .setProperties( + StatePropertiesPredicate.Builder.properties() + .hasProperty(getAgeProperty(), getMaxAge()) + ) + ) + .apply(SetCount.setCount(RandomValueRange.between(2.0F, 5.0F))) + .apply(ExplosionDecay.explosionDecay()) + ) + ).setParamSet(LootParameterSets.BLOCK); + } + } diff --git a/src/main/resources/trees/dtatum/leaves_properties/bare.json b/src/main/resources/trees/dtatum/leaves_properties/bare.json deleted file mode 100644 index cb60441..0000000 --- a/src/main/resources/trees/dtatum/leaves_properties/bare.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "generate_block": false, - "cell_kit": "dynamictrees:bare" -} \ No newline at end of file diff --git a/src/main/resources/trees/dtatum/species/deadwood.json b/src/main/resources/trees/dtatum/species/deadwood.json index 03eb044..7755146 100644 --- a/src/main/resources/trees/dtatum/species/deadwood.json +++ b/src/main/resources/trees/dtatum/species/deadwood.json @@ -5,7 +5,7 @@ "signal_energy": 10.0, "growth_rate": 0.0, "soil_longevity": 8, - "leaves_properties": "dtatum:bare", + "leaves_properties": "dynamictrees:bare", "generate_seed": false, "generate_sapling": false, "can_bone_meal_tree": false,