From db61a792b744298be6d22c3344059c26c622a06a Mon Sep 17 00:00:00 2001 From: Harleyoc1 Date: Wed, 29 Jun 2022 13:21:47 +0100 Subject: [PATCH 01/17] Switch drops to use loot tables --- src/generated/resources/.cache/cache | 47 +++ .../loot_tables/blocks/acacia_leaves.json | 131 ++++++++ .../loot_tables/blocks/apple_oak_leaves.json | 131 ++++++++ .../loot_tables/blocks/birch_leaves.json | 131 ++++++++ .../loot_tables/blocks/crimson_wart.json | 18 ++ .../loot_tables/blocks/dark_oak_leaves.json | 131 ++++++++ .../loot_tables/blocks/jungle_leaves.json | 132 +++++++++ .../loot_tables/blocks/mega_crimson_wart.json | 18 ++ .../loot_tables/blocks/mega_warped_wart.json | 18 ++ .../loot_tables/blocks/oak_leaves.json | 131 ++++++++ .../loot_tables/blocks/spruce_leaves.json | 131 ++++++++ .../loot_tables/blocks/warped_wart.json | 18 ++ .../loot_tables/trees/leaves/acacia.json | 67 +++++ .../loot_tables/trees/leaves/apple_oak.json | 67 +++++ .../loot_tables/trees/leaves/birch.json | 67 +++++ .../loot_tables/trees/leaves/crimson.json | 28 ++ .../loot_tables/trees/leaves/dark_oak.json | 67 +++++ .../loot_tables/trees/leaves/jungle.json | 68 +++++ .../trees/leaves/mega_crimson.json | 28 ++ .../loot_tables/trees/leaves/mega_warped.json | 28 ++ .../loot_tables/trees/leaves/oak.json | 67 +++++ .../loot_tables/trees/leaves/spruce.json | 67 +++++ .../loot_tables/trees/leaves/warped.json | 28 ++ .../loot_tables/trees/voluntary/acacia.json | 20 ++ .../trees/voluntary/apple_oak.json | 20 ++ .../loot_tables/trees/voluntary/birch.json | 20 ++ .../loot_tables/trees/voluntary/crimson.json | 20 ++ .../loot_tables/trees/voluntary/dark_oak.json | 20 ++ .../loot_tables/trees/voluntary/jungle.json | 20 ++ .../loot_tables/trees/voluntary/oak.json | 20 ++ .../loot_tables/trees/voluntary/spruce.json | 20 ++ .../loot_tables/trees/voluntary/warped.json | 20 ++ .../loot_tables/trees/wood/acacia_branch.json | 39 +++ .../loot_tables/trees/wood/birch_branch.json | 39 +++ .../trees/wood/crimson_branch.json | 39 +++ .../trees/wood/dark_oak_branch.json | 39 +++ .../loot_tables/trees/wood/jungle_branch.json | 39 +++ .../loot_tables/trees/wood/oak_branch.json | 39 +++ .../loot_tables/trees/wood/spruce_branch.json | 39 +++ .../trees/wood/stripped_acacia_branch.json | 39 +++ .../trees/wood/stripped_birch_branch.json | 39 +++ .../trees/wood/stripped_crimson_branch.json | 39 +++ .../trees/wood/stripped_dark_oak_branch.json | 39 +++ .../trees/wood/stripped_jungle_branch.json | 39 +++ .../trees/wood/stripped_oak_branch.json | 39 +++ .../trees/wood/stripped_spruce_branch.json | 39 +++ .../trees/wood/stripped_warped_branch.json | 39 +++ .../loot_tables/trees/wood/warped_branch.json | 39 +++ .../dynamictrees/DynamicTrees.java | 3 + .../dynamictrees/api/GatherDataHelper.java | 17 +- .../dynamictrees/api/TreeHelper.java | 4 + .../dynamictrees/api/TreeRegistry.java | 35 --- .../dynamictrees/api/registry/Registries.java | 2 - .../blocks/branches/BranchBlock.java | 91 +++--- .../blocks/leaves/DynamicLeavesBlock.java | 94 +++--- .../blocks/leaves/LeavesProperties.java | 16 +- .../blocks/leaves/SolidLeavesProperties.java | 2 +- .../blocks/leaves/WartProperties.java | 2 +- .../dynamictrees/data/DTLootParameters.java | 21 -- .../data/provider/DTLootTableProvider.java | 260 ++++++++++++++++ .../deserialisation/DropsDeserialiser.java | 52 ---- .../deserialisation/JsonDeserialisers.java | 15 - .../dynamictrees/init/DTRegistries.java | 7 - .../dynamictrees/loot/DTLoot.java | 19 ++ .../{data => loot}/DTLootParameterSets.java | 31 +- .../dynamictrees/loot/DTLootParameters.java | 23 ++ .../loot/condition/DTLootConditions.java | 27 ++ .../condition/SeasonalSeedDropChance.java | 46 +++ .../condition/VoluntarySeedDropChance.java | 54 ++++ .../loot/function/DTLootFunctions.java | 24 ++ .../loot/function/MultiplyLogsCount.java | 50 ++++ .../loot/function/MultiplySticksCount.java | 52 ++++ .../loot/function/package-info.java | 6 + .../dynamictrees/resources/Resources.java | 18 +- .../GlobalDropCreatorResourceLoader.java | 57 ---- .../LeavesPropertiesResourceLoader.java | 7 +- .../loader/SpeciesResourceLoader.java | 16 +- .../systems/dropcreators/DropCreator.java | 100 ------- .../DropCreatorConfiguration.java | 38 --- .../dropcreators/DropCreatorManager.java | 17 -- .../systems/dropcreators/DropCreators.java | 22 -- .../dropcreators/FruitDropCreator.java | 61 ---- .../dropcreators/GlobalDropCreators.java | 36 --- .../systems/dropcreators/LogDropCreator.java | 60 ---- .../dropcreators/LootTableDropCreator.java | 93 ------ .../dropcreators/NormalDropCreator.java | 70 ----- .../systems/dropcreators/SeedDropCreator.java | 102 ------- .../dropcreators/StickDropCreator.java | 72 ----- .../dropcreators/context/DropContext.java | 86 ------ .../dropcreators/context/LogDropContext.java | 27 -- .../systems/dropcreators/drops/Drops.java | 44 --- .../dropcreators/drops/StackDrops.java | 80 ----- .../dropcreators/drops/WeightedDrops.java | 108 ------- .../dynamictrees/trees/Family.java | 8 + .../dynamictrees/trees/Species.java | 279 ++++++++++++------ .../trees/species/NetherFungusSpecies.java | 24 +- .../dynamictrees/util/Optionals.java | 5 + .../dynamictrees/util/WorldContext.java | 11 + .../resources/META-INF/accesstransformer.cfg | 6 +- .../configurations/wart_block.json | 38 --- .../trees/dynamictrees/species/apple_oak.json | 10 - .../trees/dynamictrees/species/crimson.json | 9 - .../trees/dynamictrees/species/jungle.json | 5 +- .../dynamictrees/species/mega_crimson.json | 9 - .../dynamictrees/species/mega_jungle.json | 5 +- .../dynamictrees/species/mega_warped.json | 9 - .../trees/dynamictrees/species/swamp_oak.json | 4 - .../trees/dynamictrees/species/warped.json | 9 - 108 files changed, 3380 insertions(+), 1541 deletions(-) create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/blocks/acacia_leaves.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/blocks/apple_oak_leaves.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/blocks/birch_leaves.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/blocks/crimson_wart.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/blocks/dark_oak_leaves.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/blocks/jungle_leaves.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/blocks/mega_crimson_wart.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/blocks/mega_warped_wart.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/blocks/oak_leaves.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/blocks/spruce_leaves.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/blocks/warped_wart.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/acacia.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/apple_oak.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/birch.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/crimson.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/dark_oak.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/jungle.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/mega_crimson.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/mega_warped.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/oak.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/spruce.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/warped.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/acacia.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/apple_oak.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/birch.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/crimson.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/dark_oak.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/jungle.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/oak.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/spruce.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/warped.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/wood/acacia_branch.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/wood/birch_branch.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/wood/crimson_branch.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/wood/dark_oak_branch.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/wood/jungle_branch.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/wood/oak_branch.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/wood/spruce_branch.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_acacia_branch.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_birch_branch.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_crimson_branch.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_dark_oak_branch.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_jungle_branch.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_oak_branch.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_spruce_branch.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_warped_branch.json create mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/wood/warped_branch.json delete mode 100755 src/main/java/com/ferreusveritas/dynamictrees/data/DTLootParameters.java create mode 100644 src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java delete mode 100755 src/main/java/com/ferreusveritas/dynamictrees/deserialisation/DropsDeserialiser.java create mode 100644 src/main/java/com/ferreusveritas/dynamictrees/loot/DTLoot.java rename src/main/java/com/ferreusveritas/dynamictrees/{data => loot}/DTLootParameterSets.java (57%) create mode 100755 src/main/java/com/ferreusveritas/dynamictrees/loot/DTLootParameters.java create mode 100644 src/main/java/com/ferreusveritas/dynamictrees/loot/condition/DTLootConditions.java create mode 100644 src/main/java/com/ferreusveritas/dynamictrees/loot/condition/SeasonalSeedDropChance.java create mode 100644 src/main/java/com/ferreusveritas/dynamictrees/loot/condition/VoluntarySeedDropChance.java create mode 100644 src/main/java/com/ferreusveritas/dynamictrees/loot/function/DTLootFunctions.java create mode 100644 src/main/java/com/ferreusveritas/dynamictrees/loot/function/MultiplyLogsCount.java create mode 100644 src/main/java/com/ferreusveritas/dynamictrees/loot/function/MultiplySticksCount.java create mode 100755 src/main/java/com/ferreusveritas/dynamictrees/loot/function/package-info.java delete mode 100755 src/main/java/com/ferreusveritas/dynamictrees/resources/loader/GlobalDropCreatorResourceLoader.java delete mode 100755 src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/DropCreator.java delete mode 100755 src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/DropCreatorConfiguration.java delete mode 100755 src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/DropCreatorManager.java delete mode 100755 src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/DropCreators.java delete mode 100755 src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/FruitDropCreator.java delete mode 100755 src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/GlobalDropCreators.java delete mode 100755 src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/LogDropCreator.java delete mode 100755 src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/LootTableDropCreator.java delete mode 100755 src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/NormalDropCreator.java delete mode 100755 src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/SeedDropCreator.java delete mode 100755 src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/StickDropCreator.java delete mode 100755 src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/context/DropContext.java delete mode 100755 src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/context/LogDropContext.java delete mode 100755 src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/drops/Drops.java delete mode 100755 src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/drops/StackDrops.java delete mode 100755 src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/drops/WeightedDrops.java delete mode 100755 src/main/resources/trees/dynamictrees/drop_creators/configurations/wart_block.json diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index 2e207db98..c47e6f3f9 100755 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -93,6 +93,53 @@ e93499abbe31d9e789e29af06798a9caddc88e80 assets/dynamictrees/models/item/spruce_ 0a004b585c1035911f357ecaefec8799388a6d11 assets/dynamictrees/models/item/spruce_seed.json f19f3fb00967e33d24bce3ac224ebe952e5d3cd4 assets/dynamictrees/models/item/warped_branch.json 6f06586da567331dbe6251acb1aa1a554de5cfa6 assets/dynamictrees/models/item/warped_seed.json +bdec0fa1720c40635cd5afeb9ba320636d057622 data/dynamictrees/loot_tables/blocks/acacia_leaves.json +9ef4d821bef4ec97777a5e8093685d9f6d3e3610 data/dynamictrees/loot_tables/blocks/apple_oak_leaves.json +892b72b30628b59f463df230f07051c52eda4e5c data/dynamictrees/loot_tables/blocks/birch_leaves.json +2a9c0717ddf89f86514ef3e161f9679ccc7bee29 data/dynamictrees/loot_tables/blocks/crimson_wart.json +f6e09c5bb782791017bec235b559ea4a891c41c1 data/dynamictrees/loot_tables/blocks/dark_oak_leaves.json +4c4093a9951cfb7dfdf3789eff64965c9a535b53 data/dynamictrees/loot_tables/blocks/jungle_leaves.json +2a9c0717ddf89f86514ef3e161f9679ccc7bee29 data/dynamictrees/loot_tables/blocks/mega_crimson_wart.json +3b375ed7e64d3d6d18499bbc1af30e5cd931e134 data/dynamictrees/loot_tables/blocks/mega_warped_wart.json +c2dd639099208e56c8ca1e0f96175b6173d2773c data/dynamictrees/loot_tables/blocks/oak_leaves.json +95876b44b323509c4a9940fab4b1bb2d25a4df6c data/dynamictrees/loot_tables/blocks/spruce_leaves.json +3b375ed7e64d3d6d18499bbc1af30e5cd931e134 data/dynamictrees/loot_tables/blocks/warped_wart.json +c9b95dd9ca14ac6ae2ec8892a69e993580530fee data/dynamictrees/loot_tables/trees/leaves/acacia.json +f49afb7b939b90f15d5b7436abe620b0e6506e34 data/dynamictrees/loot_tables/trees/leaves/apple_oak.json +6e842c38a8ff6b27e327a164c288513d8db17de2 data/dynamictrees/loot_tables/trees/leaves/birch.json +1fa0122268c45577f8d382b8d8f54eab235c52cb data/dynamictrees/loot_tables/trees/leaves/crimson.json +160e6fb15a0103a7f3f6a0157127a64e1bd953c8 data/dynamictrees/loot_tables/trees/leaves/dark_oak.json +44ccf77081fffbbe08f71e51bbfe2844e790526a data/dynamictrees/loot_tables/trees/leaves/jungle.json +1fa0122268c45577f8d382b8d8f54eab235c52cb data/dynamictrees/loot_tables/trees/leaves/mega_crimson.json +ade396476908421578ad8a9d9136de4da8608e7f data/dynamictrees/loot_tables/trees/leaves/mega_warped.json +9a457e1a5aa178cc04745a29774da2c6f30008eb data/dynamictrees/loot_tables/trees/leaves/oak.json +b00039411d88b117f1deb32f092394562bbd631a data/dynamictrees/loot_tables/trees/leaves/spruce.json +ade396476908421578ad8a9d9136de4da8608e7f data/dynamictrees/loot_tables/trees/leaves/warped.json +1afd145bc713c49a951b1aae9e958436c1e01fad data/dynamictrees/loot_tables/trees/voluntary/acacia.json +f7155cfadea4513beea11b7af3a8b16595fc5966 data/dynamictrees/loot_tables/trees/voluntary/apple_oak.json +b1186b2561105d575573fe3e1f497d69e71bd203 data/dynamictrees/loot_tables/trees/voluntary/birch.json +23ea3e615349be1d7b98960270522ddbfa8726eb data/dynamictrees/loot_tables/trees/voluntary/crimson.json +0044b94fd9d64f48f71cb98bc5842fac4b965191 data/dynamictrees/loot_tables/trees/voluntary/dark_oak.json +fa15a74c9f4c6ef2938b746034851a694f447392 data/dynamictrees/loot_tables/trees/voluntary/jungle.json +07f2393576fd7a50b338e5b32a399d8915b6852d data/dynamictrees/loot_tables/trees/voluntary/oak.json +d9e9232eafa5e036c1377e88fef0531dadcf7b42 data/dynamictrees/loot_tables/trees/voluntary/spruce.json +a5e8677a389e452305c3cc65e80c68a2339055ac data/dynamictrees/loot_tables/trees/voluntary/warped.json +be3388ecbd798bf0df8cd7862dc79c9f45a8c8c5 data/dynamictrees/loot_tables/trees/wood/acacia_branch.json +c00f99909ab710b4a31eac1242b0c4c4934ae1bf data/dynamictrees/loot_tables/trees/wood/birch_branch.json +24b697736a6863c294e9e778c97209b341be0d74 data/dynamictrees/loot_tables/trees/wood/crimson_branch.json +1519e4854d652784f42e30260b458606892d9ad5 data/dynamictrees/loot_tables/trees/wood/dark_oak_branch.json +7188917f86ac919fb4b364b69d7672bbfc37d27b data/dynamictrees/loot_tables/trees/wood/jungle_branch.json +56066d6b7c25d89fb15108d42005256d4105d915 data/dynamictrees/loot_tables/trees/wood/oak_branch.json +85e2e42ca40169a5f0b380a2bd37007cff4281df data/dynamictrees/loot_tables/trees/wood/spruce_branch.json +3f24522fafc83716bfd064064b50465fe5076cea data/dynamictrees/loot_tables/trees/wood/stripped_acacia_branch.json +a0bb5f17afbb4b879d37113104677bb23531b417 data/dynamictrees/loot_tables/trees/wood/stripped_birch_branch.json +c687467279ba6185ff2af5cde9b1117e1c91a52b data/dynamictrees/loot_tables/trees/wood/stripped_crimson_branch.json +0088e48a01bbab6df258e2cb3f37ed1f470c374d data/dynamictrees/loot_tables/trees/wood/stripped_dark_oak_branch.json +c34594394aff4f4de62e50881bdccd88642e5d02 data/dynamictrees/loot_tables/trees/wood/stripped_jungle_branch.json +36633a38f3d715a39bba784c8042d395be10ddea data/dynamictrees/loot_tables/trees/wood/stripped_oak_branch.json +7c5297ec4778a708d8f60df95bd0fedd633369df data/dynamictrees/loot_tables/trees/wood/stripped_spruce_branch.json +451e3aec2ec906494c713fda7842a3c5c7bcec05 data/dynamictrees/loot_tables/trees/wood/stripped_warped_branch.json +30072bd0711325ef2b760f61946b31d0a919ebec data/dynamictrees/loot_tables/trees/wood/warped_branch.json 00f1155e3e23759f5c41ff23363ddabd828373eb data/dynamictrees/tags/blocks/branches.json 9cde27364783c31821c51da5ae452b6f642c8c06 data/dynamictrees/tags/blocks/branches_that_burn.json f0827e9841f3f418505af50a01fef5a1be47e0ec data/dynamictrees/tags/blocks/foliage.json diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/acacia_leaves.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/acacia_leaves.json new file mode 100644 index 000000000..12cb7e7d1 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/blocks/acacia_leaves.json @@ -0,0 +1,131 @@ +{ + "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": "minecraft:acacia_leaves" + }, + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.05, + 0.0625, + 0.083333336, + 0.1 + ] + }, + { + "condition": "dynamictrees:seasonal_seed_drop_chance" + } + ], + "name": "dynamictrees:acacia_seed" + } + ] + } + ] + }, + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.02, + 0.022222223, + 0.025, + 0.033333335, + 0.1 + ] + } + ], + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "min": 1.0, + "max": 2.0, + "type": "minecraft:uniform" + } + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stick" + } + ], + "conditions": [ + { + "condition": "minecraft:inverted", + "term": { + "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 + } + } + ] + } + } + ] + } + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/apple_oak_leaves.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/apple_oak_leaves.json new file mode 100644 index 000000000..5caae3945 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/blocks/apple_oak_leaves.json @@ -0,0 +1,131 @@ +{ + "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": "minecraft:oak_leaves" + }, + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.05, + 0.0625, + 0.083333336, + 0.1 + ] + }, + { + "condition": "dynamictrees:seasonal_seed_drop_chance" + } + ], + "name": "dynamictrees:apple_oak_seed" + } + ] + } + ] + }, + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.02, + 0.022222223, + 0.025, + 0.033333335, + 0.1 + ] + } + ], + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "min": 1.0, + "max": 2.0, + "type": "minecraft:uniform" + } + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stick" + } + ], + "conditions": [ + { + "condition": "minecraft:inverted", + "term": { + "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 + } + } + ] + } + } + ] + } + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/birch_leaves.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/birch_leaves.json new file mode 100644 index 000000000..a423985a8 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/blocks/birch_leaves.json @@ -0,0 +1,131 @@ +{ + "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": "minecraft:birch_leaves" + }, + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.05, + 0.0625, + 0.083333336, + 0.1 + ] + }, + { + "condition": "dynamictrees:seasonal_seed_drop_chance" + } + ], + "name": "dynamictrees:birch_seed" + } + ] + } + ] + }, + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.02, + 0.022222223, + 0.025, + 0.033333335, + 0.1 + ] + } + ], + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "min": 1.0, + "max": 2.0, + "type": "minecraft:uniform" + } + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stick" + } + ], + "conditions": [ + { + "condition": "minecraft:inverted", + "term": { + "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 + } + } + ] + } + } + ] + } + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/crimson_wart.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/crimson_wart.json new file mode 100644 index 000000000..2a09e336b --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/blocks/crimson_wart.json @@ -0,0 +1,18 @@ +{ + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:nether_wart_block" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/dark_oak_leaves.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/dark_oak_leaves.json new file mode 100644 index 000000000..070d62df4 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/blocks/dark_oak_leaves.json @@ -0,0 +1,131 @@ +{ + "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": "minecraft:dark_oak_leaves" + }, + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.05, + 0.0625, + 0.083333336, + 0.1 + ] + }, + { + "condition": "dynamictrees:seasonal_seed_drop_chance" + } + ], + "name": "dynamictrees:dark_oak_seed" + } + ] + } + ] + }, + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.02, + 0.022222223, + 0.025, + 0.033333335, + 0.1 + ] + } + ], + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "min": 1.0, + "max": 2.0, + "type": "minecraft:uniform" + } + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stick" + } + ], + "conditions": [ + { + "condition": "minecraft:inverted", + "term": { + "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 + } + } + ] + } + } + ] + } + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/jungle_leaves.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/jungle_leaves.json new file mode 100644 index 000000000..1bfdc8132 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/blocks/jungle_leaves.json @@ -0,0 +1,132 @@ +{ + "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": "minecraft:jungle_leaves" + }, + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.025, + 0.027777778, + 0.03125, + 0.041666668, + 0.1 + ] + }, + { + "condition": "dynamictrees:seasonal_seed_drop_chance" + } + ], + "name": "dynamictrees:jungle_seed" + } + ] + } + ] + }, + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.02, + 0.022222223, + 0.025, + 0.033333335, + 0.1 + ] + } + ], + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "min": 1.0, + "max": 2.0, + "type": "minecraft:uniform" + } + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stick" + } + ], + "conditions": [ + { + "condition": "minecraft:inverted", + "term": { + "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 + } + } + ] + } + } + ] + } + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/mega_crimson_wart.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/mega_crimson_wart.json new file mode 100644 index 000000000..2a09e336b --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/blocks/mega_crimson_wart.json @@ -0,0 +1,18 @@ +{ + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:nether_wart_block" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/mega_warped_wart.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/mega_warped_wart.json new file mode 100644 index 000000000..01e80b4cb --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/blocks/mega_warped_wart.json @@ -0,0 +1,18 @@ +{ + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:warped_wart_block" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/oak_leaves.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/oak_leaves.json new file mode 100644 index 000000000..10c0284bf --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/blocks/oak_leaves.json @@ -0,0 +1,131 @@ +{ + "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": "minecraft:oak_leaves" + }, + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.05, + 0.0625, + 0.083333336, + 0.1 + ] + }, + { + "condition": "dynamictrees:seasonal_seed_drop_chance" + } + ], + "name": "dynamictrees:oak_seed" + } + ] + } + ] + }, + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.02, + 0.022222223, + 0.025, + 0.033333335, + 0.1 + ] + } + ], + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "min": 1.0, + "max": 2.0, + "type": "minecraft:uniform" + } + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stick" + } + ], + "conditions": [ + { + "condition": "minecraft:inverted", + "term": { + "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 + } + } + ] + } + } + ] + } + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/spruce_leaves.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/spruce_leaves.json new file mode 100644 index 000000000..f3954c87e --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/blocks/spruce_leaves.json @@ -0,0 +1,131 @@ +{ + "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": "minecraft:spruce_leaves" + }, + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.05, + 0.0625, + 0.083333336, + 0.1 + ] + }, + { + "condition": "dynamictrees:seasonal_seed_drop_chance" + } + ], + "name": "dynamictrees:spruce_seed" + } + ] + } + ] + }, + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.02, + 0.022222223, + 0.025, + 0.033333335, + 0.1 + ] + } + ], + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "min": 1.0, + "max": 2.0, + "type": "minecraft:uniform" + } + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stick" + } + ], + "conditions": [ + { + "condition": "minecraft:inverted", + "term": { + "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 + } + } + ] + } + } + ] + } + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/warped_wart.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/warped_wart.json new file mode 100644 index 000000000..01e80b4cb --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/blocks/warped_wart.json @@ -0,0 +1,18 @@ +{ + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:warped_wart_block" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/acacia.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/acacia.json new file mode 100644 index 000000000..994217542 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/acacia.json @@ -0,0 +1,67 @@ +{ + "type": "dynamictrees:leaves", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.05, + 0.0625, + 0.083333336, + 0.1 + ] + }, + { + "condition": "dynamictrees:seasonal_seed_drop_chance" + } + ], + "name": "dynamictrees:acacia_seed" + } + ] + }, + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.02, + 0.022222223, + 0.025, + 0.033333335, + 0.1 + ] + } + ], + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "min": 1.0, + "max": 2.0, + "type": "minecraft:uniform" + } + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stick" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/apple_oak.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/apple_oak.json new file mode 100644 index 000000000..55d53a5e5 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/apple_oak.json @@ -0,0 +1,67 @@ +{ + "type": "dynamictrees:leaves", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.05, + 0.0625, + 0.083333336, + 0.1 + ] + }, + { + "condition": "dynamictrees:seasonal_seed_drop_chance" + } + ], + "name": "dynamictrees:apple_oak_seed" + } + ] + }, + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.02, + 0.022222223, + 0.025, + 0.033333335, + 0.1 + ] + } + ], + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "min": 1.0, + "max": 2.0, + "type": "minecraft:uniform" + } + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stick" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/birch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/birch.json new file mode 100644 index 000000000..b1aa8cb36 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/birch.json @@ -0,0 +1,67 @@ +{ + "type": "dynamictrees:leaves", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.05, + 0.0625, + 0.083333336, + 0.1 + ] + }, + { + "condition": "dynamictrees:seasonal_seed_drop_chance" + } + ], + "name": "dynamictrees:birch_seed" + } + ] + }, + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.02, + 0.022222223, + 0.025, + 0.033333335, + 0.1 + ] + } + ], + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "min": 1.0, + "max": 2.0, + "type": "minecraft:uniform" + } + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stick" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/crimson.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/crimson.json new file mode 100644 index 000000000..6292edd9a --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/crimson.json @@ -0,0 +1,28 @@ +{ + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:nether_wart_block" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.1, + 0.1333333, + 0.1666666, + 0.2 + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/dark_oak.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/dark_oak.json new file mode 100644 index 000000000..dff3bdbdd --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/dark_oak.json @@ -0,0 +1,67 @@ +{ + "type": "dynamictrees:leaves", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.05, + 0.0625, + 0.083333336, + 0.1 + ] + }, + { + "condition": "dynamictrees:seasonal_seed_drop_chance" + } + ], + "name": "dynamictrees:dark_oak_seed" + } + ] + }, + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.02, + 0.022222223, + 0.025, + 0.033333335, + 0.1 + ] + } + ], + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "min": 1.0, + "max": 2.0, + "type": "minecraft:uniform" + } + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stick" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/jungle.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/jungle.json new file mode 100644 index 000000000..ccff3811c --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/jungle.json @@ -0,0 +1,68 @@ +{ + "type": "dynamictrees:leaves", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.025, + 0.027777778, + 0.03125, + 0.041666668, + 0.1 + ] + }, + { + "condition": "dynamictrees:seasonal_seed_drop_chance" + } + ], + "name": "dynamictrees:jungle_seed" + } + ] + }, + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.02, + 0.022222223, + 0.025, + 0.033333335, + 0.1 + ] + } + ], + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "min": 1.0, + "max": 2.0, + "type": "minecraft:uniform" + } + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stick" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/mega_crimson.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/mega_crimson.json new file mode 100644 index 000000000..6292edd9a --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/mega_crimson.json @@ -0,0 +1,28 @@ +{ + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:nether_wart_block" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.1, + 0.1333333, + 0.1666666, + 0.2 + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/mega_warped.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/mega_warped.json new file mode 100644 index 000000000..3ac4f452e --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/mega_warped.json @@ -0,0 +1,28 @@ +{ + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:warped_wart_block" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.1, + 0.1333333, + 0.1666666, + 0.2 + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/oak.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/oak.json new file mode 100644 index 000000000..8cca306f9 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/oak.json @@ -0,0 +1,67 @@ +{ + "type": "dynamictrees:leaves", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.05, + 0.0625, + 0.083333336, + 0.1 + ] + }, + { + "condition": "dynamictrees:seasonal_seed_drop_chance" + } + ], + "name": "dynamictrees:oak_seed" + } + ] + }, + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.02, + 0.022222223, + 0.025, + 0.033333335, + 0.1 + ] + } + ], + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "min": 1.0, + "max": 2.0, + "type": "minecraft:uniform" + } + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stick" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/spruce.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/spruce.json new file mode 100644 index 000000000..042f90f57 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/spruce.json @@ -0,0 +1,67 @@ +{ + "type": "dynamictrees:leaves", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.05, + 0.0625, + 0.083333336, + 0.1 + ] + }, + { + "condition": "dynamictrees:seasonal_seed_drop_chance" + } + ], + "name": "dynamictrees:spruce_seed" + } + ] + }, + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.02, + 0.022222223, + 0.025, + 0.033333335, + 0.1 + ] + } + ], + "functions": [ + { + "function": "minecraft:set_count", + "count": { + "min": 1.0, + "max": 2.0, + "type": "minecraft:uniform" + } + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stick" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/warped.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/warped.json new file mode 100644 index 000000000..3ac4f452e --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/warped.json @@ -0,0 +1,28 @@ +{ + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "minecraft:warped_wart_block" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune", + "chances": [ + 0.1, + 0.1333333, + 0.1666666, + 0.2 + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/acacia.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/acacia.json new file mode 100644 index 000000000..f7d25409e --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/acacia.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": "dynamictrees:acacia_seed" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/apple_oak.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/apple_oak.json new file mode 100644 index 000000000..8d8a8d0fa --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/apple_oak.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": "dynamictrees:apple_oak_seed" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/birch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/birch.json new file mode 100644 index 000000000..2391d6a5a --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/birch.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": "dynamictrees:birch_seed" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/crimson.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/crimson.json new file mode 100644 index 000000000..1738120c0 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/crimson.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": "dynamictrees:crimson_seed" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/dark_oak.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/dark_oak.json new file mode 100644 index 000000000..aac125d26 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/dark_oak.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": "dynamictrees:dark_oak_seed" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/jungle.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/jungle.json new file mode 100644 index 000000000..19a98ec11 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/jungle.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": "dynamictrees:jungle_seed" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/oak.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/oak.json new file mode 100644 index 000000000..2d746c3fd --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/oak.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": "dynamictrees:oak_seed" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/spruce.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/spruce.json new file mode 100644 index 000000000..95a14ef67 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/spruce.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": "dynamictrees:spruce_seed" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/warped.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/warped.json new file mode 100644 index 000000000..cd1ab4614 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/warped.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": "dynamictrees:warped_seed" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/acacia_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/acacia_branch.json new file mode 100644 index 000000000..1b7e455c6 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/acacia_branch.json @@ -0,0 +1,39 @@ +{ + "type": "dynamictrees:wood", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "dynamictrees:multiply_logs_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:acacia_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/dynamictrees/loot_tables/trees/wood/birch_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/birch_branch.json new file mode 100644 index 000000000..2e9484f85 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/birch_branch.json @@ -0,0 +1,39 @@ +{ + "type": "dynamictrees:wood", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "dynamictrees:multiply_logs_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:birch_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/dynamictrees/loot_tables/trees/wood/crimson_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/crimson_branch.json new file mode 100644 index 000000000..2efc36d2a --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/crimson_branch.json @@ -0,0 +1,39 @@ +{ + "type": "dynamictrees:wood", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "dynamictrees:multiply_logs_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:crimson_stem" + } + ] + }, + { + "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/dynamictrees/loot_tables/trees/wood/dark_oak_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/dark_oak_branch.json new file mode 100644 index 000000000..3bf693667 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/dark_oak_branch.json @@ -0,0 +1,39 @@ +{ + "type": "dynamictrees:wood", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "dynamictrees:multiply_logs_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:dark_oak_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/dynamictrees/loot_tables/trees/wood/jungle_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/jungle_branch.json new file mode 100644 index 000000000..9c00944d0 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/jungle_branch.json @@ -0,0 +1,39 @@ +{ + "type": "dynamictrees:wood", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "dynamictrees:multiply_logs_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:jungle_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/dynamictrees/loot_tables/trees/wood/oak_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/oak_branch.json new file mode 100644 index 000000000..0cb89fb36 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/oak_branch.json @@ -0,0 +1,39 @@ +{ + "type": "dynamictrees:wood", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "dynamictrees:multiply_logs_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:oak_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/dynamictrees/loot_tables/trees/wood/spruce_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/spruce_branch.json new file mode 100644 index 000000000..536108733 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/spruce_branch.json @@ -0,0 +1,39 @@ +{ + "type": "dynamictrees:wood", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "dynamictrees:multiply_logs_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:spruce_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/dynamictrees/loot_tables/trees/wood/stripped_acacia_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_acacia_branch.json new file mode 100644 index 000000000..b45ef3099 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_acacia_branch.json @@ -0,0 +1,39 @@ +{ + "type": "dynamictrees:wood", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "dynamictrees:multiply_logs_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stripped_acacia_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/dynamictrees/loot_tables/trees/wood/stripped_birch_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_birch_branch.json new file mode 100644 index 000000000..98582adea --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_birch_branch.json @@ -0,0 +1,39 @@ +{ + "type": "dynamictrees:wood", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "dynamictrees:multiply_logs_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stripped_birch_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/dynamictrees/loot_tables/trees/wood/stripped_crimson_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_crimson_branch.json new file mode 100644 index 000000000..82302c5c3 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_crimson_branch.json @@ -0,0 +1,39 @@ +{ + "type": "dynamictrees:wood", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "dynamictrees:multiply_logs_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stripped_crimson_stem" + } + ] + }, + { + "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/dynamictrees/loot_tables/trees/wood/stripped_dark_oak_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_dark_oak_branch.json new file mode 100644 index 000000000..350ef89c4 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_dark_oak_branch.json @@ -0,0 +1,39 @@ +{ + "type": "dynamictrees:wood", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "dynamictrees:multiply_logs_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stripped_dark_oak_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/dynamictrees/loot_tables/trees/wood/stripped_jungle_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_jungle_branch.json new file mode 100644 index 000000000..0f19713f3 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_jungle_branch.json @@ -0,0 +1,39 @@ +{ + "type": "dynamictrees:wood", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "dynamictrees:multiply_logs_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stripped_jungle_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/dynamictrees/loot_tables/trees/wood/stripped_oak_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_oak_branch.json new file mode 100644 index 000000000..31b495dd1 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_oak_branch.json @@ -0,0 +1,39 @@ +{ + "type": "dynamictrees:wood", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "dynamictrees:multiply_logs_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stripped_oak_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/dynamictrees/loot_tables/trees/wood/stripped_spruce_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_spruce_branch.json new file mode 100644 index 000000000..2e89d3051 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_spruce_branch.json @@ -0,0 +1,39 @@ +{ + "type": "dynamictrees:wood", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "dynamictrees:multiply_logs_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stripped_spruce_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/dynamictrees/loot_tables/trees/wood/stripped_warped_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_warped_branch.json new file mode 100644 index 000000000..690affec4 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_warped_branch.json @@ -0,0 +1,39 @@ +{ + "type": "dynamictrees:wood", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "dynamictrees:multiply_logs_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stripped_warped_stem" + } + ] + }, + { + "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/dynamictrees/loot_tables/trees/wood/warped_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/warped_branch.json new file mode 100644 index 000000000..c209dc0e2 --- /dev/null +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/warped_branch.json @@ -0,0 +1,39 @@ +{ + "type": "dynamictrees:wood", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "functions": [ + { + "function": "dynamictrees:multiply_logs_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:warped_stem" + } + ] + }, + { + "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/main/java/com/ferreusveritas/dynamictrees/DynamicTrees.java b/src/main/java/com/ferreusveritas/dynamictrees/DynamicTrees.java index e8bda5b41..18198f67b 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/DynamicTrees.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/DynamicTrees.java @@ -11,6 +11,7 @@ import com.ferreusveritas.dynamictrees.init.DTConfigs; import com.ferreusveritas.dynamictrees.init.DTRegistries; import com.ferreusveritas.dynamictrees.init.DTTrees; +import com.ferreusveritas.dynamictrees.loot.DTLoot; import com.ferreusveritas.dynamictrees.resources.Resources; import com.ferreusveritas.dynamictrees.trees.Family; import com.ferreusveritas.dynamictrees.trees.Species; @@ -89,6 +90,8 @@ public DynamicTrees() { EventHandlers.registerCommon(); CompatHandler.registerBuiltInSeasonManagers(); + + DTLoot.load(); } private void clientSetup(final FMLClientSetupEvent event) { diff --git a/src/main/java/com/ferreusveritas/dynamictrees/api/GatherDataHelper.java b/src/main/java/com/ferreusveritas/dynamictrees/api/GatherDataHelper.java index fe4c8c254..493c279c8 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/api/GatherDataHelper.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/api/GatherDataHelper.java @@ -5,6 +5,7 @@ import com.ferreusveritas.dynamictrees.data.provider.DTBlockTagsProvider; import com.ferreusveritas.dynamictrees.data.provider.DTItemModelProvider; import com.ferreusveritas.dynamictrees.data.provider.DTItemTagsProvider; +import com.ferreusveritas.dynamictrees.data.provider.DTLootTableProvider; import net.minecraft.data.DataGenerator; import net.minecraftforge.fml.event.lifecycle.GatherDataEvent; @@ -19,19 +20,23 @@ public static void gatherAllData(final String modId, final GatherDataEvent event gatherTagData(modId, event); gatherBlockStateAndModelData(modId, event, registries); gatherItemModelData(modId, event, registries); + gatherLootData(modId, event); } public static void gatherTagData(final String modId, final GatherDataEvent event) { final DataGenerator generator = event.getGenerator(); - final DTBlockTagsProvider blockTagsProvider = new DTBlockTagsProvider(generator, modId, event.getExistingFileHelper()); - final DTItemTagsProvider itemTagsProvider = new DTItemTagsProvider(generator, modId, blockTagsProvider, event.getExistingFileHelper()); + final DTBlockTagsProvider blockTagsProvider = + new DTBlockTagsProvider(generator, modId, event.getExistingFileHelper()); + final DTItemTagsProvider itemTagsProvider = + new DTItemTagsProvider(generator, modId, blockTagsProvider, event.getExistingFileHelper()); generator.addProvider(blockTagsProvider); generator.addProvider(itemTagsProvider); } - public static void gatherBlockStateAndModelData(final String modId, final GatherDataEvent event, Registry... registries) { + public static void gatherBlockStateAndModelData(final String modId, final GatherDataEvent event, + Registry... registries) { event.getGenerator().addProvider(new DTBlockStateProvider(event.getGenerator(), modId, event.getExistingFileHelper(), Arrays.asList(registries))); } @@ -41,4 +46,10 @@ public static void gatherItemModelData(final String modId, final GatherDataEvent event.getExistingFileHelper(), Arrays.asList(registries))); } + public static void gatherLootData(final String modId, final GatherDataEvent event) { + event.getGenerator().addProvider(new DTLootTableProvider( + event.getGenerator(), modId, event.getExistingFileHelper() + )); + } + } diff --git a/src/main/java/com/ferreusveritas/dynamictrees/api/TreeHelper.java b/src/main/java/com/ferreusveritas/dynamictrees/api/TreeHelper.java index 1c0ed1239..194605378 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/api/TreeHelper.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/api/TreeHelper.java @@ -381,6 +381,10 @@ public static DynamicLeavesBlock getLeaves(BlockState state) { return getLeaves(state.getBlock()); } + public static Optional getLeavesOpt(BlockState state) { + return Optional.ofNullable(getLeaves(state.getBlock())); + } + //Rooty public static boolean isRooty(Block block) { diff --git a/src/main/java/com/ferreusveritas/dynamictrees/api/TreeRegistry.java b/src/main/java/com/ferreusveritas/dynamictrees/api/TreeRegistry.java index 4961acf20..18b7dbf03 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/api/TreeRegistry.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/api/TreeRegistry.java @@ -7,8 +7,6 @@ import com.ferreusveritas.dynamictrees.init.DTTrees; import com.ferreusveritas.dynamictrees.items.DendroPotion; import com.ferreusveritas.dynamictrees.items.Seed; -import com.ferreusveritas.dynamictrees.systems.dropcreators.DropCreatorConfiguration; -import com.ferreusveritas.dynamictrees.systems.dropcreators.GlobalDropCreators; import com.ferreusveritas.dynamictrees.trees.Species; import net.minecraft.block.BlockState; import net.minecraft.util.ResourceLocation; @@ -118,39 +116,6 @@ public static void registerSaplingReplacer(BlockState state, Species species) { SAPLING_REPLACERS.put(state, species); } - ////////////////////////////// - // DROP HANDLING - ////////////////////////////// - - public static final ResourceLocation GLOBAL = DynamicTrees.resLoc("global"); - - /** - * This exists so that mods not interested in making Dynamic Trees can still add drops to all trees. - * - * @param configuration the drop creator configuration to register - */ - public static boolean registerDropCreator(final ResourceLocation speciesName, - final DropCreatorConfiguration configuration) { - return findSpecies(speciesName).addDropCreators(configuration); - } - - public static void registerGlobalDropCreator(final ResourceLocation registryName, - final DropCreatorConfiguration configuration) { - GlobalDropCreators.put(registryName, configuration); - } - - public static boolean removeDropCreators(final ResourceLocation speciesName, - final ResourceLocation dropCreatorName) { - return findSpecies(speciesName).removeDropCreator(dropCreatorName); - } - - public static Map> getDropCreatorsMap() { - final Map> dir = new HashMap<>(); - dir.put(GLOBAL, GlobalDropCreators.getAll()); - Species.REGISTRY.forEach(species -> dir.put(species.getRegistryName(), species.getDropCreators())); - return dir; - } - ////////////////////////////// // CELL KIT HANDLING ////////////////////////////// diff --git a/src/main/java/com/ferreusveritas/dynamictrees/api/registry/Registries.java b/src/main/java/com/ferreusveritas/dynamictrees/api/registry/Registries.java index 5c4d518cf..8336616ee 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/api/registry/Registries.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/api/registry/Registries.java @@ -4,7 +4,6 @@ import com.ferreusveritas.dynamictrees.blocks.leaves.LeavesProperties; import com.ferreusveritas.dynamictrees.blocks.rootyblocks.SoilProperties; import com.ferreusveritas.dynamictrees.growthlogic.GrowthLogicKit; -import com.ferreusveritas.dynamictrees.systems.dropcreators.DropCreator; import com.ferreusveritas.dynamictrees.systems.fruit.Fruit; import com.ferreusveritas.dynamictrees.systems.genfeatures.GenFeature; import com.ferreusveritas.dynamictrees.systems.pod.Pod; @@ -30,7 +29,6 @@ public final class Registries { GrowthLogicKit.REGISTRY, Family.REGISTRY, GenFeature.REGISTRY, - DropCreator.REGISTRY, Fruit.REGISTRY, Pod.REGISTRY, Species.REGISTRY, diff --git a/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BranchBlock.java b/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BranchBlock.java index c5fff063b..9249b1fba 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BranchBlock.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BranchBlock.java @@ -7,20 +7,24 @@ import com.ferreusveritas.dynamictrees.api.treedata.TreePart; import com.ferreusveritas.dynamictrees.blocks.BlockWithDynamicHardness; import com.ferreusveritas.dynamictrees.blocks.leaves.DynamicLeavesBlock; +import com.ferreusveritas.dynamictrees.data.provider.DTLootTableProvider; import com.ferreusveritas.dynamictrees.entities.FallingTreeEntity; import com.ferreusveritas.dynamictrees.entities.FallingTreeEntity.DestroyType; import com.ferreusveritas.dynamictrees.event.FutureBreak; import com.ferreusveritas.dynamictrees.init.DTConfigs; -import com.ferreusveritas.dynamictrees.systems.dropcreators.DropCreator; -import com.ferreusveritas.dynamictrees.systems.dropcreators.context.DropContext; -import com.ferreusveritas.dynamictrees.systems.dropcreators.context.LogDropContext; import com.ferreusveritas.dynamictrees.systems.nodemappers.DestroyerNode; import com.ferreusveritas.dynamictrees.systems.nodemappers.NetVolumeNode; import com.ferreusveritas.dynamictrees.systems.nodemappers.SpeciesNode; import com.ferreusveritas.dynamictrees.systems.nodemappers.StateNode; import com.ferreusveritas.dynamictrees.trees.Family; import com.ferreusveritas.dynamictrees.trees.Species; -import com.ferreusveritas.dynamictrees.util.*; +import com.ferreusveritas.dynamictrees.util.BlockBounds; +import com.ferreusveritas.dynamictrees.util.BlockStates; +import com.ferreusveritas.dynamictrees.util.BranchDestructionData; +import com.ferreusveritas.dynamictrees.util.Connections; +import com.ferreusveritas.dynamictrees.util.LazyValue; +import com.ferreusveritas.dynamictrees.util.ResourceLocationUtils; +import com.ferreusveritas.dynamictrees.util.SimpleVoxmap; import com.ferreusveritas.dynamictrees.util.SimpleVoxmap.Cell; import net.minecraft.block.Block; import net.minecraft.block.BlockRenderType; @@ -35,21 +39,35 @@ import net.minecraft.fluid.FluidState; import net.minecraft.item.AxeItem; import net.minecraft.item.ItemStack; +import net.minecraft.loot.LootTable; import net.minecraft.pathfinding.PathType; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ActionResultType; import net.minecraft.util.Direction; import net.minecraft.util.Hand; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.*; +import net.minecraft.util.math.RayTraceContext; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.world.*; +import net.minecraft.world.Explosion; +import net.minecraft.world.IBlockDisplayReader; +import net.minecraft.world.IBlockReader; +import net.minecraft.world.IWorld; +import net.minecraft.world.World; import net.minecraftforge.common.ForgeMod; import net.minecraftforge.common.ToolType; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Random; import java.util.stream.Collectors; @SuppressWarnings("deprecation") @@ -353,7 +371,8 @@ public BranchDestructionData destroyBranchFromNode(World world, BlockPos cutPos, List endPoints = destroyer.getEnds(); final Map destroyedLeaves = new HashMap<>(); final List leavesDropsList = new ArrayList<>(); - this.destroyLeaves(world, cutPos, species, endPoints, destroyedLeaves, leavesDropsList); + this.destroyLeaves(world, cutPos, species, entity == null ? ItemStack.EMPTY : entity.getMainHandItem(), + endPoints, destroyedLeaves, leavesDropsList); endPoints = endPoints.stream().map(p -> p.subtract(cutPos)).collect(Collectors.toList()); // Calculate main trunk height. @@ -391,13 +410,15 @@ public void rot(IWorld world, BlockPos pos) { * @param world The {@link World} instance. * @param cutPos The {@link BlockPos} of the {@link Block} that was initially destroyed. * @param species The {@link Species} of the tree that being modified. + * @param tool the tool used to fell the tree, or {@link net.minecraft.item.ItemStack#EMPTY} if it was + * done by hand or not destroyed by an entity * @param endPoints A {@link List} of absolute {@link BlockPos} {@link Object}s of the branch endpoints. * @param destroyedLeaves A {@link Map} for collecting the {@link BlockPos} and {@link BlockState}s for all of the * {@link DynamicLeavesBlock} that are destroyed. * @param drops A {@link List} for collecting the {@link ItemStack}s and their {@link BlockPos} relative * to the cut {@link BlockPos}. */ - public void destroyLeaves(final World world, final BlockPos cutPos, final Species species, + public void destroyLeaves(final World world, final BlockPos cutPos, final Species species, final ItemStack tool, final List endPoints, final Map destroyedLeaves, final List drops) { if (world.isClientSide || endPoints.isEmpty()) { @@ -445,10 +466,7 @@ public void destroyLeaves(final World world, final BlockPos cutPos, final Specie final BlockState blockState = world.getBlockState(pos); if (family.isCompatibleGenericLeaves(species, blockState, world, pos)) { dropList.clear(); - species.getDrops( - DropCreator.Type.HARVEST, - new DropContext(world, pos, species, dropList) - ); + dropList.addAll(species.getLeavesDrops(world, pos, tool)); final BlockPos imPos = pos.immutable(); // We are storing this so it must be immutable final BlockPos relPos = imPos.subtract(cutPos); world.setBlock(imPos, BlockStates.AIR, 3); @@ -466,17 +484,15 @@ public boolean canFall() { // DROPS AND HARVESTING /////////////////////////////////////////// - public List getLogDrops(World world, BlockPos pos, Species species, NetVolumeNode.Volume volume) { - return this.getLogDrops(world, pos, species, volume, ItemStack.EMPTY); + private final LazyValue lootTableName = + LazyValue.supplied(() -> ResourceLocationUtils.prefix(getRegistryName(), "trees/wood/")); + + public ResourceLocation getLootTableName() { + return lootTableName.get(); } - public List getLogDrops(World world, BlockPos pos, Species species, NetVolumeNode.Volume volume, - ItemStack handStack) { - volume.multiplyVolume(DTConfigs.TREE_HARVEST_MULTIPLIER.get()); // For cheaters.. you know who you are. - return species.getDrops( - DropCreator.Type.LOGS, - new LogDropContext(world, pos, species, new ArrayList<>(), volume, handStack) - ); + public LootTable.Builder createBranchDrops() { + return DTLootTableProvider.createBranchDrops(getPrimitiveLog().get(), family.getStick(1).getItem()); } public float getPrimitiveLogs(float volumeIn, List drops) { @@ -521,16 +537,10 @@ public void futureBreak(BlockState state, World world, BlockPos cutPos, LivingEn final NetVolumeNode.Volume woodVolume = destroyData.woodVolume; // The amount of wood calculated from the body of the tree network. woodVolume.multiplyVolume(fortuneFactor); - final List woodItems = getLogDrops(world, cutPos, destroyData.species, woodVolume, heldItem); - - final float chance = 1.0f; - - // Build the final wood drop list taking chance into consideration. - final List woodDropList = - woodItems.stream().filter(i -> world.random.nextFloat() <= chance).collect(Collectors.toList()); + final List woodItems = destroyData.species.getWoodDrops(world, cutPos, woodVolume, heldItem); // Drop the FallingTreeEntity into the world. - FallingTreeEntity.dropTree(world, destroyData, woodDropList, DestroyType.HARVEST); + FallingTreeEntity.dropTree(world, destroyData, woodItems, DestroyType.HARVEST); // Damage the axe by a prescribed amount. this.damageAxe(entity, heldItem, this.getRadius(state), woodVolume, true); @@ -546,8 +556,9 @@ public void futureBreak(BlockState state, World world, BlockPos cutPos, LivingEn * @param world The {@link World} instance. * @param pos The {@link BlockPos} of the {@link Block} removed. * @param player The {@link PlayerEntity} damaging the {@link Block}, or {@code null}. - * @param willHarvest {@code true} if {@link #playerDestroy(World, PlayerEntity, BlockPos, BlockState, TileEntity, - * ItemStack)} will be called after this, if the return is {@code true}. + * @param willHarvest {@code true} if + * {@link #playerDestroy(World, PlayerEntity, BlockPos, BlockState, TileEntity, ItemStack)} will + * be called after this, if the return is {@code true}. * @param fluid The current {@link FluidState} for the position in the {@link World}. * @return {@code true} if {@link #destroy(IWorld, BlockPos, BlockState)} should be called; {@code false} otherwise. */ @@ -568,8 +579,7 @@ protected void sloppyBreak(World world, BlockPos cutPos, DestroyType destroyType this.destroyBranchFromNode(world, cutPos, Direction.DOWN, false, null); // Get all of the wood drops. - final List woodDropList = - this.getLogDrops(world, cutPos, destroyData.species, destroyData.woodVolume); + final List woodDropList = destroyData.species.getWoodDrops(world, cutPos, destroyData.woodVolume); // If sloppy break drops are off clear all drops. if (!DTConfigs.SLOPPY_BREAK_DROPS.get()) { @@ -715,9 +725,9 @@ public void breakDeliberate(IWorld world, BlockPos pos, DynamicTrees.DestroyMode } /** - * Gets the {@link PushReaction} for this {@link Block}. By default, {@link BranchBlock}s use {@link - * PushReaction#BLOCK} in order to prevent tree branches from being pushed by a piston. This is done for reasons - * that should be obvious if you are paying any attention. + * Gets the {@link PushReaction} for this {@link Block}. By default, {@link BranchBlock}s use + * {@link PushReaction#BLOCK} in order to prevent tree branches from being pushed by a piston. This is done for + * reasons that should be obvious if you are paying any attention. * * @param state The {@link BlockState} of the {@link BranchBlock}. * @return {@link PushReaction#BLOCK} to prevent {@link BranchBlock}s being pushed. @@ -745,7 +755,8 @@ public void onBlockExploded(BlockState state, World world, BlockPos pos, Explosi final Species species = TreeHelper.getExactSpecies(world, pos); final BranchDestructionData destroyData = destroyBranchFromNode(world, pos, Direction.DOWN, false, null); final NetVolumeNode.Volume woodVolume = destroyData.woodVolume; - final List woodDropList = getLogDrops(world, pos, species, woodVolume); + final List woodDropList = + species.getWoodDrops(world, pos, woodVolume, ItemStack.EMPTY, explosion.radius); final FallingTreeEntity treeEntity = FallingTreeEntity.dropTree(world, destroyData, woodDropList, DestroyType.BLAST); @@ -767,4 +778,8 @@ public final TreePartType getTreePartType() { return TreePartType.BRANCH; } + public boolean shouldGenerateBranchDrops() { + return getPrimitiveLog().isPresent(); + } + } diff --git a/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/DynamicLeavesBlock.java b/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/DynamicLeavesBlock.java index 41daf0384..ed30aad6f 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/DynamicLeavesBlock.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/DynamicLeavesBlock.java @@ -3,26 +3,30 @@ import com.ferreusveritas.dynamictrees.DynamicTrees; import com.ferreusveritas.dynamictrees.api.Ageable; import com.ferreusveritas.dynamictrees.api.TreeHelper; -import com.ferreusveritas.dynamictrees.api.cells.CellNull; import com.ferreusveritas.dynamictrees.api.cells.Cell; +import com.ferreusveritas.dynamictrees.api.cells.CellNull; import com.ferreusveritas.dynamictrees.api.network.MapSignal; import com.ferreusveritas.dynamictrees.api.treedata.TreePart; import com.ferreusveritas.dynamictrees.blocks.branches.BranchBlock; import com.ferreusveritas.dynamictrees.init.DTClient; import com.ferreusveritas.dynamictrees.init.DTConfigs; import com.ferreusveritas.dynamictrees.items.Seed; +import com.ferreusveritas.dynamictrees.loot.DTLootParameterSets; +import com.ferreusveritas.dynamictrees.loot.DTLootParameters; import com.ferreusveritas.dynamictrees.systems.GrowSignal; -import com.ferreusveritas.dynamictrees.systems.dropcreators.DropCreator; -import com.ferreusveritas.dynamictrees.systems.dropcreators.context.DropContext; import com.ferreusveritas.dynamictrees.trees.Family; import com.ferreusveritas.dynamictrees.trees.Species; import com.ferreusveritas.dynamictrees.util.RayTraceCollision; import com.ferreusveritas.dynamictrees.util.SafeChunkBounds; -import com.ferreusveritas.dynamictrees.util.ToolTypes; -import net.minecraft.block.*; +import com.ferreusveritas.dynamictrees.util.WorldContext; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.block.DoublePlantBlock; +import net.minecraft.block.FlowingFluidBlock; +import net.minecraft.block.LeavesBlock; +import net.minecraft.block.SoundType; import net.minecraft.block.material.PushReaction; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.enchantment.Enchantments; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.item.ItemEntity; @@ -30,14 +34,16 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.projectile.ProjectileEntity; import net.minecraft.item.BlockItemUseContext; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.item.ShearsItem; import net.minecraft.loot.LootContext; +import net.minecraft.loot.LootParameterSets; import net.minecraft.loot.LootParameters; +import net.minecraft.loot.LootTable; +import net.minecraft.loot.LootTables; import net.minecraft.state.StateContainer; import net.minecraft.state.properties.DoubleBlockHalf; import net.minecraft.util.Direction; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; @@ -52,12 +58,14 @@ import net.minecraft.world.LightType; import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; -import net.minecraftforge.common.ToolType; import net.minecraftforge.fml.ModList; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Random; @SuppressWarnings("deprecation") public class DynamicLeavesBlock extends LeavesBlock implements TreePart, Ageable, RayTraceCollision { @@ -581,7 +589,7 @@ public boolean canHarvestBlock(BlockState state, IBlockReader world, BlockPos po @Override public boolean isShearable(@Nonnull ItemStack item, World world, BlockPos pos) { - return this.getProperties(world.getBlockState(pos)).doRequireShears(); + return this.getProperties(world.getBlockState(pos)).canBeSheared(); } @Override @@ -604,51 +612,33 @@ public List getDrops(@Nullable PlayerEntity player, ItemStack item, W return new ArrayList<>(Collections.singletonList(this.getProperties(world.getBlockState(pos)).getPrimitiveLeavesItemStack())); } - public boolean shouldDrop(BlockState state, IBlockReader world, BlockPos pos, PlayerEntity player) { - final ItemStack stack = player.getMainHandItem(); - final Item item = stack.getItem(); - - // If the tool has silktouch, drop the block - if (EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, stack) > 0) { - return true; - } - - // Since shears don't have a ToolType, requireShears acts as an override for shears not extending ShearsItem. - if (this.getProperties(state).doRequireShears()) { - return item instanceof ShearsItem || item.getToolTypes(stack).contains(ToolTypes.SHEARS); - } - - final ToolType harvestTool = this.getHarvestTool(state); - return harvestTool != null && item.getToolTypes(stack).contains(harvestTool); - } - @Override public List getDrops(BlockState state, LootContext.Builder builder) { - // If a loot table has been added load those drops instead (until drop creators). - if (builder.getLevel().getServer().getLootTables().getIds().contains(this.getLootTable())) { - return super.getDrops(state, builder); - } - - final List ret = new ArrayList<>(); - final Entity entity = builder.getOptionalParameter(LootParameters.THIS_ENTITY); - final PlayerEntity player = entity instanceof PlayerEntity ? (PlayerEntity) entity : null; - final Vector3d builderPos = builder.getOptionalParameter(LootParameters.ORIGIN); - final BlockPos builderBlockPos = new BlockPos(builderPos.x(), builderPos.y(), builderPos.z()); + final Vector3d originPos = builder.getOptionalParameter(LootParameters.ORIGIN); + final ResourceLocation lootTableName; + Species species = Species.NULL_SPECIES; + BlockPos pos = BlockPos.ZERO; - int fortuneLevel = 0; - - if (player != null && this.shouldDrop(state, builder.getLevel(), builderBlockPos, player)) { - return this.getDrops(player, player.getMainHandItem(), builder.getLevel(), builderBlockPos, - EnchantmentHelper.getItemEnchantmentLevel(Enchantments.BLOCK_FORTUNE, player.getMainHandItem())); + if (originPos == null) { + lootTableName = getLootTable(); + } else { + pos = new BlockPos(originPos.x(), originPos.y(), originPos.z()); + species = getExactSpecies(builder.getLevel(), pos, getProperties(state)); + lootTableName = species.getLeavesBlockDropsPath(); } - final Species species = this.getExactSpecies(builder.getLevel(), builderBlockPos, getProperties(state)); - return species.getDrops( - DropCreator.Type.LEAVES, - new DropContext(builder.getLevel(), builderBlockPos, species, ret, - Optional.ofNullable(builder.getOptionalParameter(LootParameters.TOOL)).orElse(ItemStack.EMPTY), - -1, fortuneLevel) - ); + if (lootTableName == LootTables.EMPTY) { + return Collections.emptyList(); + } else { + ServerWorld world = builder.getLevel(); + LootContext context = builder + .withParameter(LootParameters.BLOCK_STATE, state) + .withParameter(DTLootParameters.SEASONAL_SEED_DROP_FACTOR, + species.seasonalSeedDropFactor(WorldContext.create(world), pos)) + .create(LootParameterSets.BLOCK); + LootTable table = world.getServer().getLootTables().get(lootTableName); + return table.getRandomItems(context); + } } /** diff --git a/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/LeavesProperties.java b/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/LeavesProperties.java index 953cf9223..883f22b11 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/LeavesProperties.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/LeavesProperties.java @@ -12,9 +12,11 @@ import com.ferreusveritas.dynamictrees.data.DTBlockTags; import com.ferreusveritas.dynamictrees.data.provider.DTBlockStateProvider; import com.ferreusveritas.dynamictrees.init.DTTrees; +import com.ferreusveritas.dynamictrees.loot.DTLootParameterSets; import com.ferreusveritas.dynamictrees.resources.Resources; import com.ferreusveritas.dynamictrees.trees.Family; import com.ferreusveritas.dynamictrees.trees.Resettable; +import com.ferreusveritas.dynamictrees.trees.Species; import com.ferreusveritas.dynamictrees.util.*; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; @@ -27,6 +29,8 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.ShearsItem; +import net.minecraft.loot.LootContext; +import net.minecraft.loot.LootParameters; import net.minecraft.tags.ITag; import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; @@ -160,7 +164,7 @@ public boolean updateTick(World worldIn, BlockPos pos, BlockState state, Random * A shears {@link ToolType} doesn't exist by default, so we use this as a backup for shears extending * {@link ShearsItem} but not registering a shears tool type. */ - protected boolean requiresShears = true; + protected boolean canBeSheared = true; private LeavesProperties() { } @@ -250,7 +254,7 @@ public LeavesProperties setBlockRegistryName(ResourceLocation blockRegistryName) * * @return A default suffix for {@link #blockRegistryName}. */ - protected String getBlockRegistryNameSuffix() { + public String getBlockRegistryNameSuffix() { return "_leaves"; } @@ -480,12 +484,12 @@ public int getRadiusForConnection(BlockState state, IBlockReader blockAccess, Bl return (fromRadius == twigRadius || this.connectAnyRadius) && from.getFamily().isCompatibleDynamicLeaves(from.getFamily().getCommonSpecies(), blockAccess.getBlockState(pos), blockAccess, pos) ? twigRadius : 0; } - public boolean doRequireShears() { - return requiresShears; + public boolean canBeSheared() { + return canBeSheared; } - public void setRequiresShears(boolean requiresShears) { - this.requiresShears = requiresShears; + public void setCanBeSheared(boolean canBeSheared) { + this.canBeSheared = canBeSheared; } public List> defaultLeavesTags() { diff --git a/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/SolidLeavesProperties.java b/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/SolidLeavesProperties.java index 0fb03a216..3228d8fdb 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/SolidLeavesProperties.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/SolidLeavesProperties.java @@ -16,7 +16,7 @@ public class SolidLeavesProperties extends LeavesProperties { public SolidLeavesProperties(ResourceLocation registryName) { super(registryName); - this.requiresShears = false; + this.canBeSheared = false; } @Override diff --git a/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/WartProperties.java b/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/WartProperties.java index 541323348..16cc0b503 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/WartProperties.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/WartProperties.java @@ -26,7 +26,7 @@ public WartProperties(final ResourceLocation registryName) { } @Override - protected String getBlockRegistryNameSuffix() { + public String getBlockRegistryNameSuffix() { return "_wart"; } diff --git a/src/main/java/com/ferreusveritas/dynamictrees/data/DTLootParameters.java b/src/main/java/com/ferreusveritas/dynamictrees/data/DTLootParameters.java deleted file mode 100755 index a427d57b1..000000000 --- a/src/main/java/com/ferreusveritas/dynamictrees/data/DTLootParameters.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.ferreusveritas.dynamictrees.data; - -import com.ferreusveritas.dynamictrees.DynamicTrees; -import com.ferreusveritas.dynamictrees.trees.Species; -import net.minecraft.loot.LootParameter; - -/** - * @author Harley O'Connor - */ -public final class DTLootParameters { - - public static final LootParameter SPECIES = create("species"); - public static final LootParameter FERTILITY = create("fertility"); - public static final LootParameter FORTUNE = create("fortune"); - public static final LootParameter LOGS_AND_STICKS = create("logs_and_sticks"); - - private static LootParameter create(String path) { - return new LootParameter<>(DynamicTrees.resLoc(path)); - } - -} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java b/src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java new file mode 100644 index 000000000..6c93bafe8 --- /dev/null +++ b/src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java @@ -0,0 +1,260 @@ +package com.ferreusveritas.dynamictrees.data.provider; + +import com.ferreusveritas.dynamictrees.blocks.branches.BranchBlock; +import com.ferreusveritas.dynamictrees.loot.DTLootParameterSets; +import com.ferreusveritas.dynamictrees.loot.condition.SeasonalSeedDropChance; +import com.ferreusveritas.dynamictrees.loot.condition.VoluntarySeedDropChance; +import com.ferreusveritas.dynamictrees.loot.function.MultiplyLogsCount; +import com.ferreusveritas.dynamictrees.loot.function.MultiplySticksCount; +import com.ferreusveritas.dynamictrees.trees.Species; +import com.ferreusveritas.dynamictrees.util.ResourceLocationUtils; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import net.minecraft.advancements.criterion.EnchantmentPredicate; +import net.minecraft.advancements.criterion.ItemPredicate; +import net.minecraft.advancements.criterion.MinMaxBounds; +import net.minecraft.block.Block; +import net.minecraft.data.DataGenerator; +import net.minecraft.data.DirectoryCache; +import net.minecraft.data.IDataProvider; +import net.minecraft.data.LootTableProvider; +import net.minecraft.data.loot.BlockLootTables; +import net.minecraft.enchantment.Enchantments; +import net.minecraft.item.Item; +import net.minecraft.item.Items; +import net.minecraft.loot.ConstantRange; +import net.minecraft.loot.ItemLootEntry; +import net.minecraft.loot.LootParameterSet; +import net.minecraft.loot.LootParameterSets; +import net.minecraft.loot.LootPool; +import net.minecraft.loot.LootTable; +import net.minecraft.loot.LootTableManager; +import net.minecraft.loot.RandomValueRange; +import net.minecraft.loot.conditions.ILootCondition; +import net.minecraft.loot.conditions.MatchTool; +import net.minecraft.loot.conditions.SurvivesExplosion; +import net.minecraft.loot.conditions.TableBonus; +import net.minecraft.loot.functions.ExplosionDecay; +import net.minecraft.loot.functions.SetCount; +import net.minecraft.resources.ResourcePackType; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.common.data.ExistingFileHelper; +import net.minecraftforge.registries.ForgeRegistries; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.io.IOException; +import java.nio.file.Path; +import java.util.HashMap; +import java.util.Map; + +/** + * @author Harley O'Connor + */ +public class DTLootTableProvider extends LootTableProvider { + + private static final ILootCondition.IBuilder HAS_SILK_TOUCH = MatchTool.toolMatches(ItemPredicate.Builder.item() + .hasEnchantment(new EnchantmentPredicate(Enchantments.SILK_TOUCH, MinMaxBounds.IntBound.atLeast(1)))); + private static final ILootCondition.IBuilder HAS_NO_SILK_TOUCH = HAS_SILK_TOUCH.invert(); + private static final ILootCondition.IBuilder HAS_SHEARS = + MatchTool.toolMatches(ItemPredicate.Builder.item().of(Items.SHEARS)); + private static final ILootCondition.IBuilder HAS_SHEARS_OR_SILK_TOUCH = HAS_SHEARS.or(HAS_SILK_TOUCH); + private static final ILootCondition.IBuilder HAS_NO_SHEARS_OR_SILK_TOUCH = HAS_SHEARS_OR_SILK_TOUCH.invert(); + + private static final Logger LOGGER = LogManager.getLogger(); + private static final Gson GSON = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create(); + + private final Map lootTables = new HashMap<>(); + private final DataGenerator generator; + private final String modId; + private final ExistingFileHelper existingFileHelper; + + public DTLootTableProvider(DataGenerator generator, String modId, ExistingFileHelper existingFileHelper) { + super(generator); + this.generator = generator; + this.modId = modId; + this.existingFileHelper = existingFileHelper; + } + + @Override + public void run(DirectoryCache cache) { + addTables(); + writeTables(cache); + } + + private void addTables() { + Species.REGISTRY.forEach(species -> { + if (!species.getRegistryName().getNamespace().equals(modId)) { + return; + } + if (species.shouldGenerateLeavesBlockDrops()) { + final ResourceLocation leavesBlockTablePath = getFullDropsPath(species.getLeavesBlockDropsPath()); + if (!existingFileHelper.exists(leavesBlockTablePath, ResourcePackType.SERVER_DATA)) { + lootTables.put(leavesBlockTablePath, species.createLeavesBlockDrops()); + } + } + if (species.shouldGenerateLeavesDrops()) { + final ResourceLocation leavesTablePath = getFullDropsPath(species.getLeavesDropsPath()); + if (!existingFileHelper.exists(leavesTablePath, ResourcePackType.SERVER_DATA)) { + lootTables.put(leavesTablePath, species.createLeavesDrops()); + } + } + if (species.shouldGenerateVoluntaryDrops()) { + final ResourceLocation leavesTablePath = getFullDropsPath(species.getVoluntaryDropsPath()); + if (!existingFileHelper.exists(leavesTablePath, ResourcePackType.SERVER_DATA)) { + lootTables.put(leavesTablePath, species.createVoluntaryDrops()); + } + } + }); + ForgeRegistries.BLOCKS.getValues().stream() + .filter(block -> block instanceof BranchBlock) + .map(block -> (BranchBlock) block) + .filter(block -> block.getRegistryName().getNamespace().equals(modId)) + .forEach(branchBlock -> { + if (branchBlock.shouldGenerateBranchDrops()) { + final ResourceLocation branchTablePath = getFullDropsPath(branchBlock.getLootTableName()); + if (!existingFileHelper.exists(branchTablePath, ResourcePackType.SERVER_DATA)) { + lootTables.put(branchTablePath, branchBlock.createBranchDrops()); + } + } + }); + } + + private ResourceLocation getFullDropsPath(ResourceLocation path) { + return ResourceLocationUtils.surround(path, "loot_tables/", ".json"); + } + + public static LootTable.Builder createLeavesBlockDrops(Block primitiveLeavesBlock) { + return LootTable.lootTable().withPool( + LootPool.lootPool().setRolls(ConstantRange.exactly(1)) + .add(ItemLootEntry.lootTableItem(primitiveLeavesBlock).when(HAS_SHEARS_OR_SILK_TOUCH)) + ).withPool( + LootPool.lootPool().setRolls(ConstantRange.exactly(1)).when(HAS_NO_SHEARS_OR_SILK_TOUCH).add( + ItemLootEntry.lootTableItem(Items.STICK) + .apply(SetCount.setCount(RandomValueRange.between(1.0F, 2.0F))) + .apply(ExplosionDecay.explosionDecay()) + .when(TableBonus.bonusLevelFlatChance( + Enchantments.BLOCK_FORTUNE, 0.02F, 0.022222223F, 0.025F, 0.033333335F, + 0.1F + )) + ) + ).setParamSet(LootParameterSets.BLOCK); + } + + public static LootTable.Builder createLeavesBlockDrops(Block primitiveLeavesBlock, Item seedItem, + float[] seedChances) { + return BlockLootTables.createSilkTouchOrShearsDispatchTable( + primitiveLeavesBlock, + ItemLootEntry.lootTableItem(seedItem) + .when(SurvivesExplosion.survivesExplosion()) + .when(TableBonus.bonusLevelFlatChance(Enchantments.BLOCK_FORTUNE, seedChances)) + .when(SeasonalSeedDropChance.seasonalSeedDropChance()) + ).withPool( + LootPool.lootPool().setRolls(ConstantRange.exactly(1)).when(HAS_NO_SHEARS_OR_SILK_TOUCH) + .add(ItemLootEntry.lootTableItem(Items.STICK) + .apply(SetCount.setCount( + RandomValueRange.between(1.0F, 2.0F) + )) + .apply(ExplosionDecay.explosionDecay()) + .when(TableBonus.bonusLevelFlatChance(Enchantments.BLOCK_FORTUNE, 0.02F, + 0.022222223F, 0.025F, 0.033333335F, 0.1F))) + ).setParamSet(LootParameterSets.BLOCK); + } + + public static LootTable.Builder createWartBlockDrops(Block primitiveWartBlock) { + return LootTable.lootTable().withPool( + LootPool.lootPool().setRolls(ConstantRange.exactly(1)) + .add(ItemLootEntry.lootTableItem(primitiveWartBlock)) + .when(SurvivesExplosion.survivesExplosion()) + ); + } + + public static LootTable.Builder createLeavesDrops() { + return LootTable.lootTable().withPool( + LootPool.lootPool().setRolls(ConstantRange.exactly(1)).add( + ItemLootEntry.lootTableItem(Items.STICK) + .apply(SetCount.setCount(RandomValueRange.between(1.0F, 2.0F))) + .apply(ExplosionDecay.explosionDecay()) + .when(TableBonus.bonusLevelFlatChance( + Enchantments.BLOCK_FORTUNE, 0.02F, 0.022222223F, 0.025F, 0.033333335F, + 0.1F + )) + ) + ).setParamSet(LootParameterSets.BLOCK); + } + + public static LootTable.Builder createLeavesDrops(Item seedItem, float[] seedChances, LootParameterSet parameterSet) { + return LootTable.lootTable().withPool( + LootPool.lootPool().setRolls(ConstantRange.exactly(1)).add( + ItemLootEntry.lootTableItem(seedItem) + .when(SurvivesExplosion.survivesExplosion()) + .when(TableBonus.bonusLevelFlatChance(Enchantments.BLOCK_FORTUNE, seedChances)) + .when(SeasonalSeedDropChance.seasonalSeedDropChance()) + ) + ).withPool( + LootPool.lootPool().setRolls(ConstantRange.exactly(1)).add( + ItemLootEntry.lootTableItem(Items.STICK) + .apply(SetCount.setCount( + RandomValueRange.between(1.0F, 2.0F) + )) + .apply(ExplosionDecay.explosionDecay()) + .when(TableBonus.bonusLevelFlatChance( + Enchantments.BLOCK_FORTUNE, 0.02F, 0.022222223F, 0.025F, 0.033333335F, 0.1F + )) + ) + ).setParamSet(parameterSet); + } + + public static LootTable.Builder createWartDrops(Block primitiveWartBlock) { + return LootTable.lootTable().withPool( + LootPool.lootPool().setRolls(ConstantRange.exactly(1)) + .add(ItemLootEntry.lootTableItem(primitiveWartBlock)) + .when(SurvivesExplosion.survivesExplosion()) + .when(TableBonus.bonusLevelFlatChance( + Enchantments.BLOCK_FORTUNE, 0.1F, 0.1333333F, 0.1666666F, 0.2F + )) + ); + } + + public static LootTable.Builder createVoluntaryDrops(Item seedItem) { + return LootTable.lootTable().withPool( + LootPool.lootPool().setRolls(ConstantRange.exactly(1)).add( + ItemLootEntry.lootTableItem(seedItem) + .when(VoluntarySeedDropChance.voluntarySeedDropChance()) + ) + ).setParamSet(DTLootParameterSets.VOLUNTARY); + } + + public static LootTable.Builder createBranchDrops(Block primitiveLogBlock, Item stickItem) { + return LootTable.lootTable().withPool( + LootPool.lootPool().setRolls(ConstantRange.exactly(1)).add( + ItemLootEntry.lootTableItem(primitiveLogBlock) + .apply(MultiplyLogsCount.multiplyLogsCount()) + .apply(ExplosionDecay.explosionDecay()) + ) + ).withPool( + LootPool.lootPool().setRolls(ConstantRange.exactly(1)).add( + ItemLootEntry.lootTableItem(stickItem) + .apply(MultiplySticksCount.multiplySticksCount()) + .apply(ExplosionDecay.explosionDecay()) + ) + ).setParamSet(DTLootParameterSets.WOOD); + } + + private void writeTables(DirectoryCache cache) { + Path outputFolder = this.generator.getOutputFolder(); + lootTables.forEach((key, lootTable) -> { + Path path = outputFolder.resolve("data/" + key.getNamespace() + "/" + key.getPath()); + try { + IDataProvider.save(GSON, cache, LootTableManager.serialize(lootTable.build()), path); + } catch (IOException e) { + LOGGER.error("Couldn't write loot table {}", path, e); + } + }); + } + + @Override + public String getName() { + return modId; + } +} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/deserialisation/DropsDeserialiser.java b/src/main/java/com/ferreusveritas/dynamictrees/deserialisation/DropsDeserialiser.java deleted file mode 100755 index 80e0f95b1..000000000 --- a/src/main/java/com/ferreusveritas/dynamictrees/deserialisation/DropsDeserialiser.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.ferreusveritas.dynamictrees.deserialisation; - -import com.ferreusveritas.dynamictrees.deserialisation.result.Result; -import com.ferreusveritas.dynamictrees.systems.dropcreators.drops.Drops; -import com.ferreusveritas.dynamictrees.systems.dropcreators.drops.StackDrops; -import com.ferreusveritas.dynamictrees.systems.dropcreators.drops.WeightedDrops; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.mojang.datafixers.util.Pair; -import com.mojang.serialization.Codec; -import com.mojang.serialization.JsonOps; - -import java.util.HashMap; -import java.util.Map; - -/** - * @author Harley O'Connor - */ -public final class DropsDeserialiser implements JsonDeserialiser { - - public static final Map> DROPS_TYPES = new HashMap<>(); - - @SuppressWarnings("unchecked") - public static void registerCodec(String id, Codec dropsCodec) { - DROPS_TYPES.put(id, ((Codec) dropsCodec)); - } - - static { - registerCodec("stack", StackDrops.CODEC); - registerCodec("weighted", WeightedDrops.CODEC); - } - - @Override - public Result deserialise(JsonElement jsonElement) { - return JsonDeserialisers.JSON_OBJECT.deserialise(jsonElement).map(object -> { - final String id = JsonHelper.getOrDefault(object, "id", String.class, null); - if (id == null) { - return null; - } - - final Codec codec = DROPS_TYPES.get(id); - if (codec == null) { - return null; - } - - final JsonObject properties = JsonHelper.getOrDefault(object, "properties", JsonObject.class, new JsonObject()); - return codec.decode(JsonOps.INSTANCE, properties) - .result().map(Pair::getFirst).orElse(null); - }, "Error de-serialising drops from element \"" + jsonElement + "\"."); - } - -} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/deserialisation/JsonDeserialisers.java b/src/main/java/com/ferreusveritas/dynamictrees/deserialisation/JsonDeserialisers.java index 66a924f9a..32c2932fb 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/deserialisation/JsonDeserialisers.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/deserialisation/JsonDeserialisers.java @@ -16,10 +16,6 @@ import com.ferreusveritas.dynamictrees.growthlogic.GrowthLogicKitConfiguration; import com.ferreusveritas.dynamictrees.items.Seed; import com.ferreusveritas.dynamictrees.systems.SeedSaplingRecipe; -import com.ferreusveritas.dynamictrees.systems.dropcreators.DropCreator; -import com.ferreusveritas.dynamictrees.systems.dropcreators.DropCreatorConfiguration; -import com.ferreusveritas.dynamictrees.systems.dropcreators.context.DropContext; -import com.ferreusveritas.dynamictrees.systems.dropcreators.drops.Drops; import com.ferreusveritas.dynamictrees.systems.fruit.Fruit; import com.ferreusveritas.dynamictrees.systems.genfeatures.GenFeature; import com.ferreusveritas.dynamictrees.systems.genfeatures.GenFeatureConfiguration; @@ -223,9 +219,6 @@ public static JsonDeserialiser register(final Class outputClass, final public static final JsonDeserialiser VOXEL_SHAPE = register(VoxelShape.class, new VoxelShapeDeserialiser()); - public static final JsonDeserialiser> DROP_TYPE = - register(DropCreator.Type.getGenericClass(), new RegistryEntryDeserialiser<>(DropCreator.Type.REGISTRY)); - public static final JsonDeserialiser CELL_KIT = register(CellKit.class, new RegistryEntryDeserialiser<>(CellKit.REGISTRY)); public static final JsonDeserialiser LEAVES_PROPERTIES = @@ -236,8 +229,6 @@ public static JsonDeserialiser register(final Class outputClass, final register(GenFeature.class, new RegistryEntryDeserialiser<>(GenFeature.REGISTRY)); public static final JsonDeserialiser FAMILY = register(Family.class, new RegistryEntryDeserialiser<>(Family.REGISTRY)); - public static final JsonDeserialiser DROP_CREATOR = - register(DropCreator.class, new RegistryEntryDeserialiser<>(DropCreator.REGISTRY)); public static final JsonDeserialiser FRUIT = register(Fruit.class, new RegistryEntryDeserialiser<>(Fruit.REGISTRY)); public static final JsonDeserialiser POD = @@ -255,17 +246,11 @@ public static JsonDeserialiser register(final Class outputClass, final public static final JsonDeserialiser CONFIGURED_GEN_FEATURE = register(GenFeatureConfiguration.class, new ConfiguredDeserialiser<>("Gen Feature", GenFeature.class, GenFeatureConfiguration.TEMPLATES)); - public static final JsonDeserialiser CONFIGURED_DROP_CREATOR = - register(DropCreatorConfiguration.class, - new ConfiguredDeserialiser<>("Drop Creator", DropCreator.class, - DropCreatorConfiguration.TEMPLATES)); public static final JsonDeserialiser CONFIGURED_GROWTH_LOGIC_KIT = register(GrowthLogicKitConfiguration.class, new ConfiguredDeserialiser<>("Growth Logic Kit", GrowthLogicKit.class, GrowthLogicKitConfiguration.TEMPLATES)); - public static final JsonDeserialiser DROPS = register(Drops.class, new DropsDeserialiser()); - public static final JsonDeserialiser SEED = register(Seed.class, jsonElement -> ITEM.deserialise(jsonElement) .mapIfValid(item -> item instanceof Seed, "Item \"{}\" is not a seed.", item -> (Seed) item)); diff --git a/src/main/java/com/ferreusveritas/dynamictrees/init/DTRegistries.java b/src/main/java/com/ferreusveritas/dynamictrees/init/DTRegistries.java index 65e846455..42d149a60 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/init/DTRegistries.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/init/DTRegistries.java @@ -20,8 +20,6 @@ import com.ferreusveritas.dynamictrees.items.DirtBucket; import com.ferreusveritas.dynamictrees.items.Staff; import com.ferreusveritas.dynamictrees.systems.BranchConnectables; -import com.ferreusveritas.dynamictrees.systems.dropcreators.DropCreator; -import com.ferreusveritas.dynamictrees.systems.dropcreators.DropCreators; import com.ferreusveritas.dynamictrees.systems.genfeatures.GenFeature; import com.ferreusveritas.dynamictrees.systems.genfeatures.GenFeatures; import com.ferreusveritas.dynamictrees.tileentity.PottedSaplingTileEntity; @@ -251,9 +249,4 @@ public static void onGenFeatureRegistry(final com.ferreusveritas.dynamictrees.ap GenFeatures.register(event.getRegistry()); } - @SubscribeEvent - public static void onDropCreatorRegistry(final com.ferreusveritas.dynamictrees.api.registry.RegistryEvent event) { - DropCreators.register(event.getRegistry()); - } - } diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/DTLoot.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/DTLoot.java new file mode 100644 index 000000000..9a7062b0b --- /dev/null +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/DTLoot.java @@ -0,0 +1,19 @@ +package com.ferreusveritas.dynamictrees.loot; + +import com.ferreusveritas.dynamictrees.loot.condition.DTLootConditions; +import com.ferreusveritas.dynamictrees.loot.function.DTLootFunctions; + +/** + * @author Harley O'Connor + */ +public final class DTLoot { + + /** Invoked to initialise static fields. */ + public static void load() { + DTLootParameters.load(); + DTLootParameters.load(); + DTLootConditions.load(); + DTLootFunctions.load(); + } + +} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/data/DTLootParameterSets.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/DTLootParameterSets.java similarity index 57% rename from src/main/java/com/ferreusveritas/dynamictrees/data/DTLootParameterSets.java rename to src/main/java/com/ferreusveritas/dynamictrees/loot/DTLootParameterSets.java index c1073a86f..6cf6f0d43 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/data/DTLootParameterSets.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/DTLootParameterSets.java @@ -1,4 +1,4 @@ -package com.ferreusveritas.dynamictrees.data; +package com.ferreusveritas.dynamictrees.loot; import com.ferreusveritas.dynamictrees.DynamicTrees; import net.minecraft.loot.LootParameterSet; @@ -12,31 +12,23 @@ */ public final class DTLootParameterSets { - public static final LootParameterSet HARVEST = register("harvest", builder -> + public static final LootParameterSet LEAVES = register("leaves", builder -> builder.required(LootParameters.BLOCK_STATE) - .required(DTLootParameters.SPECIES) - .required(DTLootParameters.FERTILITY) - .required(DTLootParameters.FORTUNE) + .required(DTLootParameters.SEASONAL_SEED_DROP_FACTOR) + .required(LootParameters.TOOL) + .optional(LootParameters.EXPLOSION_RADIUS) ); public static final LootParameterSet VOLUNTARY = register("voluntary", builder -> builder.required(LootParameters.BLOCK_STATE) - .required(DTLootParameters.SPECIES) + .required(DTLootParameters.SEASONAL_SEED_DROP_FACTOR) .required(DTLootParameters.FERTILITY) ); - public static final LootParameterSet LEAVES = register("leaves", builder -> - builder.required(LootParameters.BLOCK_STATE) - .required(LootParameters.TOOL) - .required(DTLootParameters.SPECIES) - .required(DTLootParameters.FORTUNE) - ); - - public static final LootParameterSet LOGS = register("logs", builder -> - builder.required(LootParameters.BLOCK_STATE) - .required(LootParameters.TOOL) - .required(DTLootParameters.SPECIES) - .required(DTLootParameters.LOGS_AND_STICKS) + public static final LootParameterSet WOOD = register("wood", builder -> + builder.required(LootParameters.TOOL) + .required(DTLootParameters.VOLUME) + .optional(LootParameters.EXPLOSION_RADIUS) ); private static LootParameterSet register(String path, Consumer builderConsumer) { @@ -49,4 +41,7 @@ private static LootParameterSet register(String path, Consumer FERTILITY = create("fertility"); + public static final LootParameter SEASONAL_SEED_DROP_FACTOR = create("seasonal_seed_drop_factor"); + public static final LootParameter VOLUME = create("volume"); + + private static LootParameter create(String path) { + return new LootParameter<>(DynamicTrees.resLoc(path)); + } + + /** Invoked to initialise static fields. */ + public static void load() {} + +} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/DTLootConditions.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/DTLootConditions.java new file mode 100644 index 000000000..109196882 --- /dev/null +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/DTLootConditions.java @@ -0,0 +1,27 @@ +package com.ferreusveritas.dynamictrees.loot.condition; + +import net.minecraft.loot.ILootSerializer; +import net.minecraft.loot.LootConditionType; +import net.minecraft.loot.conditions.ILootCondition; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.registry.Registry; + +/** + * @author Harley O'Connor + */ +public final class DTLootConditions { + + public static final LootConditionType SEASONAL_SEED_DROP_CHANCE = + register("dynamictrees:seasonal_seed_drop_chance", new SeasonalSeedDropChance.Serializer()); + + public static final LootConditionType VOLUNTARY_SEED_DROP_CHANCE = + register("dynamictrees:voluntary_seed_drop_chance", new VoluntarySeedDropChance.Serializer()); + + private static LootConditionType register(String name, ILootSerializer serializer) { + return Registry.register(Registry.LOOT_CONDITION_TYPE, new ResourceLocation(name), new LootConditionType(serializer)); + } + + /** Invoked to initialise static fields. */ + public static void load() {} + +} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/SeasonalSeedDropChance.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/SeasonalSeedDropChance.java new file mode 100644 index 000000000..aca77c808 --- /dev/null +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/SeasonalSeedDropChance.java @@ -0,0 +1,46 @@ +package com.ferreusveritas.dynamictrees.loot.condition; + +import com.ferreusveritas.dynamictrees.loot.DTLootParameters; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonObject; +import com.google.gson.JsonSerializationContext; +import net.minecraft.loot.ILootSerializer; +import net.minecraft.loot.LootConditionType; +import net.minecraft.loot.LootContext; +import net.minecraft.loot.conditions.ILootCondition; + +/** + * @author Harley O'Connor + */ +public final class SeasonalSeedDropChance implements ILootCondition { + + private static final SeasonalSeedDropChance INSTANCE = new SeasonalSeedDropChance(); + + private SeasonalSeedDropChance() {} + + @Override + public LootConditionType getType() { + return DTLootConditions.SEASONAL_SEED_DROP_CHANCE; + } + + @Override + public boolean test(LootContext context) { + final Float seasonalSeedDropFactor = context.getParamOrNull(DTLootParameters.SEASONAL_SEED_DROP_FACTOR); + assert seasonalSeedDropFactor != null; + return seasonalSeedDropFactor > context.getRandom().nextFloat(); + } + + public static ILootCondition.IBuilder seasonalSeedDropChance() { + return () -> INSTANCE; + } + + public static class Serializer implements ILootSerializer { + public void serialize(JsonObject json, SeasonalSeedDropChance value, JsonSerializationContext context) { + } + + public SeasonalSeedDropChance deserialize(JsonObject json, JsonDeserializationContext context) { + return SeasonalSeedDropChance.INSTANCE; + } + } + +} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/VoluntarySeedDropChance.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/VoluntarySeedDropChance.java new file mode 100644 index 000000000..4d826fa13 --- /dev/null +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/VoluntarySeedDropChance.java @@ -0,0 +1,54 @@ +package com.ferreusveritas.dynamictrees.loot.condition; + +import com.ferreusveritas.dynamictrees.init.DTConfigs; +import com.ferreusveritas.dynamictrees.loot.DTLootParameters; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonObject; +import com.google.gson.JsonSerializationContext; +import net.minecraft.loot.ILootSerializer; +import net.minecraft.loot.LootConditionType; +import net.minecraft.loot.LootContext; +import net.minecraft.loot.conditions.ILootCondition; +import net.minecraft.util.JSONUtils; + +/** + * @author Harley O'Connor + */ +public final class VoluntarySeedDropChance implements ILootCondition { + + private final float rarity; + + public VoluntarySeedDropChance(float rarity) { + this.rarity = rarity; + } + + @Override + public LootConditionType getType() { + return DTLootConditions.VOLUNTARY_SEED_DROP_CHANCE; + } + + @Override + public boolean test(LootContext context) { + final Float seasonalSeedDropFactor = context.getParamOrNull(DTLootParameters.SEASONAL_SEED_DROP_FACTOR); + assert seasonalSeedDropFactor != null; + return rarity * DTConfigs.SEED_DROP_RATE.get() * seasonalSeedDropFactor > context.getRandom().nextFloat(); + } + + public static ILootCondition.IBuilder voluntarySeedDropChance() { + return () -> new VoluntarySeedDropChance(1.0F); + } + + public static ILootCondition.IBuilder voluntarySeedDropChance(float rarity) { + return () -> new VoluntarySeedDropChance(rarity); + } + + public static class Serializer implements ILootSerializer { + public void serialize(JsonObject json, VoluntarySeedDropChance value, JsonSerializationContext context) { + json.addProperty("rarity", value.rarity); + } + + public VoluntarySeedDropChance deserialize(JsonObject json, JsonDeserializationContext context) { + return new VoluntarySeedDropChance(JSONUtils.getAsFloat(json, "rarity", 1.0F)); + } + } +} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/function/DTLootFunctions.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/function/DTLootFunctions.java new file mode 100644 index 000000000..92774649c --- /dev/null +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/function/DTLootFunctions.java @@ -0,0 +1,24 @@ +package com.ferreusveritas.dynamictrees.loot.function; + +import net.minecraft.loot.ILootSerializer; +import net.minecraft.loot.LootFunctionType; +import net.minecraft.loot.functions.ILootFunction; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.registry.Registry; + +/** + * @author Harley O'Connor + */ +public final class DTLootFunctions { + + public static LootFunctionType MULTIPLY_LOGS_COUNT = register("dynamictrees:multiply_logs_count", new MultiplyLogsCount.Serializer()); + public static LootFunctionType MULTIPLY_STICKS_COUNT = register("dynamictrees:multiply_sticks_count", new MultiplySticksCount.Serializer()); + + private static LootFunctionType register(String name, ILootSerializer serializer) { + return Registry.register(Registry.LOOT_FUNCTION_TYPE, new ResourceLocation(name), new LootFunctionType(serializer)); + } + + /** Invoked to initialise static fields. */ + public static void load() {} + +} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/function/MultiplyLogsCount.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/function/MultiplyLogsCount.java new file mode 100644 index 000000000..8e33decfc --- /dev/null +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/function/MultiplyLogsCount.java @@ -0,0 +1,50 @@ +package com.ferreusveritas.dynamictrees.loot.function; + +import com.ferreusveritas.dynamictrees.loot.DTLootParameters; +import com.ferreusveritas.dynamictrees.systems.nodemappers.NetVolumeNode; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonObject; +import com.google.gson.JsonSerializationContext; +import net.minecraft.item.ItemStack; +import net.minecraft.loot.LootContext; +import net.minecraft.loot.LootFunction; +import net.minecraft.loot.LootFunctionType; +import net.minecraft.loot.conditions.ILootCondition; +import net.minecraft.loot.functions.ILootFunction; + +/** + * @author Harley O'Connor + */ +public final class MultiplyLogsCount extends LootFunction { + + public MultiplyLogsCount(ILootCondition[] conditions) { + super(conditions); + } + + @Override + public LootFunctionType getType() { + return DTLootFunctions.MULTIPLY_LOGS_COUNT; + } + + @Override + protected ItemStack run(ItemStack stack, LootContext context) { + final Integer volume = context.getParamOrNull(DTLootParameters.VOLUME); + assert volume != null; + stack.setCount(stack.getCount() * (int) Math.floor((float) volume / NetVolumeNode.Volume.VOXELSPERLOG)); + return stack; + } + + public static ILootFunction.IBuilder multiplyLogsCount() { + return () -> new MultiplyLogsCount(new ILootCondition[0]); + } + + public static class Serializer extends LootFunction.Serializer { + public void serialize(JsonObject json, MultiplyLogsCount value, JsonSerializationContext context) { + super.serialize(json, value, context); + } + + public MultiplyLogsCount deserialize(JsonObject json, JsonDeserializationContext context, ILootCondition[] conditions) { + return new MultiplyLogsCount(conditions); + } + } +} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/function/MultiplySticksCount.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/function/MultiplySticksCount.java new file mode 100644 index 000000000..d882d05d0 --- /dev/null +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/function/MultiplySticksCount.java @@ -0,0 +1,52 @@ +package com.ferreusveritas.dynamictrees.loot.function; + +import com.ferreusveritas.dynamictrees.loot.DTLootParameters; +import com.ferreusveritas.dynamictrees.systems.nodemappers.NetVolumeNode; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonObject; +import com.google.gson.JsonSerializationContext; +import net.minecraft.item.ItemStack; +import net.minecraft.loot.LootContext; +import net.minecraft.loot.LootFunction; +import net.minecraft.loot.LootFunctionType; +import net.minecraft.loot.conditions.ILootCondition; +import net.minecraft.loot.functions.ILootFunction; + +/** + * @author Harley O'Connor + */ +public final class MultiplySticksCount extends LootFunction { + + public MultiplySticksCount(ILootCondition[] conditions) { + super(conditions); + } + + @Override + public LootFunctionType getType() { + return DTLootFunctions.MULTIPLY_STICKS_COUNT; + } + + @Override + protected ItemStack run(ItemStack stack, LootContext context) { + final Integer volume = context.getParamOrNull(DTLootParameters.VOLUME); + assert volume != null; + stack.setCount(stack.getCount() * 8 * (volume % NetVolumeNode.Volume.VOXELSPERLOG) / + NetVolumeNode.Volume.VOXELSPERLOG); + return stack; + } + + public static ILootFunction.IBuilder multiplySticksCount() { + return () -> new MultiplySticksCount(new ILootCondition[0]); + } + + public static class Serializer extends LootFunction.Serializer { + public void serialize(JsonObject json, MultiplySticksCount value, JsonSerializationContext context) { + super.serialize(json, value, context); + } + + public MultiplySticksCount deserialize(JsonObject json, JsonDeserializationContext context, + ILootCondition[] conditions) { + return new MultiplySticksCount(conditions); + } + } +} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/function/package-info.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/function/package-info.java new file mode 100755 index 000000000..96f7a2c39 --- /dev/null +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/function/package-info.java @@ -0,0 +1,6 @@ +@MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault +package com.ferreusveritas.dynamictrees.loot.function; + +import mcp.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/com/ferreusveritas/dynamictrees/resources/Resources.java b/src/main/java/com/ferreusveritas/dynamictrees/resources/Resources.java index 72db6422d..c3496863b 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/resources/Resources.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/resources/Resources.java @@ -5,19 +5,16 @@ import com.ferreusveritas.dynamictrees.api.event.Hooks; import com.ferreusveritas.dynamictrees.api.resource.ResourceManager; import com.ferreusveritas.dynamictrees.data.DTRecipes; -import com.ferreusveritas.dynamictrees.systems.fruit.FruitResourceLoader; import com.ferreusveritas.dynamictrees.growthlogic.GrowthLogicKit; import com.ferreusveritas.dynamictrees.growthlogic.GrowthLogicKitConfiguration; import com.ferreusveritas.dynamictrees.init.DTConfigs; import com.ferreusveritas.dynamictrees.resources.loader.BiomeDatabaseResourceLoader; import com.ferreusveritas.dynamictrees.resources.loader.FamilyResourceLoader; -import com.ferreusveritas.dynamictrees.resources.loader.GlobalDropCreatorResourceLoader; import com.ferreusveritas.dynamictrees.resources.loader.JoCodeResourceLoader; import com.ferreusveritas.dynamictrees.resources.loader.LeavesPropertiesResourceLoader; import com.ferreusveritas.dynamictrees.resources.loader.SoilPropertiesResourceLoader; import com.ferreusveritas.dynamictrees.resources.loader.SpeciesResourceLoader; -import com.ferreusveritas.dynamictrees.systems.dropcreators.DropCreator; -import com.ferreusveritas.dynamictrees.systems.dropcreators.DropCreatorConfiguration; +import com.ferreusveritas.dynamictrees.systems.fruit.FruitResourceLoader; import com.ferreusveritas.dynamictrees.systems.genfeatures.GenFeature; import com.ferreusveritas.dynamictrees.systems.genfeatures.GenFeatureConfiguration; import com.ferreusveritas.dynamictrees.systems.pod.PodResourceLoader; @@ -63,13 +60,6 @@ public final class Resources { public static final SoilPropertiesResourceLoader SOIL_PROPERTIES_LOADER = new SoilPropertiesResourceLoader(); public static final FamilyResourceLoader FAMILY_LOADER = new FamilyResourceLoader(); - public static final ConfigurationTemplateResourceLoader - DROP_CREATOR_TEMPLATE_LOADER = new ConfigurationTemplateResourceLoader<>( - "drop_creators/configurations", - DropCreator.REGISTRY, - DropCreatorConfiguration.TEMPLATES - ); - public static final ConfigurationTemplateResourceLoader GEN_FEATURE_TEMPLATE_LOADER = new ConfigurationTemplateResourceLoader<>( "gen_features/configurations", @@ -91,8 +81,6 @@ public final class Resources { public static final JoCodeResourceLoader JO_CODE_LOADER = new JoCodeResourceLoader(); public static final BiomeDatabaseResourceLoader BIOME_DATABASE_LOADER = new BiomeDatabaseResourceLoader(); - public static final GlobalDropCreatorResourceLoader GLOBAL_DROP_CREATOR_LOADER = - new GlobalDropCreatorResourceLoader(); public static void setupTreesResourceManager() { addDefaultLoaders(); @@ -110,15 +98,13 @@ private static void addDefaultLoaders() { LEAVES_PROPERTIES_LOADER, SOIL_PROPERTIES_LOADER, FAMILY_LOADER, - DROP_CREATOR_TEMPLATE_LOADER, GEN_FEATURE_TEMPLATE_LOADER, GROWTH_LOGIC_KIT_TEMPLATE_LOADER, FRUIT_LOADER, POD_LOADER, SPECIES_LOADER, JO_CODE_LOADER, - BIOME_DATABASE_LOADER, - GLOBAL_DROP_CREATOR_LOADER + BIOME_DATABASE_LOADER ); } diff --git a/src/main/java/com/ferreusveritas/dynamictrees/resources/loader/GlobalDropCreatorResourceLoader.java b/src/main/java/com/ferreusveritas/dynamictrees/resources/loader/GlobalDropCreatorResourceLoader.java deleted file mode 100755 index 84eb6fae5..000000000 --- a/src/main/java/com/ferreusveritas/dynamictrees/resources/loader/GlobalDropCreatorResourceLoader.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.ferreusveritas.dynamictrees.resources.loader; - -import com.ferreusveritas.dynamictrees.api.resource.Resource; -import com.ferreusveritas.dynamictrees.api.resource.ResourceAccessor; -import com.ferreusveritas.dynamictrees.api.resource.loading.AbstractResourceLoader; -import com.ferreusveritas.dynamictrees.api.resource.loading.ApplicationException; -import com.ferreusveritas.dynamictrees.api.resource.loading.preparation.JsonResourcePreparer; -import com.ferreusveritas.dynamictrees.deserialisation.JsonDeserialisers; -import com.ferreusveritas.dynamictrees.systems.dropcreators.GlobalDropCreators; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import net.minecraft.resources.IResourceManager; -import net.minecraft.util.ResourceLocation; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import static com.ferreusveritas.dynamictrees.deserialisation.JsonHelper.throwIfNotJsonObject; - -/** - * @author Harley O'Connor - */ -public final class GlobalDropCreatorResourceLoader extends AbstractResourceLoader { - - private static final Logger LOGGER = LogManager.getLogger(); - - public GlobalDropCreatorResourceLoader() { - super(new JsonResourcePreparer("drop_creators/global")); - } - - @Override - public void applyOnReload(ResourceAccessor resourceAccessor, IResourceManager resourceManager) { - resourceAccessor.forEach(this::tryReadEntry); - } - - private void tryReadEntry(Resource resource) { - try { - this.readEntry(resource); - } catch (ApplicationException e) { - LOGGER.error("Error loading global drop creator \"{}\": {}", - resource.getLocation(), e.getMessage()); - } - } - - private void readEntry(Resource resource) throws ApplicationException { - throwIfNotJsonObject(resource.getResource(), () -> new ApplicationException("Root element is not a Json object.")); - this.deserialiseAndPutEntry(resource.getLocation(), resource.getResource().getAsJsonObject()); - } - - private void deserialiseAndPutEntry(ResourceLocation name, JsonObject json) { - JsonDeserialisers.CONFIGURED_DROP_CREATOR.deserialise(json) - .ifSuccessOrElse( - result -> GlobalDropCreators.put(name, result), - error -> LOGGER.error("Error loading global drop creator \"{}\": {}", name, error), - warning -> LOGGER.warn("Warning whilst loading global drop creator \"{}\": {}", name, warning) - ); - } -} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/resources/loader/LeavesPropertiesResourceLoader.java b/src/main/java/com/ferreusveritas/dynamictrees/resources/loader/LeavesPropertiesResourceLoader.java index 5fa4580d6..4efff80bb 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/resources/loader/LeavesPropertiesResourceLoader.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/resources/loader/LeavesPropertiesResourceLoader.java @@ -5,6 +5,7 @@ import com.ferreusveritas.dynamictrees.api.resource.loading.preparation.JsonRegistryResourceLoader; import com.ferreusveritas.dynamictrees.api.treepacks.ApplierRegistryEvent; import com.ferreusveritas.dynamictrees.api.treepacks.PropertyApplierResult; +import com.ferreusveritas.dynamictrees.api.treepacks.VoidApplier; import com.ferreusveritas.dynamictrees.blocks.leaves.LeavesProperties; import com.ferreusveritas.dynamictrees.deserialisation.JsonHelper; import com.ferreusveritas.dynamictrees.deserialisation.ResourceLocationDeserialiser; @@ -18,6 +19,8 @@ import net.minecraft.util.ResourceLocation; import org.apache.logging.log4j.LogManager; +import java.util.List; + /** * @author Harley O'Connor */ @@ -48,7 +51,7 @@ public void registerAppliers() { )); }); - this.reloadAppliers.register("requires_shears", Boolean.class, LeavesProperties::setRequiresShears) + this.reloadAppliers.register("requires_shears", Boolean.class, LeavesProperties::setCanBeSheared) .register("cell_kit", CellKit.class, LeavesProperties::setCellKit) .register("smother", Integer.class, LeavesProperties::setSmotherLeavesMax) .register("light_requirement", Integer.class, LeavesProperties::setLightRequirement) @@ -121,7 +124,7 @@ private void generateBlocks(LeavesProperties leavesProperties, JsonObject json) ); if (blockProperties.getHarvestTool() == ToolTypes.SHEARS) { - leavesProperties.setRequiresShears(true); + leavesProperties.setCanBeSheared(true); } leavesProperties.generateDynamicLeaves(blockProperties); diff --git a/src/main/java/com/ferreusveritas/dynamictrees/resources/loader/SpeciesResourceLoader.java b/src/main/java/com/ferreusveritas/dynamictrees/resources/loader/SpeciesResourceLoader.java index 0ff86ddfd..212c5d0f7 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/resources/loader/SpeciesResourceLoader.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/resources/loader/SpeciesResourceLoader.java @@ -10,11 +10,10 @@ import com.ferreusveritas.dynamictrees.blocks.rootyblocks.SoilHelper; import com.ferreusveritas.dynamictrees.deserialisation.JsonDeserialisers; import com.ferreusveritas.dynamictrees.deserialisation.JsonPropertyAppliers; -import com.ferreusveritas.dynamictrees.systems.fruit.Fruit; import com.ferreusveritas.dynamictrees.growthlogic.GrowthLogicKitConfiguration; import com.ferreusveritas.dynamictrees.items.Seed; import com.ferreusveritas.dynamictrees.systems.SeedSaplingRecipe; -import com.ferreusveritas.dynamictrees.systems.dropcreators.DropCreatorConfiguration; +import com.ferreusveritas.dynamictrees.systems.fruit.Fruit; import com.ferreusveritas.dynamictrees.systems.genfeatures.GenFeatureConfiguration; import com.ferreusveritas.dynamictrees.systems.pod.Pod; import com.ferreusveritas.dynamictrees.trees.Species; @@ -83,7 +82,8 @@ public void registerAppliers () { // We need the sapling shape to know which parent smartmodel the sapling model should use. this.gatherDataAppliers - .register("sapling_shape", VoxelShape.class, Species::setSaplingShape); + .register("sapling_shape", VoxelShape.class, Species::setSaplingShape) + .registerListApplier("seed_chances", Float.class, Species::setSeedChances);; this.reloadAppliers .register("tapering", Float.class, Species::setTapering) @@ -98,8 +98,6 @@ public void registerAppliers () { .register("leaves_properties", LeavesProperties.class, Species::setLeavesProperties) .register("world_gen_leaf_map_height", Integer.class, Species::setWorldGenLeafMapHeight) .register("environment_factors", JsonObject.class, this::applyEnvironmentFactors) - .register("seed_drop_rarity", Float.class, Species::setupStandardSeedDropping) - .register("stick_drop_rarity", Float.class, Species::setupStandardStickDropping) .register("mega_species", ResourceLocation.class, this::setMegaSpecies) .register("seed", Seed.class, Species::setSeed) .register("seed_composter_chance", Float.class, this.composterChanceCache::put) @@ -112,7 +110,6 @@ public void registerAppliers () { .registerArrayApplier("acceptable_growth_blocks", Block.class, Species::addAcceptableBlockForGrowth) .registerArrayApplier("acceptable_soils", String.class, (Applier) this::addAcceptableSoil) .registerArrayApplier("features", GenFeatureConfiguration.class, Species::addGenFeature) - .registerArrayApplier("drop_creators", DropCreatorConfiguration.class, Species::addDropCreators) .register("does_rot", Boolean.class, Species::setDoesRot) .registerListApplier("fruits", Fruit.class, Species::addFruits) .registerListApplier("pods", Pod.class, Species::addPods); @@ -169,9 +166,6 @@ protected void postLoadOnLoad(LoadData loadData, JsonObject json) { protected void postLoadOnReload(LoadData loadData, JsonObject json) { final Species species = loadData.getResource(); this.composterChanceCache.put(species, species.defaultSeedComposterChance()); - if (this.shouldClearDropCreators(json)) { - species.getDropCreators().clear(); - } super.postLoadOnReload(loadData, json); this.registerComposterChances(); } @@ -185,8 +179,4 @@ private void registerComposterChances() { this.composterChanceCache.clear(); } - private boolean shouldClearDropCreators(JsonObject json) { - return json.has("drop_creators") && json.get("drop_creators").isJsonArray(); - } - } diff --git a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/DropCreator.java b/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/DropCreator.java deleted file mode 100755 index afa35d678..000000000 --- a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/DropCreator.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.ferreusveritas.dynamictrees.systems.dropcreators; - -import com.ferreusveritas.dynamictrees.DynamicTrees; -import com.ferreusveritas.dynamictrees.api.configurations.ConfigurableRegistry; -import com.ferreusveritas.dynamictrees.api.configurations.ConfigurableRegistryEntry; -import com.ferreusveritas.dynamictrees.api.configurations.ConfigurationProperty; -import com.ferreusveritas.dynamictrees.api.registry.*; -import com.ferreusveritas.dynamictrees.init.DTTrees; -import com.ferreusveritas.dynamictrees.systems.dropcreators.context.DropContext; -import com.ferreusveritas.dynamictrees.systems.dropcreators.context.LogDropContext; -import com.ferreusveritas.dynamictrees.trees.Resettable; -import net.minecraft.util.ResourceLocation; -import org.apache.logging.log4j.util.TriConsumer; - -/** - * This exists solely to aid in the creation of a cleaner anonymous class. All of the members in this class act as - * pass-thrus by default. - * - * @author ferreusveritas - */ -public abstract class DropCreator extends ConfigurableRegistryEntry - implements Resettable { - - public static final ConfigurationProperty RARITY = ConfigurationProperty.floatProperty("rarity"); - public static final DropCreator NULL = new DropCreator(DTTrees.NULL) { - @Override - protected void registerProperties() { - } - }; - - public static final ConfigurableRegistry REGISTRY = - new ConfigurableRegistry<>(DropCreator.class, NULL, DropCreatorConfiguration.TEMPLATES); - - public DropCreator(final ResourceLocation registryName) { - super(registryName); - } - - @Override - protected DropCreatorConfiguration createDefaultConfiguration() { - return new DropCreatorConfiguration(this); - } - - public void appendDrops(final DropCreatorConfiguration configuration, final Type type, - final C context) { - type.appendDrops(configuration, context); - } - - protected void appendHarvestDrops(final DropCreatorConfiguration configuration, DropContext context) { - } - - protected void appendVoluntaryDrops(final DropCreatorConfiguration configuration, DropContext context) { - } - - protected void appendLeavesDrops(final DropCreatorConfiguration configuration, DropContext context) { - } - - protected void appendLogDrops(final DropCreatorConfiguration configuration, LogDropContext context) { - } - - public static final class Type extends RegistryEntry> { - public static final Type NULL = new Type<>(DTTrees.NULL, (dropCreator, configured, context) -> { - }); - - @SuppressWarnings("unchecked") - public static final Class> TYPE = (Class>) NULL.getClass(); - public static final SimpleRegistry> REGISTRY = new SimpleRegistry<>(TYPE, NULL); - - public static final Type HARVEST = register(new Type<>(DynamicTrees.resLoc("harvest"), - DropCreator::appendHarvestDrops)); - public static final Type VOLUNTARY = register(new Type<>(DynamicTrees.resLoc("voluntary"), - DropCreator::appendVoluntaryDrops)); - public static final Type LEAVES = register(new Type<>(DynamicTrees.resLoc("leaves"), - DropCreator::appendLeavesDrops)); - public static final Type LOGS = register(new Type<>(DynamicTrees.resLoc("logs"), - DropCreator::appendLogDrops)); - private final TriConsumer appendDropConsumer; - - public Type(ResourceLocation registryName, - TriConsumer appendDropConsumer) { - super(registryName); - this.appendDropConsumer = appendDropConsumer; - } - - @SuppressWarnings("unchecked") - private static Type register(Type type) { - REGISTRY.register((Type) type); - return type; - } - - @SuppressWarnings("unchecked") - public static Class> getGenericClass() { - return (Class>) NULL.getClass(); - } - - public void appendDrops(DropCreatorConfiguration configuration, C context) { - this.appendDropConsumer.accept(configuration.getConfigurable(), configuration, context); - } - } - -} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/DropCreatorConfiguration.java b/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/DropCreatorConfiguration.java deleted file mode 100755 index 9fca70694..000000000 --- a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/DropCreatorConfiguration.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.ferreusveritas.dynamictrees.systems.dropcreators; - -import com.ferreusveritas.dynamictrees.api.configurations.Configuration; -import com.ferreusveritas.dynamictrees.api.configurations.TemplateRegistry; -import com.ferreusveritas.dynamictrees.systems.dropcreators.context.DropContext; - -/** - * @author Harley O'Connor - */ -public final class DropCreatorConfiguration extends Configuration { - - public static final TemplateRegistry TEMPLATES = new TemplateRegistry<>(); - - public DropCreatorConfiguration(DropCreator dropCreator) { - super(dropCreator); - } - - /** - * {@inheritDoc} - * - * @return The copy of this {@link DropCreatorConfiguration}. - */ - @Override - public DropCreatorConfiguration copy() { - final DropCreatorConfiguration duplicateGenFeature = new DropCreatorConfiguration(this.configurable); - duplicateGenFeature.properties.putAll(this.properties); - return duplicateGenFeature; - } - - public void appendDrops(DropCreator.Type type, C context) { - this.configurable.appendDrops(this, type, context); - } - - public static DropCreatorConfiguration getNull() { - return DropCreator.NULL.getDefaultConfiguration(); - } - -} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/DropCreatorManager.java b/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/DropCreatorManager.java deleted file mode 100755 index 7495961b3..000000000 --- a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/DropCreatorManager.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.ferreusveritas.dynamictrees.systems.dropcreators; - -/** - * @author Harley O'Connor - */ -//public final class DropCreatorManager extends JsonRegistryEntryReloadListener { -// -// public DropCreatorManager() { -// super(DropCreator.REGISTRY, "drop_creators", JsonApplierRegistryEvent.DROP_CREATORS); -// } -// -// @Override -// public void registerAppliers() { -// super.registerAppliers(); -// } -// -//} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/DropCreators.java b/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/DropCreators.java deleted file mode 100755 index 7f37787ab..000000000 --- a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/DropCreators.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.ferreusveritas.dynamictrees.systems.dropcreators; - -import com.ferreusveritas.dynamictrees.DynamicTrees; -import com.ferreusveritas.dynamictrees.api.registry.Registry; - -/** - * @author Harley O'Connor - */ -public final class DropCreators { - - public static final DropCreator NORMAL = new NormalDropCreator(DynamicTrees.resLoc("normal")); - public static final DropCreator LOOT_TABLE = new LootTableDropCreator(DynamicTrees.resLoc("loot_table")); - public static final DropCreator SEED = new SeedDropCreator(DynamicTrees.resLoc("seed")); - public static final DropCreator FRUIT = new FruitDropCreator(DynamicTrees.resLoc("fruit")); - public static final DropCreator STICK = new StickDropCreator(DynamicTrees.resLoc("stick")); - public static final DropCreator LOG = new LogDropCreator(DynamicTrees.resLoc("log")); - - public static void register(final Registry registry) { - registry.registerAll(NORMAL, LOOT_TABLE, SEED, FRUIT, STICK, LOG); - } - -} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/FruitDropCreator.java b/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/FruitDropCreator.java deleted file mode 100755 index d3bd83a09..000000000 --- a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/FruitDropCreator.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.ferreusveritas.dynamictrees.systems.dropcreators; - -import com.ferreusveritas.dynamictrees.api.configurations.ConfigurationProperty; -import com.ferreusveritas.dynamictrees.systems.dropcreators.context.DropContext; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.util.ResourceLocation; - -import java.util.List; - -/** - * A drop creator that drops fruit just like Vanilla apples. - * - * @author ferreusveritas - */ -public class FruitDropCreator extends DropCreator { - - public static final ConfigurationProperty FRUIT = ConfigurationProperty.property("fruit_item", ItemStack.class); - - public FruitDropCreator(ResourceLocation registryName) { - super(registryName); - } - - @Override - protected void registerProperties() { - this.register(FRUIT, RARITY); - } - - @Override - protected DropCreatorConfiguration createDefaultConfiguration() { - return super.createDefaultConfiguration() - .with(FRUIT, new ItemStack(Items.APPLE)) - .with(RARITY, 1f); - } - - @Override - public void appendHarvestDrops(DropCreatorConfiguration configuration, DropContext context) { - this.appendFruit(context.drops(), configuration, context); - } - - @Override - public void appendLeavesDrops(DropCreatorConfiguration configuration, DropContext context) { - this.appendFruit(context.drops(), configuration, context); - } - - private void appendFruit(List dropList, DropCreatorConfiguration configuration, DropContext context) { - // More fortune contrivances here. Vanilla compatible returns. - int chance = 200; // 1 in 200 chance of returning an "apple" - if (context.fortune() > 0) { - chance -= 10 << context.fortune(); - if (chance < 40) { - chance = 40; - } - } - - if (context.random().nextInt((int) (chance / configuration.get(RARITY))) == 0) { - dropList.add(configuration.get(FRUIT)); - } - } - -} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/GlobalDropCreators.java b/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/GlobalDropCreators.java deleted file mode 100755 index 827860870..000000000 --- a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/GlobalDropCreators.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.ferreusveritas.dynamictrees.systems.dropcreators; - -import com.ferreusveritas.dynamictrees.systems.dropcreators.context.DropContext; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import net.minecraft.util.ResourceLocation; - -import java.util.List; -import java.util.Map; - -/** - * @author Harley O'Connor - */ -public final class GlobalDropCreators { - - private GlobalDropCreators() {} - - private static final Map ENTRIES = Maps.newHashMap(); - - public static List getAll() { - return Lists.newLinkedList(ENTRIES.values()); - } - - public static void appendAll(final DropCreator.Type type, final C context) { - getAll().forEach(configuration -> configuration.appendDrops(type, context)); - } - - public static DropCreatorConfiguration get(final ResourceLocation registryName) { - return ENTRIES.get(registryName); - } - - public static void put(final ResourceLocation registryName, final DropCreatorConfiguration configuration) { - ENTRIES.put(registryName, configuration); - } - -} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/LogDropCreator.java b/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/LogDropCreator.java deleted file mode 100755 index 1d3d7b558..000000000 --- a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/LogDropCreator.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.ferreusveritas.dynamictrees.systems.dropcreators; - -import com.ferreusveritas.dynamictrees.api.configurations.ConfigurationProperty; -import com.ferreusveritas.dynamictrees.init.DTConfigs; -import com.ferreusveritas.dynamictrees.systems.dropcreators.context.LogDropContext; -import com.ferreusveritas.dynamictrees.systems.nodemappers.NetVolumeNode; -import com.ferreusveritas.dynamictrees.trees.Species; -import com.ferreusveritas.dynamictrees.trees.Species.LogsAndSticks; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; - -public class LogDropCreator extends DropCreator { - - /** - * This works in addition to {@link DTConfigs#TREE_HARVEST_MULTIPLIER}, meant for trees that are too small to drop - * any wood. - */ - public static final ConfigurationProperty MULTIPLIER = ConfigurationProperty.floatProperty("multiplier"); - - public LogDropCreator(ResourceLocation registryName) { - super(registryName); - } - - @Override - protected void registerProperties() { - this.register(MULTIPLIER); - } - - @Override - protected DropCreatorConfiguration createDefaultConfiguration() { - return super.createDefaultConfiguration() - .with(MULTIPLIER, 1.0f); - } - - @Override - public void appendLogDrops(DropCreatorConfiguration configuration, LogDropContext context) { - final Species species = context.species(); - final NetVolumeNode.Volume volume = context.volume(); - volume.multiplyVolume(configuration.get(MULTIPLIER)); - - final LogsAndSticks las = species.getLogsAndSticks(volume); - - int numLogs = las.logs.size(); - if (numLogs > 0) { - context.drops().addAll(las.logs); - } - int numSticks = las.sticks; - if (numSticks > 0) { - final ItemStack stack = species.getFamily().getStick(numSticks); - while (numSticks > 0) { - ItemStack drop = stack.copy(); - drop.setCount(Math.min(numSticks, stack.getMaxStackSize())); - context.drops().add(drop); - numSticks -= stack.getMaxStackSize(); - } - } - } - -} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/LootTableDropCreator.java b/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/LootTableDropCreator.java deleted file mode 100755 index 2d5edb120..000000000 --- a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/LootTableDropCreator.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.ferreusveritas.dynamictrees.systems.dropcreators; - -import com.ferreusveritas.dynamictrees.api.configurations.ConfigurationProperty; -import com.ferreusveritas.dynamictrees.data.DTLootParameterSets; -import com.ferreusveritas.dynamictrees.data.DTLootParameters; -import com.ferreusveritas.dynamictrees.systems.dropcreators.context.DropContext; -import com.ferreusveritas.dynamictrees.systems.dropcreators.context.LogDropContext; -import net.minecraft.loot.LootContext; -import net.minecraft.loot.LootParameters; -import net.minecraft.loot.LootTable; -import net.minecraft.util.ResourceLocation; -import net.minecraft.world.server.ServerWorld; - -/** - * @author Harley O'Connor - */ -public final class LootTableDropCreator extends DropCreator { - - private static final ConfigurationProperty HARVEST_TABLE = ConfigurationProperty.property("harvest_table", ResourceLocation.class); - private static final ConfigurationProperty VOLUNTARY_TABLE = ConfigurationProperty.property("voluntary_table", ResourceLocation.class); - private static final ConfigurationProperty LEAVES_TABLE = ConfigurationProperty.property("leaves_table", ResourceLocation.class); - private static final ConfigurationProperty LOGS_TABLE = ConfigurationProperty.property("logs_table", ResourceLocation.class); - - public LootTableDropCreator(ResourceLocation registryName) { - super(registryName); - } - - @Override - protected void registerProperties() { - this.register(HARVEST_TABLE, VOLUNTARY_TABLE, LEAVES_TABLE, LOGS_TABLE); - } - - @Override - protected DropCreatorConfiguration createDefaultConfiguration() { - return super.createDefaultConfiguration() - .with(HARVEST_TABLE, LootTable.EMPTY.getLootTableId()) - .with(VOLUNTARY_TABLE, LootTable.EMPTY.getLootTableId()) - .with(LEAVES_TABLE, LootTable.EMPTY.getLootTableId()) - .with(LOGS_TABLE, LootTable.EMPTY.getLootTableId()); - } - - @Override - public void appendHarvestDrops(DropCreatorConfiguration configuration, DropContext context) { - context.drops().addAll(((ServerWorld) context.world()).getServer().getLootTables().get(configuration.get(HARVEST_TABLE)) - .getRandomItems(new LootContext.Builder((ServerWorld) context.world()) - .withParameter(LootParameters.BLOCK_STATE, context.world().getBlockState(context.pos())) - .withParameter(DTLootParameters.SPECIES, context.species()) - .withParameter(DTLootParameters.FERTILITY, context.fertility()) - .withParameter(DTLootParameters.FORTUNE, context.fortune()) - .create(DTLootParameterSets.HARVEST) - ) - ); - } - - @Override - public void appendVoluntaryDrops(DropCreatorConfiguration configuration, DropContext context) { - context.drops().addAll(((ServerWorld) context.world()).getServer().getLootTables().get(configuration.get(VOLUNTARY_TABLE)) - .getRandomItems(new LootContext.Builder((ServerWorld) context.world()) - .withParameter(LootParameters.BLOCK_STATE, context.world().getBlockState(context.pos())) - .withParameter(DTLootParameters.SPECIES, context.species()) - .withParameter(DTLootParameters.FERTILITY, context.fertility()) - .create(DTLootParameterSets.VOLUNTARY) - ) - ); - } - - @Override - public void appendLeavesDrops(DropCreatorConfiguration configuration, DropContext context) { - context.drops().addAll(((ServerWorld) context.world()).getServer().getLootTables().get(configuration.get(LEAVES_TABLE)) - .getRandomItems(new LootContext.Builder((ServerWorld) context.world()) - .withParameter(LootParameters.BLOCK_STATE, context.world().getBlockState(context.pos())) - .withParameter(LootParameters.TOOL, context.tool()) - .withParameter(DTLootParameters.SPECIES, context.species()) - .withParameter(DTLootParameters.FORTUNE, context.fortune()) - .create(DTLootParameterSets.LEAVES) - ) - ); - } - - @Override - public void appendLogDrops(DropCreatorConfiguration configuration, LogDropContext context) { - context.drops().addAll(((ServerWorld) context.world()).getServer().getLootTables().get(configuration.get(LOGS_TABLE)) - .getRandomItems(new LootContext.Builder((ServerWorld) context.world()) - .withParameter(LootParameters.BLOCK_STATE, context.world().getBlockState(context.pos())) - .withParameter(LootParameters.TOOL, context.tool()) - .withParameter(DTLootParameters.SPECIES, context.species()) - .withParameter(DTLootParameters.LOGS_AND_STICKS, context.species().getLogsAndSticks(context.volume())) - .create(DTLootParameterSets.LOGS) - ) - ); - } - -} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/NormalDropCreator.java b/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/NormalDropCreator.java deleted file mode 100755 index e1ead1dc2..000000000 --- a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/NormalDropCreator.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.ferreusveritas.dynamictrees.systems.dropcreators; - -import com.ferreusveritas.dynamictrees.api.configurations.ConfigurationProperty; -import com.ferreusveritas.dynamictrees.deserialisation.JsonDeserialisers; -import com.ferreusveritas.dynamictrees.deserialisation.MapDeserialiser; -import com.ferreusveritas.dynamictrees.systems.dropcreators.context.DropContext; -import com.ferreusveritas.dynamictrees.systems.dropcreators.context.LogDropContext; -import com.ferreusveritas.dynamictrees.systems.dropcreators.drops.Drops; -import com.google.common.collect.Maps; -import net.minecraft.util.ResourceLocation; - -import java.util.HashMap; -import java.util.Map; - -/** - * @author Harley O'Connor - */ -public final class NormalDropCreator extends DropCreator { - - @SuppressWarnings("all") - public static final ConfigurationProperty, Drops>> DROP_MAP = ConfigurationProperty.property("drops", - MapDeserialiser.getMapClass(Type.getGenericClass(), Drops.class, HashMap::new)); - - static { - JsonDeserialisers.register( - MapDeserialiser.getMapClass(Type.getGenericClass(), Drops.class), - new MapDeserialiser<>(JsonDeserialisers.DROP_TYPE, JsonDeserialisers.DROPS) - ); - } - - public NormalDropCreator(ResourceLocation registryName) { - super(registryName); - } - - @Override - protected void registerProperties() { - this.register(DROP_MAP); - } - - @Override - protected DropCreatorConfiguration createDefaultConfiguration() { - return super.createDefaultConfiguration() - .with(DROP_MAP, Maps.newHashMap()); - } - - @Override - public void appendHarvestDrops(DropCreatorConfiguration configuration, DropContext context) { - configuration.get(DROP_MAP).getOrDefault(Type.HARVEST, Drops.NONE) - .appendDrops(context.drops(), context.random(), context.fortune()); - } - - @Override - public void appendVoluntaryDrops(DropCreatorConfiguration configuration, DropContext context) { - configuration.get(DROP_MAP).getOrDefault(Type.VOLUNTARY, Drops.NONE) - .appendDrops(context.drops(), context.random(), 0); - } - - @Override - public void appendLeavesDrops(DropCreatorConfiguration configuration, DropContext context) { - configuration.get(DROP_MAP).getOrDefault(Type.LEAVES, Drops.NONE) - .appendDrops(context.drops(), context.random(), context.fortune()); - } - - @Override - public void appendLogDrops(DropCreatorConfiguration configuration, LogDropContext context) { - configuration.get(DROP_MAP).getOrDefault(Type.LOGS, Drops.NONE) - .appendDrops(context.drops(), context.random(), 0); - } - -} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/SeedDropCreator.java b/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/SeedDropCreator.java deleted file mode 100755 index b1bc521cd..000000000 --- a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/SeedDropCreator.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.ferreusveritas.dynamictrees.systems.dropcreators; - -import com.ferreusveritas.dynamictrees.api.configurations.ConfigurationProperty; -import com.ferreusveritas.dynamictrees.event.VoluntarySeedDropEvent; -import com.ferreusveritas.dynamictrees.init.DTConfigs; -import com.ferreusveritas.dynamictrees.systems.dropcreators.context.DropContext; -import com.ferreusveritas.dynamictrees.trees.Species; -import com.ferreusveritas.dynamictrees.util.WorldContext; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.common.MinecraftForge; - -public class SeedDropCreator extends DropCreator { - - public static final ConfigurationProperty HARVEST_RARITY = ConfigurationProperty.floatProperty("harvest_rarity"); - public static final ConfigurationProperty VOLUNTARY_RARITY = ConfigurationProperty.floatProperty("voluntary_rarity"); - public static final ConfigurationProperty LEAVES_RARITY = ConfigurationProperty.floatProperty("leaves_rarity"); - /** - * Allows a custom seed to be set, for example, tree A may want to drop the seed of tree B. - */ - public static final ConfigurationProperty SEED = ConfigurationProperty.property("seed", ItemStack.class); - - public SeedDropCreator(ResourceLocation registryName) { - super(registryName); - } - - // Allows for overriding species seed drop if a custom seed is set. - protected ItemStack getSeedStack(Species species, DropCreatorConfiguration configuration) { - final ItemStack customSeed = configuration.get(SEED); - return customSeed.isEmpty() ? species.getSeedStack(1) : customSeed; - } - - @Override - protected void registerProperties() { - this.register(RARITY, HARVEST_RARITY, VOLUNTARY_RARITY, LEAVES_RARITY, SEED); - } - - @Override - protected DropCreatorConfiguration createDefaultConfiguration() { - return super.createDefaultConfiguration() - .with(RARITY, 1f) - .with(HARVEST_RARITY, -1f) - .with(VOLUNTARY_RARITY, -1f) - .with(LEAVES_RARITY, -1f) - .with(SEED, ItemStack.EMPTY); - } - - private float rarityOrDefault(DropCreatorConfiguration configuration, ConfigurationProperty rarityProperty) { - final float rarityOverride = configuration.get(rarityProperty); - return rarityOverride == -1f ? configuration.get(RARITY) : rarityOverride; - } - - @Override - public void appendHarvestDrops(DropCreatorConfiguration configuration, DropContext context) { - float rarity = this.rarityOrDefault(configuration, HARVEST_RARITY); - rarity *= (context.fortune() + 1) / 64f; - rarity *= Math.min(context.species().seasonalSeedDropFactor(WorldContext.create(context.world()), context.pos()) + 0.15f, 1.0); - - if (rarity > context.random().nextFloat()) {//1 in 64 chance to drop a seed on destruction.. - context.drops().add(getSeedStack(context.species(), configuration)); - } - } - - @Override - public void appendVoluntaryDrops(DropCreatorConfiguration configuration, DropContext context) { - if (this.rarityOrDefault(configuration, VOLUNTARY_RARITY) * DTConfigs.SEED_DROP_RATE.get() * - context.species().seasonalSeedDropFactor(WorldContext.create(context.world()), context.pos()) - > context.random().nextFloat()) { - context.drops().add(getSeedStack(context.species(), configuration)); - VoluntarySeedDropEvent seedDropEvent = new VoluntarySeedDropEvent(context.world(), context.pos(), context.species(), context.drops()); - MinecraftForge.EVENT_BUS.post(seedDropEvent); - if (seedDropEvent.isCanceled()) { - context.drops().clear(); - } - } - } - - @Override - public void appendLeavesDrops(DropCreatorConfiguration configuration, DropContext context) { - int chance = 20; // See BlockLeaves#getSaplingDropChance(state); - // Hokey fortune stuff here to match Vanilla logic. - if (context.fortune() > 0) { - chance -= 2 << context.fortune(); - if (chance < 10) { - chance = 10; - } - } - - float seasonFactor = 1.0f; - - if (!context.world().isClientSide) { - seasonFactor = context.species().seasonalSeedDropFactor(WorldContext.create(context.world()), context.pos()); - } - - if (context.random().nextInt((int) (chance / this.rarityOrDefault(configuration, LEAVES_RARITY))) == 0) { - if (seasonFactor > context.random().nextFloat()) { - context.drops().add(this.getSeedStack(context.species(), configuration)); - } - } - } - -} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/StickDropCreator.java b/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/StickDropCreator.java deleted file mode 100755 index 5369809eb..000000000 --- a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/StickDropCreator.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.ferreusveritas.dynamictrees.systems.dropcreators; - -import com.ferreusveritas.dynamictrees.api.configurations.ConfigurationProperty; -import com.ferreusveritas.dynamictrees.systems.dropcreators.context.DropContext; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.util.ResourceLocation; - -/** - * A drop creator for the sticks that can be harvested from leaves. Rarity of 1 equals a 1/50 chance of getting between - * {1 - maxCount} sticks. - * - * @author Max Hyper - */ -public class StickDropCreator extends DropCreator { - - public static final ConfigurationProperty STICK = ConfigurationProperty.property("stick", ItemStack.class); - public static final ConfigurationProperty MAX_COUNT = ConfigurationProperty.integer("max_count"); - - public static final ItemStack STICK_STACK = new ItemStack(Items.STICK); - - public StickDropCreator(ResourceLocation registryName) { - super(registryName); - } - - @Override - protected void registerProperties() { - this.register(STICK, RARITY, MAX_COUNT); - } - - @Override - protected DropCreatorConfiguration createDefaultConfiguration() { - return super.createDefaultConfiguration() - .with(STICK, STICK_STACK) - .with(RARITY, 1f) - .with(MAX_COUNT, 2); - } - - @Override - public void appendLeavesDrops(DropCreatorConfiguration configuration, DropContext context) { - this.appendSticks(configuration, context); - } - - @Override - public void appendHarvestDrops(DropCreatorConfiguration configuration, DropContext context) { - this.appendSticks(configuration, context); - } - - private void appendSticks(DropCreatorConfiguration configuration, DropContext context) { - int chance = 50; - if (context.fortune() > 0) { - chance -= 2 << context.fortune(); - if (chance < 10) { - chance = 10; - } - } - if (context.random().nextInt((int) (chance / configuration.get(RARITY))) == 0) { - int num = 1 + context.random().nextInt(configuration.get(MAX_COUNT)); - if (num > 0) { - final ItemStack stack = configuration.getOrInvalidDefault(STICK, stick -> stick != ItemStack.EMPTY, - context.species().getSeedStack(1)); - while (num > 0) { - ItemStack drop = stack.copy(); - drop.setCount(Math.min(num, stack.getMaxStackSize())); - context.drops().add(drop); - num -= stack.getMaxStackSize(); - } - } - } - } - -} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/context/DropContext.java b/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/context/DropContext.java deleted file mode 100755 index febb62cbf..000000000 --- a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/context/DropContext.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.ferreusveritas.dynamictrees.systems.dropcreators.context; - -import com.ferreusveritas.dynamictrees.trees.Species; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import javax.annotation.Nullable; -import java.util.List; -import java.util.Random; - -/** - * Defines context variables about a specific drop. - * - * @author Harley O'Connor - */ -public class DropContext { - - private final World world; - private final Random random; - private final BlockPos pos; - - private final Species species; - private final List dropList; - - private final ItemStack tool; - private final int fertility; - private final int fortune; - - public DropContext(@Nullable World world, BlockPos pos, Species species, List dropList) { - this(world, pos, species, dropList, ItemStack.EMPTY, -1, 0); - } - - public DropContext(World world, Random random, BlockPos pos, Species species, List dropList, int fertility, int fortune) { - this(world, pos, species, dropList, ItemStack.EMPTY, fertility, fortune); - } - - public DropContext(@Nullable World world, BlockPos pos, Species species, List dropList, ItemStack tool, int fertility, int fortune) { - this.world = world; - this.random = world == null ? new Random() : world.random; - this.pos = pos; - this.species = species; - this.dropList = dropList; - this.tool = tool; - this.fertility = fertility; - this.fortune = fortune; - } - - public World world() { - return world; - } - - public Random random() { - return this.random; - } - - public BlockPos pos() { - return pos; - } - - public Species species() { - return species; - } - - public List drops() { - return dropList; - } - - public ItemStack tool() { - return tool; - } - - /** - * Returns the fertility of the relevant tree, or {@code -1} if it was not available. - * - * @return The fertility of the related tree, or {@code -1} if it was unavailable. - */ - public int fertility() { - return fertility; - } - - public int fortune() { - return fortune; - } - -} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/context/LogDropContext.java b/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/context/LogDropContext.java deleted file mode 100755 index 0a9d3bc95..000000000 --- a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/context/LogDropContext.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.ferreusveritas.dynamictrees.systems.dropcreators.context; - -import com.ferreusveritas.dynamictrees.systems.nodemappers.NetVolumeNode; -import com.ferreusveritas.dynamictrees.trees.Species; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import java.util.List; - -/** - * @author Harley O'Connor - */ -public class LogDropContext extends DropContext { - - private final NetVolumeNode.Volume volume; - - public LogDropContext(World world, BlockPos pos, Species species, List dropList, NetVolumeNode.Volume volume, ItemStack tool) { - super(world, pos, species, dropList, tool, -1, 0); - this.volume = volume; - } - - public NetVolumeNode.Volume volume() { - return volume; - } - -} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/drops/Drops.java b/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/drops/Drops.java deleted file mode 100755 index 4230b35dd..000000000 --- a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/drops/Drops.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.ferreusveritas.dynamictrees.systems.dropcreators.drops; - -import com.mojang.serialization.Codec; -import com.mojang.serialization.DataResult; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.registries.ForgeRegistries; - -import java.util.List; -import java.util.Random; - -/** - * @author Harley O'Connor - */ -@FunctionalInterface -public interface Drops { - - Codec ITEM_CODEC = ResourceLocation.CODEC.comapFlatMap(registryName -> { - final Item item = ForgeRegistries.ITEMS.getValue(registryName); - return item == null ? DataResult.error("Could not find item for registry name \"" + registryName + "\".") : - DataResult.success(item); - }, Item::getRegistryName); - - Drops NONE = (drops, random, fortune) -> { - }; - - void appendDrops(List drops, Random random, int fortune); - - static int getChance(int fortune, int baseChance) { - if (baseChance <= 1) { - return baseChance; - } - int chance = baseChance; - if (fortune > 0) { - chance -= 10 << fortune; - if (chance < 40) { - chance = 40; - } - } - return chance; - } - -} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/drops/StackDrops.java b/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/drops/StackDrops.java deleted file mode 100755 index f78afc456..000000000 --- a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/drops/StackDrops.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.ferreusveritas.dynamictrees.systems.dropcreators.drops; - -import com.google.common.collect.Lists; -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.item.ItemStack; - -import java.util.List; -import java.util.Random; - -/** - * Each item individually attempts to drop with a global rarity. Can drop multiple items, or none. - * - * @author Harley O'Connor - */ -public final class StackDrops implements Drops { - - public static final Codec CODEC = RecordCodecBuilder.create(instance -> - instance.group( - //The item stack codec requires the "Count" key to be capitalized. No clue why. - Codec.list(ItemStack.CODEC).fieldOf("items") - .forGetter(StackDrops::getItems), - Codec.FLOAT.optionalFieldOf("rarity", 1f) - .forGetter(StackDrops::getRarity), - Codec.INT.optionalFieldOf("chance", 200) - .forGetter(StackDrops::getBaseChance) - ).apply(instance, StackDrops::new) - ); - - /** - * A {@link List} of {@link ItemStack}s to drop. - */ - private final List items; - - /** - * The rarity of the item. This is what the chance will be divided by. - */ - private final float rarity; - - /** - * The base chance of dropping each item. This will be altered depending on the fortune level. - */ - private final int baseChance; - - public StackDrops(List items, float rarity, int baseChance) { - this.items = items; - this.rarity = rarity; - this.baseChance = baseChance; - } - - public List getItems() { - return items; - } - - public float getRarity() { - return rarity; - } - - public int getBaseChance() { - return baseChance; - } - - @Override - public void appendDrops(List drops, Random random, int fortune) { - final int chance = Drops.getChance(fortune, this.baseChance); - - if (this.rarity > 0) { - this.items.forEach(stack -> { - if (random.nextInt(Math.max((int) (chance / this.rarity), 1)) == 0) { - drops.add(stack.copy()); - } - }); - } - } - - public static Drops create(float rarity, int baseChance, ItemStack... stacks) { - return new StackDrops(Lists.newLinkedList(Lists.newArrayList(stacks)), rarity, baseChance); - } - -} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/drops/WeightedDrops.java b/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/drops/WeightedDrops.java deleted file mode 100755 index f18729fd2..000000000 --- a/src/main/java/com/ferreusveritas/dynamictrees/systems/dropcreators/drops/WeightedDrops.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.ferreusveritas.dynamictrees.systems.dropcreators.drops; - -import com.ferreusveritas.dynamictrees.util.MathHelper; -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.WeightedList; - -import java.util.List; -import java.util.Map; -import java.util.Random; - -/** - * Can drop only one item picked randomly from the selection of all items with weighted odds. - * - * @author Max Hyper - */ -public final class WeightedDrops implements Drops { - - public static final Codec CODEC = RecordCodecBuilder.create(instance -> - instance.group( - Codec.unboundedMap(ITEM_CODEC, Codec.INT).fieldOf("items") - .forGetter(WeightedDrops::getItems), - Codec.FLOAT.optionalFieldOf("rarity", 1f) - .forGetter(WeightedDrops::getRarity), - Codec.INT.optionalFieldOf("chance", 200) - .forGetter(WeightedDrops::getBaseChance), - Codec.INT.optionalFieldOf("min_count", 1) - .forGetter(WeightedDrops::getMinAttempts), - Codec.INT.optionalFieldOf("max_count", 1) - .forGetter(WeightedDrops::getMaxAttempts) - ).apply(instance, WeightedDrops::new) - ); - - /** - * A {@link Map} of {@link Item}s to drop and their weight. - */ - private final Map items; - - /** - * The rarity of the item. This is what the chance will be divided by. - */ - private final float rarity; - - /** - * The base chance of dropping an item. This will be altered depending on the fortune level. - */ - private final int baseChance; - - /** - * The minimum times an item is attempted to be added to the drops. - */ - private final int minAttempts; - - /** - * The maximum times an item is attempted to be added to the drops. - */ - private final int maxAttempts; - - public WeightedDrops(Map items, float rarity, int baseChance, int minAttempts, int maxAttempts) { - this.items = items; - this.rarity = rarity; - this.baseChance = baseChance; - this.minAttempts = minAttempts; - this.maxAttempts = maxAttempts; - } - - public Map getItems() { - return items; - } - - public float getRarity() { - return rarity; - } - - public int getBaseChance() { - return baseChance; - } - - public int getMinAttempts() { - return minAttempts; - } - - public int getMaxAttempts() { - return maxAttempts; - } - - public void addItem(final Item item, final int weight) { - this.items.put(item, weight); - } - - @Override - public void appendDrops(List drops, Random random, int fortune) { - final int chance = Drops.getChance(fortune, this.baseChance); - final int attempts = MathHelper.randomBetween(random, this.minAttempts, this.maxAttempts); - - WeightedList list = new WeightedList<>(); - this.items.forEach(list::add); - for (int i = 0; i < attempts; i++) { - if (random.nextInt(Math.max((int) (chance / this.rarity), 1)) == 0) { - drops.add(new ItemStack(list.getOne(random))); - } - } - - } - -} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/trees/Family.java b/src/main/java/com/ferreusveritas/dynamictrees/trees/Family.java index 7ff13056b..8feab9624 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/trees/Family.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/trees/Family.java @@ -661,6 +661,14 @@ public void setHasStrippedBranch(boolean hasStrippedBranch) { this.hasStrippedBranch = hasStrippedBranch; } + public List getValidBranchBlocks() { + return Collections.unmodifiableList(validBranches); + } + + public int getNumberOfValidBranchBlocks() { + return validBranches.size(); + } + public void addValidBranches(BranchBlock... branches) { this.validBranches.addAll(Arrays.asList(branches)); } diff --git a/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java b/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java index 60c8a2cc9..a83768f03 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java @@ -29,6 +29,7 @@ import com.ferreusveritas.dynamictrees.data.DTItemTags; import com.ferreusveritas.dynamictrees.data.provider.DTBlockStateProvider; import com.ferreusveritas.dynamictrees.data.provider.DTItemModelProvider; +import com.ferreusveritas.dynamictrees.data.provider.DTLootTableProvider; import com.ferreusveritas.dynamictrees.entities.FallingTreeEntity; import com.ferreusveritas.dynamictrees.entities.LingeringEffectorEntity; import com.ferreusveritas.dynamictrees.entities.animation.AnimationHandler; @@ -40,16 +41,12 @@ import com.ferreusveritas.dynamictrees.init.DTRegistries; import com.ferreusveritas.dynamictrees.init.DTTrees; import com.ferreusveritas.dynamictrees.items.Seed; +import com.ferreusveritas.dynamictrees.loot.DTLootParameterSets; +import com.ferreusveritas.dynamictrees.loot.DTLootParameters; import com.ferreusveritas.dynamictrees.models.FallingTreeEntityModel; import com.ferreusveritas.dynamictrees.resources.Resources; import com.ferreusveritas.dynamictrees.systems.GrowSignal; import com.ferreusveritas.dynamictrees.systems.SeedSaplingRecipe; -import com.ferreusveritas.dynamictrees.systems.dropcreators.DropCreator; -import com.ferreusveritas.dynamictrees.systems.dropcreators.DropCreatorConfiguration; -import com.ferreusveritas.dynamictrees.systems.dropcreators.DropCreators; -import com.ferreusveritas.dynamictrees.systems.dropcreators.GlobalDropCreators; -import com.ferreusveritas.dynamictrees.systems.dropcreators.SeedDropCreator; -import com.ferreusveritas.dynamictrees.systems.dropcreators.context.DropContext; import com.ferreusveritas.dynamictrees.systems.fruit.Fruit; import com.ferreusveritas.dynamictrees.systems.genfeatures.GenFeature; import com.ferreusveritas.dynamictrees.systems.genfeatures.GenFeatureConfiguration; @@ -71,6 +68,7 @@ import com.ferreusveritas.dynamictrees.util.BranchDestructionData; import com.ferreusveritas.dynamictrees.util.CommonVoxelShapes; import com.ferreusveritas.dynamictrees.util.CoordUtils; +import com.ferreusveritas.dynamictrees.util.LazyValue; import com.ferreusveritas.dynamictrees.util.MutableLazyValue; import com.ferreusveritas.dynamictrees.util.Optionals; import com.ferreusveritas.dynamictrees.util.ResourceLocationUtils; @@ -93,6 +91,11 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; +import net.minecraft.loot.LootContext; +import net.minecraft.loot.LootParameterSets; +import net.minecraft.loot.LootParameters; +import net.minecraft.loot.LootTable; +import net.minecraft.loot.LootTableManager; import net.minecraft.tags.ITag; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction; @@ -121,7 +124,6 @@ import javax.annotation.Nullable; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -138,9 +140,10 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.BiConsumer; import java.util.function.BiPredicate; +import java.util.function.Function; import java.util.stream.Collectors; -import static com.ferreusveritas.dynamictrees.systems.dropcreators.DropCreator.RARITY; +import static net.minecraft.loot.LootTable.EMPTY; public class Species extends RegistryEntry implements Resettable { @@ -177,11 +180,6 @@ public float biomeSuitability(World world, BlockPos pos) { return 0.0f; } - @Override - public Species addDropCreators(DropCreator... dropCreators) { - return this; - } - @Override public Species setSeed(Seed seed) { return this; @@ -192,11 +190,6 @@ public ItemStack getSeedStack(int qty) { return ItemStack.EMPTY; } - @Override - public Species setupStandardSeedDropping() { - return this; - } - @Override public ITextComponent getTextComponent() { return this.formatComponent(new TranslationTextComponent("gui.none"), TextFormatting.DARK_RED); @@ -306,8 +299,6 @@ public static Codec createDefaultCodec( */ protected DynamicSaplingBlock saplingBlock; - protected List dropCreators = new ArrayList<>(); - //WorldGen /** * A map of environmental biome factors that change a tree's suitability @@ -372,7 +363,6 @@ public Species reset() { this.pods.clear(); this.envFactors.clear(); this.genFeatures.clear(); - this.dropCreators.clear(); this.acceptableBlocksForGrowth.clear(); this.primitiveSaplingRecipe.clear(); this.perfectBiomes.clear(); @@ -392,7 +382,7 @@ public Species setPreReloadDefaults() { return this.setDefaultGrowingParameters() .setSaplingShape(CommonVoxelShapes.SAPLING) .setSaplingSound(SoundType.GRASS) - .addDropCreators(DropCreators.LOG, DropCreators.STICK, DropCreators.SEED); + .setSeedChances(new float[]{0.05F, 0.0625F, 0.083333336F, 0.1F}); } /** @@ -452,8 +442,8 @@ public Species getCommonSpecies() { } /** - * Checks if this {@link Species} is the common species of its {@link Family} (it equals {@link - * Family#commonSpecies}). + * Checks if this {@link Species} is the common species of its {@link Family} (it equals + * {@link Family#commonSpecies}). * * @return {@code true} if this species is the common of {@link #family}; {@code false} otherwise. */ @@ -465,8 +455,8 @@ public boolean isCommonSpecies() { * Checks whether or not {@link #seed} is the same instance as the {@link Seed} of the common {@link Species} of the * owning {@link Family}. * - * @return {@code true} if {@link #seed} {@code ==} the {@link Seed} of the common {@link Species} of {@link - * #family}; {@code false} otherwise. + * @return {@code true} if {@link #seed} {@code ==} the {@link Seed} of the common {@link Species} of + * {@link #family}; {@code false} otherwise. */ public boolean isSeedCommon() { return this.getCommonSpecies().getSeed().orElse(null) == this.seed; @@ -740,8 +730,8 @@ public void setSeedName(String name) { } /** - * Generates and registers a {@link Seed} item for this species. Note that it will only be generated if {@link - * #shouldGenerateSeed} is {@code true}. + * Generates and registers a {@link Seed} item for this species. Note that it will only be generated if + * {@link #shouldGenerateSeed} is {@code true}. * * @return This {@link Species} object for chaining. */ @@ -762,78 +752,120 @@ public Species setSeed(final Seed seed) { } /** - * Sets up a standardized drop system for Harvest, Voluntary, and Leaves Drops. - *

- * Typically called in the constructor + * Chances for leaves to drop seeds. Used in data gen for loot tables. */ - @Deprecated - public Species setupStandardSeedDropping() { - this.addDropCreators(DropCreators.SEED.getDefaultConfiguration()); + private float[] seedChances = new float[]{0.05F, 0.0625F, 0.083333336F, 0.1F}; + + public Species setSeedChances(float[] seedChances) { + this.seedChances = (float[]) seedChances; return this; } - @Deprecated - public Species setupStandardSeedDropping(float rarity) { -// this.addDropCreators(DropCreators.SEED.with(RARITY, rarity)); - LogManager.getLogger() - .warn("Deprecated use of `stick_drop_rarity` property by Species `" + this.getRegistryName() + - "`. This is ineffectual and will be removed in a future version of DT in favour of the `drop_creators` list property."); + public Species setSeedChances(Collection seedChances) { + this.seedChances = new float[seedChances.size()]; + Iterator iterator = seedChances.iterator(); + for (int i = 0; i < seedChances.size(); i++) { + this.seedChances[i] = iterator.next(); + } return this; } - /** - * Same as setupStandardSeedDropping except it allows for a custom seed item. - */ - @Deprecated - public Species setupCustomSeedDropping(ItemStack customSeed) { - this.addDropCreators(DropCreators.SEED.with(SeedDropCreator.SEED, customSeed)); - return this; + public List getLeavesDrops(World world, BlockPos pos, ItemStack tool) { + if (world.isClientSide) { + return Collections.emptyList(); + } + return getLootTable(world.getServer().getLootTables(), species -> species.leavesDropsPath.get()) + .getRandomItems(createLeavesLootContext(world, pos, tool)); } - @Deprecated - public Species setupCustomSeedDropping(ItemStack customSeed, float rarity) { - this.addDropCreators(DropCreators.SEED.with(SeedDropCreator.SEED, customSeed).with(RARITY, rarity)); - return this; + private LootContext createLeavesLootContext(World world, BlockPos pos, ItemStack tool) { + return new LootContext.Builder(WorldContext.getServerWorldOrThrow(world)) + .withParameter(LootParameters.BLOCK_STATE, world.getBlockState(pos)) + .withParameter(DTLootParameters.SEASONAL_SEED_DROP_FACTOR, seasonalSeedDropFactor(WorldContext.create(world), pos)) + .withParameter(LootParameters.TOOL, tool) + .create(DTLootParameterSets.LEAVES); } - @Deprecated - public Species setupStandardStickDropping() { - return this.setupStandardStickDropping(1); + public List getVoluntaryDrops(World world, BlockPos rootPos, int fertility) { + if (world.isClientSide) { + return Collections.emptyList(); + } + return getLootTable(world.getServer().getLootTables(), species -> species.voluntaryDropsPath.get()) + .getRandomItems(createVoluntaryLootContext(world, rootPos, fertility)); } - @Deprecated - public Species setupStandardStickDropping(float rarity) { -// this.addDropCreators(DropCreators.STICK.with(RARITY, rarity)); - LogManager.getLogger() - .warn("Deprecated use of `stick_drop_rarity` property by Species `" + this.getRegistryName() + - "`. This is ineffectual and will be removed in a future version of DT in favour of the `drop_creators` list property."); - return this; + private LootContext createVoluntaryLootContext(World world, BlockPos rootPos, int fertility) { + return new LootContext.Builder(WorldContext.getServerWorldOrThrow(world)) + .withParameter(LootParameters.BLOCK_STATE, world.getBlockState(rootPos)) + .withParameter(DTLootParameters.SEASONAL_SEED_DROP_FACTOR, + seasonalSeedDropFactor(WorldContext.create(world), rootPos)) + .withParameter(DTLootParameters.FERTILITY, fertility) + .create(DTLootParameterSets.VOLUNTARY); } - public Species addDropCreators(DropCreator... dropCreators) { - Arrays.stream(dropCreators).forEach(dropCreator -> - this.dropCreators.add(dropCreator.getDefaultConfiguration())); - return this; + public LootTable getLootTable(LootTableManager lootTables, Function nameFunction) { + final LootTable table = lootTables.get(nameFunction.apply(this)); + return table == EMPTY ? (this.isCommonSpecies() ? lootTables.get(nameFunction.apply(getCommonSpecies())) : EMPTY) : table; } - public boolean addDropCreators(DropCreatorConfiguration... dropCreators) { - this.dropCreators.addAll(Arrays.asList(dropCreators)); - return true; + public List getWoodDrops(World world, BlockPos pos, NetVolumeNode.Volume volume) { + return getWoodDrops(world, pos, volume, ItemStack.EMPTY); } - public boolean removeDropCreator(ResourceLocation registryName) { - return this.dropCreators.removeIf(dropCreator -> - dropCreator.getConfigurable().getRegistryName().equals(registryName)); + public List getWoodDrops(World world, BlockPos pos, NetVolumeNode.Volume volume, ItemStack tool) { + return getWoodDrops(world, pos, volume, tool, null); } - public List getDropCreators() { - return this.dropCreators; + public List getWoodDrops(World world, BlockPos pos, NetVolumeNode.Volume volume, + ItemStack tool, @Nullable Float explosionRadius) { + volume.multiplyVolume(DTConfigs.TREE_HARVEST_MULTIPLIER.get()); // For cheaters.. you know who you are. + if (world.isClientSide) { + return Collections.emptyList(); + } + final List drops = new ArrayList<>(); + for (int i = 0; i < family.getNumberOfValidBranchBlocks(); i++) { + int branchVolume = volume.getRawVolume(i); + if (branchVolume > 0) { + final BranchBlock branchBlock = family.getValidBranchBlock(i); + drops.addAll(getDropsForBranch(world, tool, explosionRadius, branchVolume, branchBlock)); + } + } + cleanDropsList(drops); + return drops; } - public List getDrops(final DropCreator.Type type, final C context) { - GlobalDropCreators.appendAll(type, context); - this.dropCreators.forEach(configuration -> configuration.appendDrops(type, context)); - return context.drops(); + private List getDropsForBranch(World world, ItemStack tool, @Nullable Float explosionRadius, + int branchVolume, BranchBlock branchBlock) { + return world.getServer().getLootTables().get(branchBlock.getLootTableName()) + .getRandomItems(createWoodLootContext(world, branchVolume, tool, explosionRadius)); + } + + /** + * Cleans specified drop list by dividing any stacks with a count exceeding the maximum stack size into multiple + * stacks of the same item. + */ + private void cleanDropsList(List drops) { + for (int i = 0; i < drops.size(); i++) { + ItemStack drop = drops.get(i); + if (drop.getItem() == Items.AIR) { + drops.remove(i--); + } + if (drop.getCount() > drop.getMaxStackSize()) { + final ItemStack copiedStack = drop.copy(); + copiedStack.setCount(drop.getCount() - drop.getMaxStackSize()); + drops.add(copiedStack); + drop.setCount(drop.getMaxStackSize()); + } + } + } + + private LootContext createWoodLootContext(World world, int volume, ItemStack tool, + @Nullable Float explosionRadius) { + return new LootContext.Builder(WorldContext.getServerWorldOrThrow(world)) + .withParameter(LootParameters.TOOL, tool) + .withParameter(DTLootParameters.VOLUME, volume) + .withOptionalParameter(LootParameters.EXPLOSION_RADIUS, explosionRadius) + .create(DTLootParameterSets.WOOD); } public static class LogsAndSticks { @@ -878,10 +910,7 @@ public boolean handleVoluntaryDrops(World world, List endPoints, Block if (tickSpeed > 0) { double slowFactor = 3.0 / tickSpeed;//This is an attempt to normalize voluntary drop rates. if (world.random.nextDouble() < slowFactor) { - final List drops = this.getDrops( - DropCreator.Type.VOLUNTARY, - new DropContext(world, world.random, rootPos, this, new LinkedList<>(), fertility, 0) - ); + final List drops = getVoluntaryDrops(world, rootPos, fertility); if (!drops.isEmpty() && !endPoints.isEmpty()) { for (ItemStack drop : drops) { @@ -985,8 +1014,8 @@ public Optional getSapling() { } /** - * Returns the {@link Species} override for the specified {@link BlockPos} in the specified {@link World} if {@link - * #shouldUseLocationOverride()}, or returns {@code this} {@link Species} otherwise. + * Returns the {@link Species} override for the specified {@link BlockPos} in the specified {@link World} if + * {@link #shouldUseLocationOverride()}, or returns {@code this} {@link Species} otherwise. * * @param world The {@link IWorld} to check for the override in. * @param pos The {@link BlockPos} to check. @@ -1446,8 +1475,8 @@ public boolean rot(IWorld world, BlockPos pos, int neighborCount, int radius, in } /** - * @deprecated No longe in use due to extra parameter. Use/override {@link #rot(IWorld, BlockPos, int, int, int, - * Random, boolean, boolean)} instead. + * @deprecated No longe in use due to extra parameter. Use/override + * {@link #rot(IWorld, BlockPos, int, int, int, Random, boolean, boolean)} instead. */ @Deprecated public boolean rot(IWorld world, BlockPos pos, int neighborCount, int radius, Random random, boolean rapid) { @@ -1733,8 +1762,7 @@ public void setSeasonalFruitingOffset(@Nullable Float offset) { } /** - * Pulls data from the {@link NormalSeasonManager} to determine the rate of - * tree growth for the current season. + * Pulls data from the {@link NormalSeasonManager} to determine the rate of tree growth for the current season. * * @param rootPos the {@link BlockPos} of the {@link RootyBlock}. * @return Factor from 0.0 (no growth) to 1.0 (full growth). @@ -1981,8 +2009,8 @@ public HashMap getFellingLeavesClusters(final BranchDestru ////////////////////////////// /** - * Provides the {@link PottedSaplingBlock} for this Species. {@link Species} subclasses can derive their own {@link - * PottedSaplingBlock} subclass if they want something custom. + * Provides the {@link PottedSaplingBlock} for this Species. {@link Species} subclasses can derive their own + * {@link PottedSaplingBlock} subclass if they want something custom. * * @return The {@link PottedSaplingBlock} for this {@link Species}. */ @@ -2042,7 +2070,8 @@ public Collection getJoCodes() { /** * Adds the default configuration of the {@link GenFeature} given. *

- * Note that the {@link GenFeature} may abort its addition if {@link GenFeature#shouldApply(Species, + * Note that the {@link GenFeature} may abort its addition if + * {@link GenFeature#shouldApply(Species, * com.ferreusveritas.dynamictrees.systems.genfeatures.GenFeatureConfiguration)} returns {@code false}. * * @param feature the {@link GenFeature} to add @@ -2055,7 +2084,8 @@ public Species addGenFeature(GenFeature feature) { /** * Adds the specified {@code configuration} to this species. *

- * Note that the {@link GenFeature} can abort its addition if {@link GenFeature#shouldApply(Species, + * Note that the {@link GenFeature} can abort its addition if + * {@link GenFeature#shouldApply(Species, * com.ferreusveritas.dynamictrees.systems.genfeatures.GenFeatureConfiguration)} returns {@code false}. * * @param configuration the configured gen feature to add @@ -2238,6 +2268,70 @@ public void generateItemModelData(DTItemModelProvider provider) { this.seedModelGenerator.get().generate(provider, this); } + public boolean shouldGenerateLeavesBlockDrops() { + return shouldGenerateLeavesDrops(); + } + + private final LazyValue leavesBlockDropsTableName = LazyValue.supplied(() -> { + LeavesProperties leavesProperties = this.leavesProperties; + if (leavesProperties == null) { + leavesProperties = getCommonSpecies().leavesProperties; + } + return ResourceLocationUtils.suffix(getRegistryName(), + (leavesProperties == null ? "_leaves" : leavesProperties.getBlockRegistryNameSuffix())); + }); + + private final LazyValue leavesBlockDropsPath = LazyValue.supplied(() -> + ResourceLocationUtils.prefix(leavesBlockDropsTableName.get(), "blocks/")); + + public ResourceLocation getLeavesBlockDropsPath() { + return leavesBlockDropsPath.get(); + } + + public LootTable.Builder createLeavesBlockDrops() { + if (getPrimitiveLeaves().isPresent() && seed != null) { + return DTLootTableProvider.createLeavesBlockDrops(getPrimitiveLeaves().get(), this.seed, seedChances); + } else if (seed == null) { + return DTLootTableProvider.createLeavesBlockDrops(getPrimitiveLeaves().get()); + } + return DTLootTableProvider.createLeavesDrops(seed, seedChances, LootParameterSets.BLOCK); + } + + public boolean shouldGenerateLeavesDrops() { + final boolean hasPrimitiveLeaves = getPrimitiveLeaves().isPresent(); + final boolean hasSeed = this.seed != null; + return ((hasPrimitiveLeaves || hasSeed) && isCommonSpecies()) || (hasPrimitiveLeaves && hasSeed); + } + + private final LazyValue leavesDropsPath = LazyValue.supplied(() -> + ResourceLocationUtils.prefix(getRegistryName(), "trees/leaves/")); + + public ResourceLocation getLeavesDropsPath() { + return leavesDropsPath.get(); + } + + public LootTable.Builder createLeavesDrops() { + if (seed == null) { + return DTLootTableProvider.createLeavesDrops(); + } + return DTLootTableProvider.createLeavesDrops(seed, seedChances, DTLootParameterSets.LEAVES); + } + + public boolean shouldGenerateVoluntaryDrops() { + return this.seed != null; + } + + private final LazyValue voluntaryDropsPath = LazyValue.supplied(() -> + ResourceLocationUtils.prefix(getRegistryName(), "trees/voluntary/")); + + public ResourceLocation getVoluntaryDropsPath() { + return voluntaryDropsPath.get(); + } + + public LootTable.Builder createVoluntaryDrops() { + return DTLootTableProvider.createVoluntaryDrops(seed); + } + @Override public String toLoadDataString() { final RegistryHandler registryHandler = RegistryHandler.get(this.getRegistryName().getNamespace()); @@ -2255,8 +2349,7 @@ public String toReloadDataString() { Pair.of("soilTypeFlags", this.soilTypeFlags), Pair.of("maxBranchRadius", this.maxBranchRadius), Pair.of("transformable", this.transformable), Pair.of("logicKit", this.logicKit), Pair.of("leavesProperties", this.leavesProperties), Pair.of("envFactors", this.envFactors), - Pair.of("dropCreators", this.dropCreators), Pair.of("megaSpecies", this.megaSpecies), - Pair.of("seed", this.seed), + Pair.of("megaSpecies", this.megaSpecies), Pair.of("seed", this.seed), Pair.of("primitive_sapling", TreeRegistry.SAPLING_REPLACERS.entrySet().stream() .filter(entry -> entry.getValue() == this).map(Map.Entry::getKey).findAny() .orElse(BlockStates.AIR)), diff --git a/src/main/java/com/ferreusveritas/dynamictrees/trees/species/NetherFungusSpecies.java b/src/main/java/com/ferreusveritas/dynamictrees/trees/species/NetherFungusSpecies.java index e25f60fae..f219377b3 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/trees/species/NetherFungusSpecies.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/trees/species/NetherFungusSpecies.java @@ -6,7 +6,7 @@ import com.ferreusveritas.dynamictrees.blocks.rootyblocks.SoilHelper; import com.ferreusveritas.dynamictrees.data.DTBlockTags; import com.ferreusveritas.dynamictrees.data.DTItemTags; -import com.ferreusveritas.dynamictrees.systems.dropcreators.DropCreators; +import com.ferreusveritas.dynamictrees.data.provider.DTLootTableProvider; import com.ferreusveritas.dynamictrees.systems.genfeatures.GenFeatures; import com.ferreusveritas.dynamictrees.trees.Family; import com.ferreusveritas.dynamictrees.trees.Species; @@ -16,6 +16,7 @@ import net.minecraft.block.Blocks; import net.minecraft.block.SoundType; import net.minecraft.item.Item; +import net.minecraft.loot.LootTable; import net.minecraft.tags.ITag; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; @@ -57,7 +58,6 @@ public Species setPreReloadDefaults() { .setSaplingShape(CommonVoxelShapes.FLAT_MUSHROOM) .setSaplingSound(SoundType.FUNGUS) .setCanSaplingGrowNaturally(false) - .addDropCreators(DropCreators.LOG) .envFactor(BiomeDictionary.Type.COLD, 0.25f) .envFactor(BiomeDictionary.Type.WET, 0.75f); } @@ -107,4 +107,24 @@ public void addSaplingTextures(BiConsumer textureConsu textureConsumer.accept("cap", capLocation); } + @Override + public boolean shouldGenerateLeavesBlockDrops() { + return getPrimitiveLeaves().isPresent(); + } + + @Override + public LootTable.Builder createLeavesBlockDrops() { + return DTLootTableProvider.createWartBlockDrops(getPrimitiveLeaves().get()); + } + + @Override + public boolean shouldGenerateLeavesDrops() { + return getPrimitiveLeaves().isPresent(); + } + + @Override + public LootTable.Builder createLeavesDrops() { + return DTLootTableProvider.createWartDrops(getPrimitiveLeaves().get()); + } + } diff --git a/src/main/java/com/ferreusveritas/dynamictrees/util/Optionals.java b/src/main/java/com/ferreusveritas/dynamictrees/util/Optionals.java index d5990a03e..dd8b5692b 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/util/Optionals.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/util/Optionals.java @@ -4,6 +4,7 @@ import net.minecraft.block.Blocks; import net.minecraft.item.Item; import net.minecraft.item.Items; +import net.minecraft.loot.LootTable; import org.apache.logging.log4j.util.TriConsumer; import javax.annotation.Nullable; @@ -23,6 +24,10 @@ public static Optional ofItem(@Nullable I item) { return Optional.ofNullable(item == Items.AIR ? null : item); } + public static Optional ofLootTable(@Nullable T lootTable) { + return Optional.ofNullable(lootTable == LootTable.EMPTY ? null : lootTable); + } + public static void ifAllPresent(BiConsumer consumer, Optional aOptional, Optional bOptional) { aOptional.ifPresent(a -> bOptional.ifPresent(b -> consumer.accept(a, b))); } diff --git a/src/main/java/com/ferreusveritas/dynamictrees/util/WorldContext.java b/src/main/java/com/ferreusveritas/dynamictrees/util/WorldContext.java index 615cb9c10..35c5bef2e 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/util/WorldContext.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/util/WorldContext.java @@ -6,6 +6,8 @@ import net.minecraft.world.IServerWorld; import net.minecraft.world.IWorld; import net.minecraft.world.World; +import net.minecraft.world.gen.WorldGenRegion; +import net.minecraft.world.server.ServerWorld; import javax.annotation.Nullable; @@ -72,4 +74,13 @@ public static WorldContext create(IWorld access) { return new WorldContext(level.dimension(), seed, access, level); } + public static ServerWorld getServerWorldOrThrow(IWorld access) { + if (access instanceof ServerWorld) { + return ((ServerWorld) access); + } else if (access instanceof IServerWorld) { + return ((IServerWorld) access).getLevel(); + } + throw new IllegalArgumentException("Cannot get ServerWorld from IWorld of type: " + access.getClass()); + } + } diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index 521bc822d..ed2fdfea4 100755 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -28,4 +28,8 @@ public net.minecraft.block.ComposterBlock func_220290_a(FLnet/minecraft/util/IIt public net.minecraft.loot.LootParameterSets field_216268_i # REGISTRY -public net.minecraft.world.Region func_226703_d_(Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/world/chunk/IChunk; # getChunk \ No newline at end of file +public net.minecraft.world.Region func_226703_d_(Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/world/chunk/IChunk; # getChunk + +public net.minecraft.data.loot.BlockLootTables func_218535_c(Lnet/minecraft/block/Block;Lnet/minecraft/loot/LootEntry$Builder;)Lnet/minecraft/loot/LootTable$Builder; # createSilkTouchOrShearsDispatchTable +public net.minecraft.data.loot.BlockLootTables func_218560_a(Lnet/minecraft/util/IItemProvider;Lnet/minecraft/loot/ILootConditionConsumer;)Ljava/lang/Object; # applyExplosionCondition +public net.minecraft.data.loot.BlockLootTables func_218552_a(Lnet/minecraft/util/IItemProvider;Lnet/minecraft/loot/ILootFunctionConsumer;)Ljava/lang/Object; # applyExplosionDecay \ No newline at end of file diff --git a/src/main/resources/trees/dynamictrees/drop_creators/configurations/wart_block.json b/src/main/resources/trees/dynamictrees/drop_creators/configurations/wart_block.json deleted file mode 100755 index 5aca39f9c..000000000 --- a/src/main/resources/trees/dynamictrees/drop_creators/configurations/wart_block.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "normal", - "property_definitions": [ - { - "key": "block", - "type": "ResourceLocation", - "default": "air" - } - ], - "properties": { - "drops": { - "leaves": { - "id": "stack", - "properties": { - "items": [ - { - "id": "#block", - "Count": 1 - } - ], - "chance": 1 - } - }, - "harvest": { - "id": "stack", - "properties": { - "items": [ - { - "id": "#block", - "Count": 1 - } - ], - "chance": 10 - } - } - } - } -} \ No newline at end of file diff --git a/src/main/resources/trees/dynamictrees/species/apple_oak.json b/src/main/resources/trees/dynamictrees/species/apple_oak.json index 511db1d3d..6a145f7bf 100755 --- a/src/main/resources/trees/dynamictrees/species/apple_oak.json +++ b/src/main/resources/trees/dynamictrees/species/apple_oak.json @@ -28,15 +28,5 @@ "fruit": "apple" } } - ], - "drop_creators": [ - "log", - "stick", - { - "name": "fruit", - "properties": { - "fruit_item": "apple" - } - } ] } \ No newline at end of file diff --git a/src/main/resources/trees/dynamictrees/species/crimson.json b/src/main/resources/trees/dynamictrees/species/crimson.json index 71e744e5e..cf7d5d435 100755 --- a/src/main/resources/trees/dynamictrees/species/crimson.json +++ b/src/main/resources/trees/dynamictrees/species/crimson.json @@ -19,15 +19,6 @@ "acceptable_growth_blocks": ["minecraft:crimson_nylium", "dynamictrees:rooty_crimson_nylium"], "mega_species": "mega_crimson", "sapling_shape": "round_mushroom_rim", - "drop_creators": [ - "log", - { - "name": "wart_block", - "properties": { - "block": "nether_wart_block" - } - } - ], "features": [ { "name": "vines", diff --git a/src/main/resources/trees/dynamictrees/species/jungle.json b/src/main/resources/trees/dynamictrees/species/jungle.json index e16c96627..54b0a28dc 100755 --- a/src/main/resources/trees/dynamictrees/species/jungle.json +++ b/src/main/resources/trees/dynamictrees/species/jungle.json @@ -34,5 +34,8 @@ } }, "undergrowth" - ] + ], + + "_comment": "Seed chances are for data gen only, changing these will NOT have an effect until data is regenerated.", + "seed_chances": [ 0.025, 0.027777778, 0.03125, 0.041666668, 0.1 ] } \ No newline at end of file diff --git a/src/main/resources/trees/dynamictrees/species/mega_crimson.json b/src/main/resources/trees/dynamictrees/species/mega_crimson.json index f0dfcf5dc..16776acc6 100755 --- a/src/main/resources/trees/dynamictrees/species/mega_crimson.json +++ b/src/main/resources/trees/dynamictrees/species/mega_crimson.json @@ -22,15 +22,6 @@ "perfect_biomes": { "name": "minecraft:crimson_forest" }, "acceptable_soils": ["nether_soil_like", "fungus_like", "dirt_like"], "acceptable_growth_blocks": ["crimson_nylium"], - "drop_creators": [ - "log", - { - "name": "wart_block", - "properties": { - "block": "nether_wart_block" - } - } - ], "features": [ { "name": "vines", diff --git a/src/main/resources/trees/dynamictrees/species/mega_jungle.json b/src/main/resources/trees/dynamictrees/species/mega_jungle.json index 66bb4c6a1..1ee1cb447 100755 --- a/src/main/resources/trees/dynamictrees/species/mega_jungle.json +++ b/src/main/resources/trees/dynamictrees/species/mega_jungle.json @@ -46,5 +46,8 @@ }, "clear_volume", "bottom_flare" - ] + ], + + "_comment": "Seed chances are for data gen only, changing these will NOT have an effect until data is regenerated.", + "seed_chances": [ 0.025, 0.027777778, 0.03125, 0.041666668, 0.1 ] } \ No newline at end of file diff --git a/src/main/resources/trees/dynamictrees/species/mega_warped.json b/src/main/resources/trees/dynamictrees/species/mega_warped.json index d417c690a..51a2a6d46 100755 --- a/src/main/resources/trees/dynamictrees/species/mega_warped.json +++ b/src/main/resources/trees/dynamictrees/species/mega_warped.json @@ -22,15 +22,6 @@ "perfect_biomes": { "name": "minecraft:warped_forest" }, "acceptable_soils": ["nether_soil_like", "fungus_like", "dirt_like"], "acceptable_growth_blocks": ["warped_nylium"], - "drop_creators": [ - "log", - { - "name": "wart_block", - "properties": { - "block": "warped_wart_block" - } - } - ], "features": [ { "name": "mound", diff --git a/src/main/resources/trees/dynamictrees/species/swamp_oak.json b/src/main/resources/trees/dynamictrees/species/swamp_oak.json index ca0c861a7..05dd5e7c4 100755 --- a/src/main/resources/trees/dynamictrees/species/swamp_oak.json +++ b/src/main/resources/trees/dynamictrees/species/swamp_oak.json @@ -29,9 +29,5 @@ } }, "mushroom_rot" - ], - "drop_creators": [ - "log", - "seed" ] } \ No newline at end of file diff --git a/src/main/resources/trees/dynamictrees/species/warped.json b/src/main/resources/trees/dynamictrees/species/warped.json index 157c11b69..349cc7f61 100755 --- a/src/main/resources/trees/dynamictrees/species/warped.json +++ b/src/main/resources/trees/dynamictrees/species/warped.json @@ -18,15 +18,6 @@ "acceptable_soils": ["nether_soil_like", "fungus_like", "dirt_like"], "acceptable_growth_blocks": ["minecraft:warped_nylium", "dynamictrees:rooty_warped_nylium"], "mega_species": "mega_warped", - "drop_creators": [ - "log", - { - "name": "wart_block", - "properties": { - "block": "warped_wart_block" - } - } - ], "features": [ "clear_volume", "shroomlight", From acc8f356a28ad354753d5af78ce60051b79bc898 Mon Sep 17 00:00:00 2001 From: Harleyoc1 Date: Mon, 4 Jul 2022 13:36:44 +0100 Subject: [PATCH 02/17] Minor cleanup and fixes --- .../blocks/branches/BranchBlock.java | 6 +++--- .../dynamictrees/trees/Species.java | 18 ++++++++---------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BranchBlock.java b/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BranchBlock.java index 9249b1fba..d099a698e 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BranchBlock.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BranchBlock.java @@ -537,7 +537,7 @@ public void futureBreak(BlockState state, World world, BlockPos cutPos, LivingEn final NetVolumeNode.Volume woodVolume = destroyData.woodVolume; // The amount of wood calculated from the body of the tree network. woodVolume.multiplyVolume(fortuneFactor); - final List woodItems = destroyData.species.getWoodDrops(world, cutPos, woodVolume, heldItem); + final List woodItems = destroyData.species.getWoodDrops(world, woodVolume, heldItem); // Drop the FallingTreeEntity into the world. FallingTreeEntity.dropTree(world, destroyData, woodItems, DestroyType.HARVEST); @@ -579,7 +579,7 @@ protected void sloppyBreak(World world, BlockPos cutPos, DestroyType destroyType this.destroyBranchFromNode(world, cutPos, Direction.DOWN, false, null); // Get all of the wood drops. - final List woodDropList = destroyData.species.getWoodDrops(world, cutPos, destroyData.woodVolume); + final List woodDropList = destroyData.species.getWoodDrops(world, destroyData.woodVolume); // If sloppy break drops are off clear all drops. if (!DTConfigs.SLOPPY_BREAK_DROPS.get()) { @@ -756,7 +756,7 @@ public void onBlockExploded(BlockState state, World world, BlockPos pos, Explosi final BranchDestructionData destroyData = destroyBranchFromNode(world, pos, Direction.DOWN, false, null); final NetVolumeNode.Volume woodVolume = destroyData.woodVolume; final List woodDropList = - species.getWoodDrops(world, pos, woodVolume, ItemStack.EMPTY, explosion.radius); + species.getWoodDrops(world, woodVolume, ItemStack.EMPTY, explosion.radius); final FallingTreeEntity treeEntity = FallingTreeEntity.dropTree(world, destroyData, woodDropList, DestroyType.BLAST); diff --git a/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java b/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java index a83768f03..4bd45de7b 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java @@ -808,15 +808,15 @@ public LootTable getLootTable(LootTableManager lootTables, Function getWoodDrops(World world, BlockPos pos, NetVolumeNode.Volume volume) { - return getWoodDrops(world, pos, volume, ItemStack.EMPTY); + public List getWoodDrops(World world, NetVolumeNode.Volume volume) { + return getWoodDrops(world, volume, ItemStack.EMPTY); } - public List getWoodDrops(World world, BlockPos pos, NetVolumeNode.Volume volume, ItemStack tool) { - return getWoodDrops(world, pos, volume, tool, null); + public List getWoodDrops(World world, NetVolumeNode.Volume volume, ItemStack tool) { + return getWoodDrops(world, volume, tool, null); } - public List getWoodDrops(World world, BlockPos pos, NetVolumeNode.Volume volume, + public List getWoodDrops(World world, NetVolumeNode.Volume volume, ItemStack tool, @Nullable Float explosionRadius) { volume.multiplyVolume(DTConfigs.TREE_HARVEST_MULTIPLIER.get()); // For cheaters.. you know who you are. if (world.isClientSide) { @@ -883,16 +883,14 @@ public LogsAndSticks(List logs, int sticks) { public LogsAndSticks getLogsAndSticks(NetVolumeNode.Volume volume) { List logsList = new LinkedList<>(); int[] volArray = volume.getRawVolumesArray(); - float prevVol = 0; + float stickVol = 0; for (int i = 0; i < volArray.length; i++) { float vol = (volArray[i] / (float) NetVolumeNode.Volume.VOXELSPERLOG); if (vol > 0) { - vol += prevVol; - prevVol = getFamily().getValidBranchBlock(i).getPrimitiveLogs(vol, logsList); + stickVol += getFamily().getValidBranchBlock(i).getPrimitiveLogs(vol, logsList); } } - int sticks = (int) (prevVol * - 8); // A stick is 1/8th of a log (1 log = 4 planks, 2 planks = 4 sticks) Give him the stick! + int sticks = (int) (stickVol * 8); // A stick is 1/8th of a log (1 log = 4 planks, 2 planks = 4 sticks) Give him the stick! return new LogsAndSticks(logsList, sticks); } From c3dbd87fa3c8726e13b03a679a672a6bb9752e08 Mon Sep 17 00:00:00 2001 From: Harleyoc1 Date: Sun, 7 Aug 2022 22:19:11 +0100 Subject: [PATCH 03/17] Change name of `wood` drops to `branches` --- src/generated/resources/.cache/cache | 32 +++++++++---------- .../acacia.json} | 2 +- .../birch_branch.json => branches/birch.json} | 2 +- .../crimson.json} | 2 +- .../dark_oak.json} | 2 +- .../jungle.json} | 2 +- .../oak_branch.json => branches/oak.json} | 2 +- .../spruce.json} | 2 +- .../stripped_acacia.json} | 2 +- .../stripped_birch.json} | 2 +- .../stripped_crimson.json} | 2 +- .../stripped_dark_oak.json} | 2 +- .../stripped_jungle.json} | 2 +- .../stripped_oak.json} | 2 +- .../stripped_spruce.json} | 2 +- .../stripped_warped.json} | 2 +- .../warped.json} | 2 +- .../blocks/branches/BranchBlock.java | 8 ++++- .../data/provider/DTLootTableProvider.java | 2 +- .../loot/DTLootParameterSets.java | 2 +- .../dynamictrees/trees/Family.java | 2 +- .../dynamictrees/trees/Species.java | 2 +- .../util/ResourceLocationUtils.java | 8 +++++ 23 files changed, 51 insertions(+), 37 deletions(-) rename src/generated/resources/data/dynamictrees/loot_tables/trees/{wood/acacia_branch.json => branches/acacia.json} (95%) rename src/generated/resources/data/dynamictrees/loot_tables/trees/{wood/birch_branch.json => branches/birch.json} (95%) rename src/generated/resources/data/dynamictrees/loot_tables/trees/{wood/crimson_branch.json => branches/crimson.json} (95%) rename src/generated/resources/data/dynamictrees/loot_tables/trees/{wood/dark_oak_branch.json => branches/dark_oak.json} (95%) rename src/generated/resources/data/dynamictrees/loot_tables/trees/{wood/jungle_branch.json => branches/jungle.json} (95%) rename src/generated/resources/data/dynamictrees/loot_tables/trees/{wood/oak_branch.json => branches/oak.json} (95%) rename src/generated/resources/data/dynamictrees/loot_tables/trees/{wood/spruce_branch.json => branches/spruce.json} (95%) rename src/generated/resources/data/dynamictrees/loot_tables/trees/{wood/stripped_acacia_branch.json => branches/stripped_acacia.json} (95%) rename src/generated/resources/data/dynamictrees/loot_tables/trees/{wood/stripped_birch_branch.json => branches/stripped_birch.json} (95%) rename src/generated/resources/data/dynamictrees/loot_tables/trees/{wood/stripped_crimson_branch.json => branches/stripped_crimson.json} (95%) rename src/generated/resources/data/dynamictrees/loot_tables/trees/{wood/stripped_dark_oak_branch.json => branches/stripped_dark_oak.json} (95%) rename src/generated/resources/data/dynamictrees/loot_tables/trees/{wood/stripped_jungle_branch.json => branches/stripped_jungle.json} (95%) rename src/generated/resources/data/dynamictrees/loot_tables/trees/{wood/stripped_oak_branch.json => branches/stripped_oak.json} (95%) rename src/generated/resources/data/dynamictrees/loot_tables/trees/{wood/stripped_spruce_branch.json => branches/stripped_spruce.json} (95%) rename src/generated/resources/data/dynamictrees/loot_tables/trees/{wood/stripped_warped_branch.json => branches/stripped_warped.json} (95%) rename src/generated/resources/data/dynamictrees/loot_tables/trees/{wood/warped_branch.json => branches/warped.json} (95%) diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index c47e6f3f9..cfbd9da89 100755 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -104,6 +104,22 @@ f6e09c5bb782791017bec235b559ea4a891c41c1 data/dynamictrees/loot_tables/blocks/da c2dd639099208e56c8ca1e0f96175b6173d2773c data/dynamictrees/loot_tables/blocks/oak_leaves.json 95876b44b323509c4a9940fab4b1bb2d25a4df6c data/dynamictrees/loot_tables/blocks/spruce_leaves.json 3b375ed7e64d3d6d18499bbc1af30e5cd931e134 data/dynamictrees/loot_tables/blocks/warped_wart.json +f6d16a6825ddeaecdd0ddb2c2b1886f60ea82944 data/dynamictrees/loot_tables/trees/branches/acacia.json +8f45ffe7eebe4d5b164e23d5481a7b6af801655e data/dynamictrees/loot_tables/trees/branches/birch.json +4f635405004638f0d061aff5762b4bb2555fca29 data/dynamictrees/loot_tables/trees/branches/crimson.json +edd89ec38c627114870dfea712a15a9c438f65cb data/dynamictrees/loot_tables/trees/branches/dark_oak.json +4d96df594c88f936bf605bf709945542306d625e data/dynamictrees/loot_tables/trees/branches/jungle.json +20d0b6c635fcc53c9d29124ed1c48b7b1e9ac119 data/dynamictrees/loot_tables/trees/branches/oak.json +cfe795a6b3e491c0b9b3ff9f53fc637e1507c702 data/dynamictrees/loot_tables/trees/branches/spruce.json +36f2641ce96884c71914d9ee309d3ce2cff36b74 data/dynamictrees/loot_tables/trees/branches/stripped_acacia.json +2ec30f11e3a3165006abb231c56e261960be8a53 data/dynamictrees/loot_tables/trees/branches/stripped_birch.json +3d22b9c7a4dc3c37c8ad1498c3a133888db28de3 data/dynamictrees/loot_tables/trees/branches/stripped_crimson.json +7da549bf3dae26accbb0720bea07195f88a17777 data/dynamictrees/loot_tables/trees/branches/stripped_dark_oak.json +6a64834cdd6605a2cf9df87df808351b103a81e6 data/dynamictrees/loot_tables/trees/branches/stripped_jungle.json +bca98cb1ec99edd9eb9f05bc0b2945a05b42899f data/dynamictrees/loot_tables/trees/branches/stripped_oak.json +1c6d89c3fb1339f881e4e32cfae3b47f2504fd35 data/dynamictrees/loot_tables/trees/branches/stripped_spruce.json +9a3b714da894635be7b9a53d94c639652033b33c data/dynamictrees/loot_tables/trees/branches/stripped_warped.json +05f6da26478527e105eca41987455f402c95c913 data/dynamictrees/loot_tables/trees/branches/warped.json c9b95dd9ca14ac6ae2ec8892a69e993580530fee data/dynamictrees/loot_tables/trees/leaves/acacia.json f49afb7b939b90f15d5b7436abe620b0e6506e34 data/dynamictrees/loot_tables/trees/leaves/apple_oak.json 6e842c38a8ff6b27e327a164c288513d8db17de2 data/dynamictrees/loot_tables/trees/leaves/birch.json @@ -124,22 +140,6 @@ fa15a74c9f4c6ef2938b746034851a694f447392 data/dynamictrees/loot_tables/trees/vol 07f2393576fd7a50b338e5b32a399d8915b6852d data/dynamictrees/loot_tables/trees/voluntary/oak.json d9e9232eafa5e036c1377e88fef0531dadcf7b42 data/dynamictrees/loot_tables/trees/voluntary/spruce.json a5e8677a389e452305c3cc65e80c68a2339055ac data/dynamictrees/loot_tables/trees/voluntary/warped.json -be3388ecbd798bf0df8cd7862dc79c9f45a8c8c5 data/dynamictrees/loot_tables/trees/wood/acacia_branch.json -c00f99909ab710b4a31eac1242b0c4c4934ae1bf data/dynamictrees/loot_tables/trees/wood/birch_branch.json -24b697736a6863c294e9e778c97209b341be0d74 data/dynamictrees/loot_tables/trees/wood/crimson_branch.json -1519e4854d652784f42e30260b458606892d9ad5 data/dynamictrees/loot_tables/trees/wood/dark_oak_branch.json -7188917f86ac919fb4b364b69d7672bbfc37d27b data/dynamictrees/loot_tables/trees/wood/jungle_branch.json -56066d6b7c25d89fb15108d42005256d4105d915 data/dynamictrees/loot_tables/trees/wood/oak_branch.json -85e2e42ca40169a5f0b380a2bd37007cff4281df data/dynamictrees/loot_tables/trees/wood/spruce_branch.json -3f24522fafc83716bfd064064b50465fe5076cea data/dynamictrees/loot_tables/trees/wood/stripped_acacia_branch.json -a0bb5f17afbb4b879d37113104677bb23531b417 data/dynamictrees/loot_tables/trees/wood/stripped_birch_branch.json -c687467279ba6185ff2af5cde9b1117e1c91a52b data/dynamictrees/loot_tables/trees/wood/stripped_crimson_branch.json -0088e48a01bbab6df258e2cb3f37ed1f470c374d data/dynamictrees/loot_tables/trees/wood/stripped_dark_oak_branch.json -c34594394aff4f4de62e50881bdccd88642e5d02 data/dynamictrees/loot_tables/trees/wood/stripped_jungle_branch.json -36633a38f3d715a39bba784c8042d395be10ddea data/dynamictrees/loot_tables/trees/wood/stripped_oak_branch.json -7c5297ec4778a708d8f60df95bd0fedd633369df data/dynamictrees/loot_tables/trees/wood/stripped_spruce_branch.json -451e3aec2ec906494c713fda7842a3c5c7bcec05 data/dynamictrees/loot_tables/trees/wood/stripped_warped_branch.json -30072bd0711325ef2b760f61946b31d0a919ebec data/dynamictrees/loot_tables/trees/wood/warped_branch.json 00f1155e3e23759f5c41ff23363ddabd828373eb data/dynamictrees/tags/blocks/branches.json 9cde27364783c31821c51da5ae452b6f642c8c06 data/dynamictrees/tags/blocks/branches_that_burn.json f0827e9841f3f418505af50a01fef5a1be47e0ec data/dynamictrees/tags/blocks/foliage.json diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/acacia_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/acacia.json similarity index 95% rename from src/generated/resources/data/dynamictrees/loot_tables/trees/wood/acacia_branch.json rename to src/generated/resources/data/dynamictrees/loot_tables/trees/branches/acacia.json index 1b7e455c6..1ec3bd63a 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/acacia_branch.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/acacia.json @@ -1,5 +1,5 @@ { - "type": "dynamictrees:wood", + "type": "dynamictrees:branches", "pools": [ { "rolls": 1, diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/birch_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/birch.json similarity index 95% rename from src/generated/resources/data/dynamictrees/loot_tables/trees/wood/birch_branch.json rename to src/generated/resources/data/dynamictrees/loot_tables/trees/branches/birch.json index 2e9484f85..adab4f770 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/birch_branch.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/birch.json @@ -1,5 +1,5 @@ { - "type": "dynamictrees:wood", + "type": "dynamictrees:branches", "pools": [ { "rolls": 1, diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/crimson_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/crimson.json similarity index 95% rename from src/generated/resources/data/dynamictrees/loot_tables/trees/wood/crimson_branch.json rename to src/generated/resources/data/dynamictrees/loot_tables/trees/branches/crimson.json index 2efc36d2a..bb43ae98f 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/crimson_branch.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/crimson.json @@ -1,5 +1,5 @@ { - "type": "dynamictrees:wood", + "type": "dynamictrees:branches", "pools": [ { "rolls": 1, diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/dark_oak_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/dark_oak.json similarity index 95% rename from src/generated/resources/data/dynamictrees/loot_tables/trees/wood/dark_oak_branch.json rename to src/generated/resources/data/dynamictrees/loot_tables/trees/branches/dark_oak.json index 3bf693667..3d3e54977 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/dark_oak_branch.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/dark_oak.json @@ -1,5 +1,5 @@ { - "type": "dynamictrees:wood", + "type": "dynamictrees:branches", "pools": [ { "rolls": 1, diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/jungle_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/jungle.json similarity index 95% rename from src/generated/resources/data/dynamictrees/loot_tables/trees/wood/jungle_branch.json rename to src/generated/resources/data/dynamictrees/loot_tables/trees/branches/jungle.json index 9c00944d0..1ec074f20 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/jungle_branch.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/jungle.json @@ -1,5 +1,5 @@ { - "type": "dynamictrees:wood", + "type": "dynamictrees:branches", "pools": [ { "rolls": 1, diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/oak_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/oak.json similarity index 95% rename from src/generated/resources/data/dynamictrees/loot_tables/trees/wood/oak_branch.json rename to src/generated/resources/data/dynamictrees/loot_tables/trees/branches/oak.json index 0cb89fb36..128fbc9f5 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/oak_branch.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/oak.json @@ -1,5 +1,5 @@ { - "type": "dynamictrees:wood", + "type": "dynamictrees:branches", "pools": [ { "rolls": 1, diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/spruce_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/spruce.json similarity index 95% rename from src/generated/resources/data/dynamictrees/loot_tables/trees/wood/spruce_branch.json rename to src/generated/resources/data/dynamictrees/loot_tables/trees/branches/spruce.json index 536108733..be5ca25e7 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/spruce_branch.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/spruce.json @@ -1,5 +1,5 @@ { - "type": "dynamictrees:wood", + "type": "dynamictrees:branches", "pools": [ { "rolls": 1, diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_acacia_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_acacia.json similarity index 95% rename from src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_acacia_branch.json rename to src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_acacia.json index b45ef3099..0452c7cb7 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_acacia_branch.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_acacia.json @@ -1,5 +1,5 @@ { - "type": "dynamictrees:wood", + "type": "dynamictrees:branches", "pools": [ { "rolls": 1, diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_birch_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_birch.json similarity index 95% rename from src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_birch_branch.json rename to src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_birch.json index 98582adea..2e817c571 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_birch_branch.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_birch.json @@ -1,5 +1,5 @@ { - "type": "dynamictrees:wood", + "type": "dynamictrees:branches", "pools": [ { "rolls": 1, diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_crimson_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_crimson.json similarity index 95% rename from src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_crimson_branch.json rename to src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_crimson.json index 82302c5c3..d2d9f70e3 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_crimson_branch.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_crimson.json @@ -1,5 +1,5 @@ { - "type": "dynamictrees:wood", + "type": "dynamictrees:branches", "pools": [ { "rolls": 1, diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_dark_oak_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_dark_oak.json similarity index 95% rename from src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_dark_oak_branch.json rename to src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_dark_oak.json index 350ef89c4..7101d1400 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_dark_oak_branch.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_dark_oak.json @@ -1,5 +1,5 @@ { - "type": "dynamictrees:wood", + "type": "dynamictrees:branches", "pools": [ { "rolls": 1, diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_jungle_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_jungle.json similarity index 95% rename from src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_jungle_branch.json rename to src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_jungle.json index 0f19713f3..3c8ba730b 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_jungle_branch.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_jungle.json @@ -1,5 +1,5 @@ { - "type": "dynamictrees:wood", + "type": "dynamictrees:branches", "pools": [ { "rolls": 1, diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_oak_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_oak.json similarity index 95% rename from src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_oak_branch.json rename to src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_oak.json index 31b495dd1..f18166641 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_oak_branch.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_oak.json @@ -1,5 +1,5 @@ { - "type": "dynamictrees:wood", + "type": "dynamictrees:branches", "pools": [ { "rolls": 1, diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_spruce_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_spruce.json similarity index 95% rename from src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_spruce_branch.json rename to src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_spruce.json index 2e89d3051..506bc99ec 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_spruce_branch.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_spruce.json @@ -1,5 +1,5 @@ { - "type": "dynamictrees:wood", + "type": "dynamictrees:branches", "pools": [ { "rolls": 1, diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_warped_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_warped.json similarity index 95% rename from src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_warped_branch.json rename to src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_warped.json index 690affec4..6d7b06b46 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/stripped_warped_branch.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_warped.json @@ -1,5 +1,5 @@ { - "type": "dynamictrees:wood", + "type": "dynamictrees:branches", "pools": [ { "rolls": 1, diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/warped_branch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/warped.json similarity index 95% rename from src/generated/resources/data/dynamictrees/loot_tables/trees/wood/warped_branch.json rename to src/generated/resources/data/dynamictrees/loot_tables/trees/branches/warped.json index c209dc0e2..ded053cb0 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/wood/warped_branch.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/warped.json @@ -1,5 +1,5 @@ { - "type": "dynamictrees:wood", + "type": "dynamictrees:branches", "pools": [ { "rolls": 1, diff --git a/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BranchBlock.java b/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BranchBlock.java index d099a698e..83602a701 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BranchBlock.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BranchBlock.java @@ -74,8 +74,11 @@ public abstract class BranchBlock extends BlockWithDynamicHardness implements TreePart, FutureBreakable { public static final int MAX_RADIUS = 8; + + public static final String NAME_SUFFIX = "_branch"; public static DynamicTrees.DestroyMode destroyMode = DynamicTrees.DestroyMode.SLOPPY; + /** * The {@link Family} for this {@link BranchBlock}. */ @@ -485,7 +488,10 @@ public boolean canFall() { /////////////////////////////////////////// private final LazyValue lootTableName = - LazyValue.supplied(() -> ResourceLocationUtils.prefix(getRegistryName(), "trees/wood/")); + LazyValue.supplied(() -> ResourceLocationUtils.prefix( + ResourceLocationUtils.removeSuffix(getRegistryName(), "_branch"), + "trees/branches/" + )); public ResourceLocation getLootTableName() { return lootTableName.get(); diff --git a/src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java b/src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java index 6c93bafe8..21b1315d3 100644 --- a/src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java @@ -238,7 +238,7 @@ public static LootTable.Builder createBranchDrops(Block primitiveLogBlock, Item .apply(MultiplySticksCount.multiplySticksCount()) .apply(ExplosionDecay.explosionDecay()) ) - ).setParamSet(DTLootParameterSets.WOOD); + ).setParamSet(DTLootParameterSets.BRANCHES); } private void writeTables(DirectoryCache cache) { diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/DTLootParameterSets.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/DTLootParameterSets.java index 6cf6f0d43..9c2d52117 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/loot/DTLootParameterSets.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/DTLootParameterSets.java @@ -25,7 +25,7 @@ public final class DTLootParameterSets { .required(DTLootParameters.FERTILITY) ); - public static final LootParameterSet WOOD = register("wood", builder -> + public static final LootParameterSet BRANCHES = register("branches", builder -> builder.required(LootParameters.TOOL) .required(DTLootParameters.VOLUME) .optional(LootParameters.EXPLOSION_RADIUS) diff --git a/src/main/java/com/ferreusveritas/dynamictrees/trees/Family.java b/src/main/java/com/ferreusveritas/dynamictrees/trees/Family.java index 8feab9624..1f55f57a4 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/trees/Family.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/trees/Family.java @@ -372,7 +372,7 @@ public BranchBlock createBranch() { * @return The {@link ResourceLocation} registry name for the branch. */ protected ResourceLocation getBranchRegName(final String prefix) { - return suffix(prefix(this.getRegistryName(), prefix), "_branch"); + return suffix(prefix(this.getRegistryName(), prefix), BranchBlock.NAME_SUFFIX); } /** diff --git a/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java b/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java index 1af36756f..d3888517e 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java @@ -875,7 +875,7 @@ private LootContext createWoodLootContext(World world, int volume, ItemStack too .withParameter(LootParameters.TOOL, tool) .withParameter(DTLootParameters.VOLUME, volume) .withOptionalParameter(LootParameters.EXPLOSION_RADIUS, explosionRadius) - .create(DTLootParameterSets.WOOD); + .create(DTLootParameterSets.BRANCHES); } public static class LogsAndSticks { diff --git a/src/main/java/com/ferreusveritas/dynamictrees/util/ResourceLocationUtils.java b/src/main/java/com/ferreusveritas/dynamictrees/util/ResourceLocationUtils.java index 28d7e35d9..cea716844 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/util/ResourceLocationUtils.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/util/ResourceLocationUtils.java @@ -30,4 +30,12 @@ public static ResourceLocation surround(final ResourceLocation resourceLocation, return new ResourceLocation(resourceLocation.getNamespace(), prefix + resourceLocation.getPath() + suffix); } + public static ResourceLocation removeSuffix(final ResourceLocation resourceLocation, final String suffix) { + final String path = resourceLocation.getPath(); + if (path.endsWith(suffix)) { + return new ResourceLocation(resourceLocation.getNamespace(), path.substring(0, path.length() - suffix.length())); + } + return resourceLocation; + } + } From 36f0f3c2a6024069a5dff51ac7831a71b59b5f0f Mon Sep 17 00:00:00 2001 From: Harleyoc1 Date: Mon, 8 Aug 2022 13:02:03 +0100 Subject: [PATCH 04/17] Add item by species loot entry for branches drops --- gradle.properties | 2 +- .../blocks/branches/BranchBlock.java | 6 +- .../dynamictrees/loot/DTLoot.java | 4 +- .../dynamictrees/loot/DTLootParameters.java | 2 + .../condition/SeasonalSeedDropChance.java | 2 + .../condition/VoluntarySeedDropChance.java | 2 + .../loot/entry/DTLootEntries.java | 24 ++++++ .../loot/entry/ItemBySpeciesLootEntry.java | 79 +++++++++++++++++++ .../loot/function/MultiplyLogsCount.java | 2 + .../loot/function/MultiplySticksCount.java | 2 + .../dynamictrees/trees/Species.java | 39 ++++----- 11 files changed, 140 insertions(+), 24 deletions(-) create mode 100644 src/main/java/com/ferreusveritas/dynamictrees/loot/entry/DTLootEntries.java create mode 100644 src/main/java/com/ferreusveritas/dynamictrees/loot/entry/ItemBySpeciesLootEntry.java diff --git a/gradle.properties b/gradle.properties index fc211a44e..d1ffda571 100755 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ modName=DynamicTrees modId=dynamictrees -modVersion=0.10.0-Beta33.3 +modVersion=0.10.0-Beta-LR2 group=com.ferreusveritas.dynamictrees mcVersion=1.16.5 diff --git a/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BranchBlock.java b/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BranchBlock.java index 83602a701..2ce4e7bbc 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BranchBlock.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BranchBlock.java @@ -543,7 +543,7 @@ public void futureBreak(BlockState state, World world, BlockPos cutPos, LivingEn final NetVolumeNode.Volume woodVolume = destroyData.woodVolume; // The amount of wood calculated from the body of the tree network. woodVolume.multiplyVolume(fortuneFactor); - final List woodItems = destroyData.species.getWoodDrops(world, woodVolume, heldItem); + final List woodItems = destroyData.species.getBranchesDrops(world, woodVolume, heldItem); // Drop the FallingTreeEntity into the world. FallingTreeEntity.dropTree(world, destroyData, woodItems, DestroyType.HARVEST); @@ -585,7 +585,7 @@ protected void sloppyBreak(World world, BlockPos cutPos, DestroyType destroyType this.destroyBranchFromNode(world, cutPos, Direction.DOWN, false, null); // Get all of the wood drops. - final List woodDropList = destroyData.species.getWoodDrops(world, destroyData.woodVolume); + final List woodDropList = destroyData.species.getBranchesDrops(world, destroyData.woodVolume); // If sloppy break drops are off clear all drops. if (!DTConfigs.SLOPPY_BREAK_DROPS.get()) { @@ -762,7 +762,7 @@ public void onBlockExploded(BlockState state, World world, BlockPos pos, Explosi final BranchDestructionData destroyData = destroyBranchFromNode(world, pos, Direction.DOWN, false, null); final NetVolumeNode.Volume woodVolume = destroyData.woodVolume; final List woodDropList = - species.getWoodDrops(world, woodVolume, ItemStack.EMPTY, explosion.radius); + species.getBranchesDrops(world, woodVolume, ItemStack.EMPTY, explosion.radius); final FallingTreeEntity treeEntity = FallingTreeEntity.dropTree(world, destroyData, woodDropList, DestroyType.BLAST); diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/DTLoot.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/DTLoot.java index 9a7062b0b..596d15b1b 100644 --- a/src/main/java/com/ferreusveritas/dynamictrees/loot/DTLoot.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/DTLoot.java @@ -1,6 +1,7 @@ package com.ferreusveritas.dynamictrees.loot; import com.ferreusveritas.dynamictrees.loot.condition.DTLootConditions; +import com.ferreusveritas.dynamictrees.loot.entry.DTLootEntries; import com.ferreusveritas.dynamictrees.loot.function.DTLootFunctions; /** @@ -10,8 +11,9 @@ public final class DTLoot { /** Invoked to initialise static fields. */ public static void load() { + DTLootParameterSets.load(); DTLootParameters.load(); - DTLootParameters.load(); + DTLootEntries.load(); DTLootConditions.load(); DTLootFunctions.load(); } diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/DTLootParameters.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/DTLootParameters.java index 0ed03eddc..bd72165e1 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/loot/DTLootParameters.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/DTLootParameters.java @@ -2,6 +2,7 @@ import com.ferreusveritas.dynamictrees.DynamicTrees; import com.ferreusveritas.dynamictrees.systems.nodemappers.NetVolumeNode; +import com.ferreusveritas.dynamictrees.trees.Species; import net.minecraft.loot.LootParameter; /** @@ -9,6 +10,7 @@ */ public final class DTLootParameters { + public static final LootParameter SPECIES = create("species"); public static final LootParameter FERTILITY = create("fertility"); public static final LootParameter SEASONAL_SEED_DROP_FACTOR = create("seasonal_seed_drop_factor"); public static final LootParameter VOLUME = create("volume"); diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/SeasonalSeedDropChance.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/SeasonalSeedDropChance.java index aca77c808..bb295c5f8 100644 --- a/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/SeasonalSeedDropChance.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/SeasonalSeedDropChance.java @@ -35,9 +35,11 @@ public static ILootCondition.IBuilder seasonalSeedDropChance() { } public static class Serializer implements ILootSerializer { + @Override public void serialize(JsonObject json, SeasonalSeedDropChance value, JsonSerializationContext context) { } + @Override public SeasonalSeedDropChance deserialize(JsonObject json, JsonDeserializationContext context) { return SeasonalSeedDropChance.INSTANCE; } diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/VoluntarySeedDropChance.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/VoluntarySeedDropChance.java index 4d826fa13..48de53d8f 100644 --- a/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/VoluntarySeedDropChance.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/VoluntarySeedDropChance.java @@ -43,10 +43,12 @@ public static ILootCondition.IBuilder voluntarySeedDropChance(float rarity) { } public static class Serializer implements ILootSerializer { + @Override public void serialize(JsonObject json, VoluntarySeedDropChance value, JsonSerializationContext context) { json.addProperty("rarity", value.rarity); } + @Override public VoluntarySeedDropChance deserialize(JsonObject json, JsonDeserializationContext context) { return new VoluntarySeedDropChance(JSONUtils.getAsFloat(json, "rarity", 1.0F)); } diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/DTLootEntries.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/DTLootEntries.java new file mode 100644 index 000000000..c286494c1 --- /dev/null +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/DTLootEntries.java @@ -0,0 +1,24 @@ +package com.ferreusveritas.dynamictrees.loot.entry; + +import net.minecraft.loot.ILootSerializer; +import net.minecraft.loot.LootEntry; +import net.minecraft.loot.LootPoolEntryType; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.registry.Registry; + +/** + * @author Harley O'Connor + */ +public final class DTLootEntries { + + public static LootPoolEntryType + ITEM_BY_SPECIES = register("dynamictrees:item_by_species", new ItemBySpeciesLootEntry.Serializer()); + + private static LootPoolEntryType register(String name, ILootSerializer serializer) { + return Registry.register(Registry.LOOT_POOL_ENTRY_TYPE, new ResourceLocation(name), new LootPoolEntryType(serializer)); + } + + /** Invoked to initialise static fields. */ + public static void load() {} + +} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/ItemBySpeciesLootEntry.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/ItemBySpeciesLootEntry.java new file mode 100644 index 000000000..9deee7cf2 --- /dev/null +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/ItemBySpeciesLootEntry.java @@ -0,0 +1,79 @@ +package com.ferreusveritas.dynamictrees.loot.entry; + +import com.ferreusveritas.dynamictrees.loot.DTLootParameters; +import com.ferreusveritas.dynamictrees.trees.Species; +import com.google.common.collect.Maps; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonPrimitive; +import com.google.gson.JsonSerializationContext; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; +import net.minecraft.loot.LootContext; +import net.minecraft.loot.LootPoolEntryType; +import net.minecraft.loot.StandaloneLootEntry; +import net.minecraft.loot.conditions.ILootCondition; +import net.minecraft.loot.functions.ILootFunction; +import net.minecraft.util.JSONUtils; +import net.minecraft.util.ResourceLocation; + +import java.util.Map; +import java.util.function.Consumer; + +/** + * @author Harley O'Connor + */ +public final class ItemBySpeciesLootEntry extends StandaloneLootEntry { + + /** Map of items to set, keyed by the name of the species of tree. */ + private final Map items; + + public ItemBySpeciesLootEntry(int weight, int quality, ILootCondition[] conditions, + ILootFunction[] functions, + Map items) { + super(weight, quality, conditions, functions); + this.items = items; + } + + @Override + public LootPoolEntryType getType() { + return DTLootEntries.ITEM_BY_SPECIES; + } + + @Override + protected void createItemStack(Consumer stackConsumer, LootContext context) { + final Species species = context.getParamOrNull(DTLootParameters.SPECIES); + assert species != null; + Item item = items.get(species.getRegistryName()); + if (item == null) { + item = Items.AIR; + } + stackConsumer.accept(new ItemStack(item)); + } + + public static class Serializer extends StandaloneLootEntry.Serializer { + @Override + public void serializeCustom(JsonObject json, ItemBySpeciesLootEntry value, JsonSerializationContext context) { + super.serialize(json, value, context); + final JsonObject itemsJson = new JsonObject(); + for (Map.Entry itemEntry : value.items.entrySet()) { + itemsJson.add(itemEntry.getKey().toString(), new JsonPrimitive(itemEntry.getValue().getRegistryName().toString())); + } + json.add("name_by_species", itemsJson); + } + + @Override + protected ItemBySpeciesLootEntry deserialize(JsonObject json, JsonDeserializationContext context, + int weight, int quality, ILootCondition[] conditions, + ILootFunction[] functions) { + final JsonObject namesJson = JSONUtils.getAsJsonObject(json, "name_by_species"); + final Map items = Maps.newHashMap(); + for (Map.Entry itemEntry : namesJson.entrySet()) { + items.put(new ResourceLocation(itemEntry.getKey()), JSONUtils.convertToItem(itemEntry.getValue(), itemEntry.getKey())); + } + return new ItemBySpeciesLootEntry(weight, quality, conditions, functions, items); + } + } +} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/function/MultiplyLogsCount.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/function/MultiplyLogsCount.java index 8e33decfc..b9ab7e8e1 100644 --- a/src/main/java/com/ferreusveritas/dynamictrees/loot/function/MultiplyLogsCount.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/function/MultiplyLogsCount.java @@ -39,10 +39,12 @@ public static ILootFunction.IBuilder multiplyLogsCount() { } public static class Serializer extends LootFunction.Serializer { + @Override public void serialize(JsonObject json, MultiplyLogsCount value, JsonSerializationContext context) { super.serialize(json, value, context); } + @Override public MultiplyLogsCount deserialize(JsonObject json, JsonDeserializationContext context, ILootCondition[] conditions) { return new MultiplyLogsCount(conditions); } diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/function/MultiplySticksCount.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/function/MultiplySticksCount.java index d882d05d0..2a57c9dd7 100644 --- a/src/main/java/com/ferreusveritas/dynamictrees/loot/function/MultiplySticksCount.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/function/MultiplySticksCount.java @@ -40,10 +40,12 @@ public static ILootFunction.IBuilder multiplySticksCount() { } public static class Serializer extends LootFunction.Serializer { + @Override public void serialize(JsonObject json, MultiplySticksCount value, JsonSerializationContext context) { super.serialize(json, value, context); } + @Override public MultiplySticksCount deserialize(JsonObject json, JsonDeserializationContext context, ILootCondition[] conditions) { return new MultiplySticksCount(conditions); diff --git a/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java b/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java index d3888517e..1946e5007 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java @@ -818,16 +818,16 @@ public LootTable getLootTable(LootTableManager lootTables, Function getWoodDrops(World world, NetVolumeNode.Volume volume) { - return getWoodDrops(world, volume, ItemStack.EMPTY); + public List getBranchesDrops(World world, NetVolumeNode.Volume volume) { + return getBranchesDrops(world, volume, ItemStack.EMPTY); } - public List getWoodDrops(World world, NetVolumeNode.Volume volume, ItemStack tool) { - return getWoodDrops(world, volume, tool, null); + public List getBranchesDrops(World world, NetVolumeNode.Volume volume, ItemStack tool) { + return getBranchesDrops(world, volume, tool, null); } - public List getWoodDrops(World world, NetVolumeNode.Volume volume, - ItemStack tool, @Nullable Float explosionRadius) { + public List getBranchesDrops(World world, NetVolumeNode.Volume volume, + ItemStack tool, @Nullable Float explosionRadius) { volume.multiplyVolume(DTConfigs.TREE_HARVEST_MULTIPLIER.get()); // For cheaters.. you know who you are. if (world.isClientSide) { return Collections.emptyList(); @@ -837,17 +837,27 @@ public List getWoodDrops(World world, NetVolumeNode.Volume volume, int branchVolume = volume.getRawVolume(i); if (branchVolume > 0) { final BranchBlock branchBlock = family.getValidBranchBlock(i); - drops.addAll(getDropsForBranch(world, tool, explosionRadius, branchVolume, branchBlock)); + drops.addAll(getDropsForBranchType(world, tool, explosionRadius, branchVolume, branchBlock)); } } cleanDropsList(drops); return drops; } - private List getDropsForBranch(World world, ItemStack tool, @Nullable Float explosionRadius, - int branchVolume, BranchBlock branchBlock) { + private List getDropsForBranchType(World world, ItemStack tool, @Nullable Float explosionRadius, + int branchVolume, BranchBlock branchBlock) { return world.getServer().getLootTables().get(branchBlock.getLootTableName()) - .getRandomItems(createWoodLootContext(world, branchVolume, tool, explosionRadius)); + .getRandomItems(createBranchesLootContext(world, branchVolume, tool, explosionRadius)); + } + + private LootContext createBranchesLootContext(World world, int volume, ItemStack tool, + @Nullable Float explosionRadius) { + return new LootContext.Builder(WorldContext.getServerWorldOrThrow(world)) + .withParameter(LootParameters.TOOL, tool) + .withParameter(DTLootParameters.SPECIES, this) + .withParameter(DTLootParameters.VOLUME, volume) + .withOptionalParameter(LootParameters.EXPLOSION_RADIUS, explosionRadius) + .create(DTLootParameterSets.BRANCHES); } /** @@ -869,15 +879,6 @@ private void cleanDropsList(List drops) { } } - private LootContext createWoodLootContext(World world, int volume, ItemStack tool, - @Nullable Float explosionRadius) { - return new LootContext.Builder(WorldContext.getServerWorldOrThrow(world)) - .withParameter(LootParameters.TOOL, tool) - .withParameter(DTLootParameters.VOLUME, volume) - .withOptionalParameter(LootParameters.EXPLOSION_RADIUS, explosionRadius) - .create(DTLootParameterSets.BRANCHES); - } - public static class LogsAndSticks { public List logs; From e544824b792bdd00bcab96ab12e113d57ceb21ce Mon Sep 17 00:00:00 2001 From: Harleyoc1 Date: Mon, 8 Aug 2022 15:15:44 +0100 Subject: [PATCH 05/17] Add IsSpecies loot condition and MultiplyCount loot function --- gradle.properties | 2 +- .../loot/condition/DTLootConditions.java | 8 +-- .../loot/condition/IsSpecies.java | 54 ++++++++++++++++++ .../loot/function/DTLootFunctions.java | 1 + .../loot/function/MultiplyCount.java | 56 +++++++++++++++++++ 5 files changed, 115 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/ferreusveritas/dynamictrees/loot/condition/IsSpecies.java create mode 100644 src/main/java/com/ferreusveritas/dynamictrees/loot/function/MultiplyCount.java diff --git a/gradle.properties b/gradle.properties index d1ffda571..e9e3f8a6e 100755 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ modName=DynamicTrees modId=dynamictrees -modVersion=0.10.0-Beta-LR2 +modVersion=0.10.0-Beta-LR3 group=com.ferreusveritas.dynamictrees mcVersion=1.16.5 diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/DTLootConditions.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/DTLootConditions.java index 109196882..fe0ce25ae 100644 --- a/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/DTLootConditions.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/DTLootConditions.java @@ -11,11 +11,9 @@ */ public final class DTLootConditions { - public static final LootConditionType SEASONAL_SEED_DROP_CHANCE = - register("dynamictrees:seasonal_seed_drop_chance", new SeasonalSeedDropChance.Serializer()); - - public static final LootConditionType VOLUNTARY_SEED_DROP_CHANCE = - register("dynamictrees:voluntary_seed_drop_chance", new VoluntarySeedDropChance.Serializer()); + public static final LootConditionType IS_SPECIES = register("dynamictrees:is_species", new IsSpecies.Serializer()); + public static final LootConditionType SEASONAL_SEED_DROP_CHANCE = register("dynamictrees:seasonal_seed_drop_chance", new SeasonalSeedDropChance.Serializer()); + public static final LootConditionType VOLUNTARY_SEED_DROP_CHANCE = register("dynamictrees:voluntary_seed_drop_chance", new VoluntarySeedDropChance.Serializer()); private static LootConditionType register(String name, ILootSerializer serializer) { return Registry.register(Registry.LOOT_CONDITION_TYPE, new ResourceLocation(name), new LootConditionType(serializer)); diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/IsSpecies.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/IsSpecies.java new file mode 100644 index 000000000..15154809f --- /dev/null +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/IsSpecies.java @@ -0,0 +1,54 @@ +package com.ferreusveritas.dynamictrees.loot.condition; + +import com.ferreusveritas.dynamictrees.loot.DTLootParameters; +import com.ferreusveritas.dynamictrees.trees.Species; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonObject; +import com.google.gson.JsonSerializationContext; +import net.minecraft.loot.ILootSerializer; +import net.minecraft.loot.LootConditionType; +import net.minecraft.loot.LootContext; +import net.minecraft.loot.conditions.ILootCondition; +import net.minecraft.util.JSONUtils; +import net.minecraft.util.ResourceLocation; + +/** + * @author Harley O'Connor + */ +public final class IsSpecies implements ILootCondition { + + private final ResourceLocation name; + + public IsSpecies(ResourceLocation name) { + this.name = name; + } + + @Override + public LootConditionType getType() { + return DTLootConditions.IS_SPECIES; + } + + @Override + public boolean test(LootContext context) { + final Species species = context.getParamOrNull(DTLootParameters.SPECIES); + assert species != null; + return species.getRegistryName().equals(name); + } + + public static ILootCondition.IBuilder isSpecies(ResourceLocation name) { + return () -> new IsSpecies(name); + } + + public static class Serializer implements ILootSerializer { + @Override + public void serialize(JsonObject json, IsSpecies value, JsonSerializationContext context) { + json.addProperty("name", String.valueOf(value.name)); + } + + @Override + public IsSpecies deserialize(JsonObject json, JsonDeserializationContext context) { + return new IsSpecies(new ResourceLocation(JSONUtils.getAsString(json, "name"))); + } + } + +} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/function/DTLootFunctions.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/function/DTLootFunctions.java index 92774649c..39d885300 100644 --- a/src/main/java/com/ferreusveritas/dynamictrees/loot/function/DTLootFunctions.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/function/DTLootFunctions.java @@ -11,6 +11,7 @@ */ public final class DTLootFunctions { + public static LootFunctionType MULTIPLY_COUNT = register("dynamictrees:multiply_count", new MultiplyCount.Serializer()); public static LootFunctionType MULTIPLY_LOGS_COUNT = register("dynamictrees:multiply_logs_count", new MultiplyLogsCount.Serializer()); public static LootFunctionType MULTIPLY_STICKS_COUNT = register("dynamictrees:multiply_sticks_count", new MultiplySticksCount.Serializer()); diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/function/MultiplyCount.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/function/MultiplyCount.java new file mode 100644 index 000000000..59168c97f --- /dev/null +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/function/MultiplyCount.java @@ -0,0 +1,56 @@ +package com.ferreusveritas.dynamictrees.loot.function; + +import com.ferreusveritas.dynamictrees.loot.DTLootParameters; +import com.ferreusveritas.dynamictrees.systems.nodemappers.NetVolumeNode; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonObject; +import com.google.gson.JsonSerializationContext; +import net.minecraft.item.ItemStack; +import net.minecraft.loot.LootContext; +import net.minecraft.loot.LootFunction; +import net.minecraft.loot.LootFunctionType; +import net.minecraft.loot.conditions.ILootCondition; +import net.minecraft.loot.functions.ILootFunction; +import net.minecraft.util.JSONUtils; + +/** + * @author Harley O'Connor + */ +public final class MultiplyCount extends LootFunction { + + private final float multiplier; + + public MultiplyCount(ILootCondition[] conditions, float multiplier) { + super(conditions); + this.multiplier = multiplier; + } + + @Override + public LootFunctionType getType() { + return DTLootFunctions.MULTIPLY_COUNT; + } + + @Override + protected ItemStack run(ItemStack stack, LootContext context) { + stack.setCount((int) (stack.getCount() * multiplier)); + return stack; + } + + public static ILootFunction.IBuilder multiplyCount() { + return () -> new MultiplyLogsCount(new ILootCondition[0]); + } + + public static class Serializer extends LootFunction.Serializer { + @Override + public void serialize(JsonObject json, MultiplyCount value, JsonSerializationContext context) { + super.serialize(json, value, context); + json.addProperty("multiplier", value.multiplier); + } + + @Override + public MultiplyCount deserialize(JsonObject json, JsonDeserializationContext context, ILootCondition[] conditions) { + return new MultiplyCount(conditions, JSONUtils.getAsFloat(json, "multiplier")); + } + } + +} From 6722e5fa0ab18def9fc52a17a27a63154ee281a4 Mon Sep 17 00:00:00 2001 From: Harleyoc1 Date: Tue, 9 Aug 2022 11:25:35 +0100 Subject: [PATCH 06/17] Move leaves drop handling to LeavesProperties --- gradle.properties | 2 +- src/generated/resources/.cache/cache | 30 ++-- .../assets/dynamictrees/lang/de_de.json | 83 ----------- .../assets/dynamictrees/lang/es_es.json | 83 ----------- .../assets/dynamictrees/lang/es_mx.json | 83 ----------- .../assets/dynamictrees/lang/fr_fr.json | 83 ----------- .../assets/dynamictrees/lang/it_it.json | 97 ------------- .../assets/dynamictrees/lang/ko_kr.json | 24 ---- .../assets/dynamictrees/lang/nl_nl.json | 54 -------- .../assets/dynamictrees/lang/pl_pl.json | 71 ---------- .../assets/dynamictrees/lang/ru_ru.json | 85 ------------ .../assets/dynamictrees/lang/sv_se.json | 25 ---- .../assets/dynamictrees/lang/uk_ua.json | 44 ------ .../assets/dynamictrees/lang/zh_cn.json | 24 ---- .../loot_tables/blocks/acacia_leaves.json | 5 +- .../loot_tables/blocks/apple_oak_leaves.json | 131 ------------------ .../loot_tables/blocks/birch_leaves.json | 5 +- .../loot_tables/blocks/dark_oak_leaves.json | 5 +- .../loot_tables/blocks/jungle_leaves.json | 5 +- .../loot_tables/blocks/mega_crimson_wart.json | 18 --- .../loot_tables/blocks/mega_warped_wart.json | 18 --- .../loot_tables/blocks/oak_leaves.json | 5 +- .../loot_tables/blocks/spruce_leaves.json | 5 +- .../loot_tables/trees/leaves/acacia.json | 5 +- .../loot_tables/trees/leaves/apple_oak.json | 67 --------- .../loot_tables/trees/leaves/birch.json | 5 +- .../loot_tables/trees/leaves/dark_oak.json | 5 +- .../loot_tables/trees/leaves/jungle.json | 5 +- .../trees/leaves/mega_crimson.json | 28 ---- .../loot_tables/trees/leaves/mega_warped.json | 28 ---- .../loot_tables/trees/leaves/oak.json | 5 +- .../loot_tables/trees/leaves/spruce.json | 5 +- .../blocks/branches/BranchBlock.java | 12 +- .../blocks/leaves/DynamicLeavesBlock.java | 9 +- .../blocks/leaves/LeavesProperties.java | 98 ++++++++++++- .../blocks/leaves/WartProperties.java | 12 ++ .../data/provider/DTLootTableProvider.java | 112 +++++++-------- .../loot/DTLootParameterSets.java | 2 + .../loot/entry/DTLootEntries.java | 6 +- .../loot/entry/SeedItemLootEntry.java | 49 +++++++ .../LeavesPropertiesResourceLoader.java | 5 +- .../loader/SpeciesResourceLoader.java | 4 +- .../AlternativeLeavesGenFeature.java | 3 +- .../genfeatures/ConiferTopperGenFeature.java | 2 +- .../dynamictrees/trees/Family.java | 2 +- .../dynamictrees/trees/Species.java | 92 +----------- .../trees/species/NetherFungusSpecies.java | 22 --- .../leaves_properties/jungle.json | 5 +- .../trees/dynamictrees/species/jungle.json | 5 +- .../dynamictrees/species/mega_jungle.json | 5 +- 50 files changed, 278 insertions(+), 1305 deletions(-) delete mode 100755 src/generated/resources/assets/dynamictrees/lang/de_de.json delete mode 100755 src/generated/resources/assets/dynamictrees/lang/es_es.json delete mode 100755 src/generated/resources/assets/dynamictrees/lang/es_mx.json delete mode 100755 src/generated/resources/assets/dynamictrees/lang/fr_fr.json delete mode 100644 src/generated/resources/assets/dynamictrees/lang/it_it.json delete mode 100755 src/generated/resources/assets/dynamictrees/lang/ko_kr.json delete mode 100755 src/generated/resources/assets/dynamictrees/lang/nl_nl.json delete mode 100755 src/generated/resources/assets/dynamictrees/lang/pl_pl.json delete mode 100755 src/generated/resources/assets/dynamictrees/lang/ru_ru.json delete mode 100755 src/generated/resources/assets/dynamictrees/lang/sv_se.json delete mode 100755 src/generated/resources/assets/dynamictrees/lang/uk_ua.json delete mode 100755 src/generated/resources/assets/dynamictrees/lang/zh_cn.json delete mode 100644 src/generated/resources/data/dynamictrees/loot_tables/blocks/apple_oak_leaves.json delete mode 100644 src/generated/resources/data/dynamictrees/loot_tables/blocks/mega_crimson_wart.json delete mode 100644 src/generated/resources/data/dynamictrees/loot_tables/blocks/mega_warped_wart.json delete mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/apple_oak.json delete mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/mega_crimson.json delete mode 100644 src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/mega_warped.json create mode 100644 src/main/java/com/ferreusveritas/dynamictrees/loot/entry/SeedItemLootEntry.java diff --git a/gradle.properties b/gradle.properties index e9e3f8a6e..f64b6d871 100755 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ modVersion=0.10.0-Beta-LR3 group=com.ferreusveritas.dynamictrees mcVersion=1.16.5 -forgeVersion=36.2.30 +forgeVersion=36.2.34 mappingsVersion=2022.03.06 hwylaVersion=1.10.11-B78_1.16.2 diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index cfbd9da89..5a2475f8a 100755 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -93,16 +93,13 @@ e93499abbe31d9e789e29af06798a9caddc88e80 assets/dynamictrees/models/item/spruce_ 0a004b585c1035911f357ecaefec8799388a6d11 assets/dynamictrees/models/item/spruce_seed.json f19f3fb00967e33d24bce3ac224ebe952e5d3cd4 assets/dynamictrees/models/item/warped_branch.json 6f06586da567331dbe6251acb1aa1a554de5cfa6 assets/dynamictrees/models/item/warped_seed.json -bdec0fa1720c40635cd5afeb9ba320636d057622 data/dynamictrees/loot_tables/blocks/acacia_leaves.json -9ef4d821bef4ec97777a5e8093685d9f6d3e3610 data/dynamictrees/loot_tables/blocks/apple_oak_leaves.json -892b72b30628b59f463df230f07051c52eda4e5c data/dynamictrees/loot_tables/blocks/birch_leaves.json +a5edf7116643871a12a784a1b19d5a59061b72e1 data/dynamictrees/loot_tables/blocks/acacia_leaves.json +c67d7f34987a5f85b8f832632473d9ab8081d72e data/dynamictrees/loot_tables/blocks/birch_leaves.json 2a9c0717ddf89f86514ef3e161f9679ccc7bee29 data/dynamictrees/loot_tables/blocks/crimson_wart.json -f6e09c5bb782791017bec235b559ea4a891c41c1 data/dynamictrees/loot_tables/blocks/dark_oak_leaves.json -4c4093a9951cfb7dfdf3789eff64965c9a535b53 data/dynamictrees/loot_tables/blocks/jungle_leaves.json -2a9c0717ddf89f86514ef3e161f9679ccc7bee29 data/dynamictrees/loot_tables/blocks/mega_crimson_wart.json -3b375ed7e64d3d6d18499bbc1af30e5cd931e134 data/dynamictrees/loot_tables/blocks/mega_warped_wart.json -c2dd639099208e56c8ca1e0f96175b6173d2773c data/dynamictrees/loot_tables/blocks/oak_leaves.json -95876b44b323509c4a9940fab4b1bb2d25a4df6c data/dynamictrees/loot_tables/blocks/spruce_leaves.json +baab650063d6efc524a7dfacf2e983986fc306fe data/dynamictrees/loot_tables/blocks/dark_oak_leaves.json +c664597000eb6bb9d661adc8f6f89ddf42ff313c data/dynamictrees/loot_tables/blocks/jungle_leaves.json +1bfe2ec3b69704ccaeb20d4e72a48a94a30967eb data/dynamictrees/loot_tables/blocks/oak_leaves.json +95037f732cd18529c721f674f36471167700a761 data/dynamictrees/loot_tables/blocks/spruce_leaves.json 3b375ed7e64d3d6d18499bbc1af30e5cd931e134 data/dynamictrees/loot_tables/blocks/warped_wart.json f6d16a6825ddeaecdd0ddb2c2b1886f60ea82944 data/dynamictrees/loot_tables/trees/branches/acacia.json 8f45ffe7eebe4d5b164e23d5481a7b6af801655e data/dynamictrees/loot_tables/trees/branches/birch.json @@ -120,16 +117,13 @@ bca98cb1ec99edd9eb9f05bc0b2945a05b42899f data/dynamictrees/loot_tables/trees/bra 1c6d89c3fb1339f881e4e32cfae3b47f2504fd35 data/dynamictrees/loot_tables/trees/branches/stripped_spruce.json 9a3b714da894635be7b9a53d94c639652033b33c data/dynamictrees/loot_tables/trees/branches/stripped_warped.json 05f6da26478527e105eca41987455f402c95c913 data/dynamictrees/loot_tables/trees/branches/warped.json -c9b95dd9ca14ac6ae2ec8892a69e993580530fee data/dynamictrees/loot_tables/trees/leaves/acacia.json -f49afb7b939b90f15d5b7436abe620b0e6506e34 data/dynamictrees/loot_tables/trees/leaves/apple_oak.json -6e842c38a8ff6b27e327a164c288513d8db17de2 data/dynamictrees/loot_tables/trees/leaves/birch.json +3318e735a30793bad9a064415d477ea07bab55f2 data/dynamictrees/loot_tables/trees/leaves/acacia.json +3318e735a30793bad9a064415d477ea07bab55f2 data/dynamictrees/loot_tables/trees/leaves/birch.json 1fa0122268c45577f8d382b8d8f54eab235c52cb data/dynamictrees/loot_tables/trees/leaves/crimson.json -160e6fb15a0103a7f3f6a0157127a64e1bd953c8 data/dynamictrees/loot_tables/trees/leaves/dark_oak.json -44ccf77081fffbbe08f71e51bbfe2844e790526a data/dynamictrees/loot_tables/trees/leaves/jungle.json -1fa0122268c45577f8d382b8d8f54eab235c52cb data/dynamictrees/loot_tables/trees/leaves/mega_crimson.json -ade396476908421578ad8a9d9136de4da8608e7f data/dynamictrees/loot_tables/trees/leaves/mega_warped.json -9a457e1a5aa178cc04745a29774da2c6f30008eb data/dynamictrees/loot_tables/trees/leaves/oak.json -b00039411d88b117f1deb32f092394562bbd631a data/dynamictrees/loot_tables/trees/leaves/spruce.json +3318e735a30793bad9a064415d477ea07bab55f2 data/dynamictrees/loot_tables/trees/leaves/dark_oak.json +05a23cbd71c2de8369eeb33b52a9c170e126ec7c data/dynamictrees/loot_tables/trees/leaves/jungle.json +3318e735a30793bad9a064415d477ea07bab55f2 data/dynamictrees/loot_tables/trees/leaves/oak.json +3318e735a30793bad9a064415d477ea07bab55f2 data/dynamictrees/loot_tables/trees/leaves/spruce.json ade396476908421578ad8a9d9136de4da8608e7f data/dynamictrees/loot_tables/trees/leaves/warped.json 1afd145bc713c49a951b1aae9e958436c1e01fad data/dynamictrees/loot_tables/trees/voluntary/acacia.json f7155cfadea4513beea11b7af3a8b16595fc5966 data/dynamictrees/loot_tables/trees/voluntary/apple_oak.json diff --git a/src/generated/resources/assets/dynamictrees/lang/de_de.json b/src/generated/resources/assets/dynamictrees/lang/de_de.json deleted file mode 100755 index 07b8a82a1..000000000 --- a/src/generated/resources/assets/dynamictrees/lang/de_de.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "itemGroup.dynamictrees": "Dynamic Trees", - "block.dynamictrees.oak_branch": "Eichen Baum", - "block.dynamictrees.spruce_branch": "Fichten Baum", - "block.dynamictrees.birch_branch": "Birken Baum", - "block.dynamictrees.jungle_branch": "Tropen Baum", - "block.dynamictrees.dark_oak_branch": "Schwarz-Eichen Baum", - "block.dynamictrees.acacia_branch": "Akazien Baum", - "block.dynamictrees.crimson_branch": "Karmesin Pilz", - "block.dynamictrees.warped_branch": "Wirr-Pilz", - "species.dynamictrees.oak": "Eiche", - "species.dynamictrees.swamp_oak": "Sumpf-Eiche", - "species.dynamictrees.spruce": "Fichte", - "species.dynamictrees.mega_spruce": "Super Fichte", - "species.dynamictrees.birch": "Birke", - "species.dynamictrees.tall_birch": "Große Birke", - "species.dynamictrees.jungle": "Tropenbaum", - "species.dynamictrees.mega_jungle": "Super Tropenbaum", - "species.dynamictrees.dark_oak": "Schwarz-Eiche", - "species.dynamictrees.acacia": "Akazie", - "species.dynamictrees.apple_oak": "Apfelbaum", - "species.dynamictrees.crimson": "Karmesin-Pilz", - "species.dynamictrees.mega_crimson": "Super Karmesin-Pilz", - "species.dynamictrees.warped": "Wirr-Pilz", - "species.dynamictrees.mega_warped": "Super Wirr-Pilz", - "item.dynamictrees.oak_seed": "Eichel", - "item.dynamictrees.spruce_seed": "Fichtenzapfen", - "item.dynamictrees.birch_seed": "Birkenkätzchen", - "item.dynamictrees.jungle_seed": "Tropbenbaumschote", - "item.dynamictrees.dark_oak_seed": "Schwarz-Eichen Eichel", - "item.dynamictrees.acacia_seed": "Akazien Samen", - "item.dynamictrees.apple_oak_seed": "Apfelkern", - "item.dynamictrees.crimson_seed": "Karmesin Hut", - "item.dynamictrees.warped_seed": "Wirr Hut", - "item.dynamictrees.dendro_potion.biochar": "Biokohlen Basistrank", - "item.dynamictrees.dendro_potion.depletion": "Trank der Verarmung", - "item.dynamictrees.dendro_potion.gigas": "Trank des Superwachstums", - "item.dynamictrees.dendro_potion.burgeoning": "Trank des Aufkeimens", - "item.dynamictrees.dendro_potion.fertility": "Trank der Düngung", - "item.dynamictrees.dendro_potion.persistence": "Trank des Verharrens", - "item.dynamictrees.dendro_potion.transform": "Trank der Transformation", - "item.dynamictrees.dendro_potion.harvest": "Trank der Ernte", - "item.dynamictrees.dendro_potion.denuding": "Trank der Entblößung", - "item.dynamictrees.dirt_bucket": "Eimer mit Erde", - "item.dynamictrees.staff": "Waldland Stab", - "block.dynamictrees.potted_sapling": "Eingetopfter Setzling", - "chat.registry_name": "Register Name: %s", - "tooltip.dynamictrees.species": "Spezies: %s", - "tooltip.dynamictrees.fertility": "Fertilität: %s", - "tooltip.dynamictrees.jo_code": "JoCode: %s", - "tooltip.dynamictrees.force_planting": "Pflanzung erzwingen: %s", - "tooltip.dynamictrees.seed_life_span": "Lebensdauer verschnellern: %s", - "tooltip.dynamictrees.enabled": "Aktiv", - "commands.dynamictrees.success.get_tree": "Spezies: %s JoCode: %s", - "commands.dynamictrees.error.get_tree": "Konnte die Spezies bei %s nicht finden.", - "commands.dynamictrees.success.set_tree": "Baum wurde erfolgreich an Position %s to spezies %s with JoCode %s gesetzt.", - "commands.dynamictrees.success.kill_tree": "Baum wurde erfolgreich an Position %s getötet.", - "commands.dynamictrees.error.unknown_species": "Unbekannte Spezies %s.", - "commands.dynamictrees.success.get_fertility": "Fertilität des Baumes an Position %s ist %s.", - "commands.dynamictrees.success.set_fertility": "Fertilität des Baumes an Position %s erfolgreich auf %s gesetzt.", - "commands.dynamictrees.success.grow_pulse": "Wachstumsimpuls von %s wurde erfolgreich an Baum auf Position %s gesendet.", - "commands.dynamictrees.success.set_xor": "Koordinaten wurden erfolgreich von Xor auf %s gesetzt.", - "commands.dynamictrees.success.rotate_jo_code": "JoCode wurde rotiert:", - "commands.dynamictrees.error.species_equal": "Zielspezies ist schon die jetzige Spezies.", - "commands.dynamictrees.success.transform": "Spezies %s wurde erfolgreich an Position %s zu Spezies %s geändert.", - "commands.dynamictrees.error.not_transformable": "Spezies %s kann nicht umgewandelt werden.", - "commands.dynamictrees.success.create_staff": "Stab wurde erfolgreich mit Spezies %s, Code %s, Farbe %s, nur lesen %s, und maximal %s Benutzungen an Position %s kreiert.", - "commands.dynamictrees.success.create_transform_potion": "Trank der Umwandlung wurde erfolgreich für Spezies %s an Position %s erstellt.", - "commands.dynamictrees.success.clear_orphaned": "%s Unangebundene Netzwerke aus Zweigen wurde erfolgreich entfernt.", - "commands.dynamictrees.success.purge_trees": "%s Bäume wurden erfolgreich gesäubert.", - "potion.biochar.description": "Basis für das Brauen von Baumtränken", - "potion.depletion.description": "Zerstört die Fruchbarkeit des durchwurzelten Bodens", - "potion.gigas.description": "Erlaubt dem Baum seine Superform zu erlangen", - "potion.burgeoning.description": "Lässt den Baum schnell wachsen", - "potion.fertility.description": "Düngt den durchwurzelten Boden komplett", - "potion.persistence.description": "Der Baum bleibt in seinem jetzigen Zustand", - "potion.transform.description": "Transformiert einen Baum in eine %s tree", - "potion.transform.description.empty": "Basistrank für das Brauen von Transformationen", - "potion.harvest.description": "Verschnellert die Frutifikation", - "potion.denuding.description": "Entfernt alles an Rinde und Laub vom jeweiligen Baum.", - "death.attack.falling_tree": "%1$s wurde von einem fallenden Baum zerschmettert", - "block.dynamictrees.rooty_water": "Wasserwurzeln" -} \ No newline at end of file diff --git a/src/generated/resources/assets/dynamictrees/lang/es_es.json b/src/generated/resources/assets/dynamictrees/lang/es_es.json deleted file mode 100755 index 29903127b..000000000 --- a/src/generated/resources/assets/dynamictrees/lang/es_es.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "itemGroup.dynamictrees": "Dynamic Trees", - "block.dynamictrees.oak_branch": "Roble", - "block.dynamictrees.spruce_branch": "Abeto", - "block.dynamictrees.birch_branch": "Abedúl", - "block.dynamictrees.jungle_branch": "Árbol de jungla", - "block.dynamictrees.dark_oak_branch": "Roble oscuro", - "block.dynamictrees.acacia_branch": "Acacia", - "block.dynamictrees.crimson_branch": "Hongo carmesí", - "block.dynamictrees.warped_branch": "Hongo distorsionado", - "species.dynamictrees.oak": "Roble", - "species.dynamictrees.swamp_oak": "Roble de pantano", - "species.dynamictrees.spruce": "Abeto", - "species.dynamictrees.mega_spruce": "Abeto gigante", - "species.dynamictrees.birch": "Abedul", - "species.dynamictrees.tall_birch": "Abedul alto", - "species.dynamictrees.jungle": "Jungla", - "species.dynamictrees.mega_jungle": "Jungla gigante", - "species.dynamictrees.dark_oak": "Roble oscuro", - "species.dynamictrees.acacia": "Acacia", - "species.dynamictrees.apple_oak": "Manzano", - "species.dynamictrees.crimson": "Hongo Carmesí", - "species.dynamictrees.mega_crimson": "Hongo carmesí gigante", - "species.dynamictrees.warped": "Hongo distorsionado", - "species.dynamictrees.mega_warped": "Hongo distorsionado Gigante", - "item.dynamictrees.oak_seed": "Bellota de roble", - "item.dynamictrees.spruce_seed": "Piña de abeto", - "item.dynamictrees.birch_seed": "Amento de abedúl", - "item.dynamictrees.jungle_seed": "Vaina de jungla", - "item.dynamictrees.dark_oak_seed": "Bellota de roble oscuro", - "item.dynamictrees.acacia_seed": "Semilla de acacia", - "item.dynamictrees.apple_oak_seed": "Semilla de manzana", - "item.dynamictrees.crimson_seed": "Tapa de hongo carmesí", - "item.dynamictrees.warped_seed": "Tapa de hongo distorsionado", - "item.dynamictrees.dendro_potion.biochar": "Poción base de biocarbón", - "item.dynamictrees.dendro_potion.depletion": "Poción de agotamiento", - "item.dynamictrees.dendro_potion.gigas": "Poción de gigantismo", - "item.dynamictrees.dendro_potion.burgeoning": "Poción de florecimiento", - "item.dynamictrees.dendro_potion.fertility": "Poción de fertilidad", - "item.dynamictrees.dendro_potion.persistence": "Poción de persistencia", - "item.dynamictrees.dendro_potion.transform": "Poción de transformación", - "item.dynamictrees.dendro_potion.harvest": "Poción de cosecha", - "item.dynamictrees.dendro_potion.denuding": "Poción de descortezar", - "item.dynamictrees.dirt_bucket": "Cubo con Tierra", - "item.dynamictrees.staff": "Bastón del Bosque", - "block.dynamictrees.potted_sapling": "Pimpollo enmacetado", - "chat.registry_name": "Nombre de registro: %s", - "tooltip.dynamictrees.species": "Especie: %s", - "tooltip.dynamictrees.fertility": "Fertilidad: %s", - "tooltip.dynamictrees.jo_code": "JoCode: %s", - "tooltip.dynamictrees.force_planting": "Forzar plantación: %s", - "tooltip.dynamictrees.seed_life_span": "Longitud de vida de la semilla: %s", - "tooltip.dynamictrees.enabled": "Activado", - "commands.dynamictrees.success.get_tree": "Especie: %s JoCode: %s", - "commands.dynamictrees.error.get_tree": "No se encontraron especies de árboles en la posición %s.", - "commands.dynamictrees.success.set_tree": "Se ha colocado correctamente un árbol en la posición %s con la especie %s y el JoCode %s.", - "commands.dynamictrees.success.kill_tree": "Árbol en la posición %s eliminado correctamente.", - "commands.dynamictrees.error.unknown_species": "Especie %s desconocida.", - "commands.dynamictrees.success.get_fertility": "La fertilidad del suelo del árbol en la posición %s es %s.", - "commands.dynamictrees.success.set_fertility": "La fertilidad del suelo del árbol en la posición %s ha sido correctamente modificada a %s.", - "commands.dynamictrees.success.grow_pulse": "%s pulsos de crecimiento enviados exitosamente al árbol en la posición %s.", - "commands.dynamictrees.success.set_xor": "La coordenada Xor a sido correctamente configurada a %s.", - "commands.dynamictrees.success.rotate_jo_code": "JoCode rotado: %s", - "commands.dynamictrees.error.species_equal": "La especie elegida es la misma que la especie dada.", - "commands.dynamictrees.success.transform": "La especie %s en la posición %s ha sido exitosamente transformada a la especie %s.", - "commands.dynamictrees.error.not_transformable": "La especie %s no se puede transformar.", - "commands.dynamictrees.success.create_staff": "Bastón con la especie %s, código %s, color %s, solo lectura %s, y maximos usos %s creada correctamente en la posición %s.", - "commands.dynamictrees.success.create_transform_potion": "Poción de transformación para la especie %s creada correctamente en la posición %s.", - "commands.dynamictrees.success.clear_orphaned": "%s redes de ramas solitarias han sido borradas correctamente.", - "commands.dynamictrees.success.purge_trees": "%s árboles purgados correctamente.", - "potion.biochar.description": "Poción base para destilar pociones de árboles", - "potion.depletion.description": "Destruye la fertilidad del suelo de un árbol", - "potion.gigas.description": "Permite que un árbol tenga un gran tamaño", - "potion.burgeoning.description": "Crezca un árbol rápidamente", - "potion.fertility.description": "Fertiliza el suelo de un árbol completamente", - "potion.persistence.description": "Evita que un árbol cambie", - "potion.transform.description": "Transforma un árbol en un árbol de %s", - "potion.transform.description.empty": "Poción base para destilar pociones de transformación de árboles", - "potion.harvest.description": "Acelera la producción de fruta", - "potion.denuding.description": "Elimina la corteza y las hojas de un árbol", - "death.attack.falling_tree": "%1$s fue aplastado por un árbol", - "block.dynamictrees.rooty_water": "Raíces de agua" -} \ No newline at end of file diff --git a/src/generated/resources/assets/dynamictrees/lang/es_mx.json b/src/generated/resources/assets/dynamictrees/lang/es_mx.json deleted file mode 100755 index 2a85029f8..000000000 --- a/src/generated/resources/assets/dynamictrees/lang/es_mx.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "itemGroup.dynamictrees": "Dynamic Trees", - "block.dynamictrees.oak_branch": "Roble", - "block.dynamictrees.spruce_branch": "Abeto", - "block.dynamictrees.birch_branch": "Abedúl", - "block.dynamictrees.jungle_branch": "Árbol de jungla", - "block.dynamictrees.dark_oak_branch": "Roble oscuro", - "block.dynamictrees.acacia_branch": "Acacia", - "block.dynamictrees.crimson_branch": "Hongo carmesí", - "block.dynamictrees.warped_branch": "Hongo distorsionado", - "species.dynamictrees.oak": "Roble", - "species.dynamictrees.swamp_oak": "Roble de pantano", - "species.dynamictrees.spruce": "Abeto", - "species.dynamictrees.mega_spruce": "Mega abeto", - "species.dynamictrees.birch": "Abedúl", - "species.dynamictrees.tall_birch": "Abedúl alto", - "species.dynamictrees.jungle": "Jungla", - "species.dynamictrees.mega_jungle": "Mega jungla", - "species.dynamictrees.dark_oak": "Roble oscuro", - "species.dynamictrees.acacia": "Acacia", - "species.dynamictrees.apple_oak": "Manzano", - "species.dynamictrees.crimson": "Hongo carmesí", - "species.dynamictrees.mega_crimson": "Mega hongo carmesí", - "species.dynamictrees.warped": "Hongo distorsionado", - "species.dynamictrees.mega_warped": "Mega hongo distorsionado", - "item.dynamictrees.oak_seed": "Bellota de roble", - "item.dynamictrees.spruce_seed": "Piña de abeto", - "item.dynamictrees.birch_seed": "Amento de abedúl", - "item.dynamictrees.jungle_seed": "Semillas de jungla", - "item.dynamictrees.dark_oak_seed": "Bellota de roble oscuro", - "item.dynamictrees.acacia_seed": "Semilla de acacia", - "item.dynamictrees.apple_oak_seed": "Semilla de manzana", - "item.dynamictrees.crimson_seed": "Tapa de hongo carmesí", - "item.dynamictrees.warped_seed": "Tapa de hongo distorsionado", - "item.dynamictrees.dendro_potion.biochar": "Poción base de biocarbón", - "item.dynamictrees.dendro_potion.depletion": "Poción de agotamiento", - "item.dynamictrees.dendro_potion.gigas": "Poción de gigantismo", - "item.dynamictrees.dendro_potion.burgeoning": "Poción de florecimiento", - "item.dynamictrees.dendro_potion.fertility": "Poción de fertilidad", - "item.dynamictrees.dendro_potion.persistence": "Poción de persistencia", - "item.dynamictrees.dendro_potion.transform": "Poción de transformación", - "item.dynamictrees.dendro_potion.harvest": "Poción de cosecha", - "item.dynamictrees.dendro_potion.denuding": "Poción de descortezar", - "item.dynamictrees.dirt_bucket": "Cubeta con tierra", - "item.dynamictrees.staff": "Bastón del Bosque", - "block.dynamictrees.potted_sapling": "Retoño enmacetado", - "chat.registry_name": "Nombre de registro: %s", - "tooltip.dynamictrees.species": "Especie: %s", - "tooltip.dynamictrees.fertility": "Fertilidad: %s", - "tooltip.dynamictrees.jo_code": "JoCode: %s", - "tooltip.dynamictrees.force_planting": "Forzar plantación: %s", - "tooltip.dynamictrees.seed_life_span": "Longitud de vida de la semilla: %s", - "tooltip.dynamictrees.enabled": "Activado", - "commands.dynamictrees.success.get_tree": "Especie: %s JoCode: %s", - "commands.dynamictrees.error.get_tree": "No se encontraron especies de árboles en la posición %s.", - "commands.dynamictrees.success.set_tree": "Se ha colocado correctamente un árbol en la posición %s con la especie %s y el JoCode %s.", - "commands.dynamictrees.success.kill_tree": "Árbol en la posición %s eliminado correctamente.", - "commands.dynamictrees.error.unknown_species": "Especie %s desconocida.", - "commands.dynamictrees.success.get_fertility": "La fertilidad del suelo del árbol en la posición %s es %s.", - "commands.dynamictrees.success.set_fertility": "La fertilidad del suelo del árbol en la posición %s ha sido correctamente modificada a %s.", - "commands.dynamictrees.success.grow_pulse": "%s pulsos de crecimiento enviados exitosamente al árbol en la posición %s.", - "commands.dynamictrees.success.set_xor": "La coordenada Xor a sido correctamente configurada a %s.", - "commands.dynamictrees.success.rotate_jo_code": "JoCode girado: %s", - "commands.dynamictrees.error.species_equal": "La especie elegida es la misma que la especie dada.", - "commands.dynamictrees.success.transform": "La especie %s en la posición %s ha sido exitosamente transformada a la especie %s.", - "commands.dynamictrees.error.not_transformable": "La especie %s no se puede transformar.", - "commands.dynamictrees.success.create_staff": "Bastón con la especie %s, código %s, color %s, solo lectura %s, y maximos usos %s creada correctamente en la posición %s.", - "commands.dynamictrees.success.create_transform_potion": "Poción de transformación para la especie %s creada correctamente en la posición %s.", - "commands.dynamictrees.success.clear_orphaned": "%s redes de ramas solitarias han sido borradas correctamente.", - "commands.dynamictrees.success.purge_trees": "%s árboles purgados correctamente.", - "potion.biochar.description": "Poción base para destilar pociones de árboles", - "potion.depletion.description": "Destruye la fertilidad del suelo de un árbol", - "potion.gigas.description": "Permite que un árbol tenga un gran tamaño", - "potion.burgeoning.description": "Crezca un árbol rápidamente", - "potion.fertility.description": "Fertiliza el suelo de un árbol completamente", - "potion.persistence.description": "Evita que un árbol cambie", - "potion.transform.description": "Transforma un árbol en un árbol de %s", - "potion.transform.description.empty": "Poción base para destilar pociones de transformación de árboles", - "potion.harvest.description": "Acelera la producción de fruta", - "potion.denuding.description": "Elimina la corteza y las hojas de un árbol", - "death.attack.falling_tree": "%1$s fue aplastado por un árbol que le cayó encima", - "block.dynamictrees.rooty_water": "Raíces de agua" -} \ No newline at end of file diff --git a/src/generated/resources/assets/dynamictrees/lang/fr_fr.json b/src/generated/resources/assets/dynamictrees/lang/fr_fr.json deleted file mode 100755 index 6778d891b..000000000 --- a/src/generated/resources/assets/dynamictrees/lang/fr_fr.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "itemGroup.dynamictrees": "Dynamic Trees", - "block.dynamictrees.oak_branch": "Chêne", - "block.dynamictrees.spruce_branch": "Épicéa", - "block.dynamictrees.birch_branch": "Bouleau", - "block.dynamictrees.jungle_branch": "Acajou", - "block.dynamictrees.dark_oak_branch": "Chêne noir", - "block.dynamictrees.acacia_branch": "Acacia", - "block.dynamictrees.crimson_branch": "Champignon carmin", - "block.dynamictrees.warped_branch": "Champignon biscornu", - "species.dynamictrees.oak": "Chêne", - "species.dynamictrees.swamp_oak": "Chêne des marais", - "species.dynamictrees.spruce": "Épicéa", - "species.dynamictrees.mega_spruce": "Épicéa géant", - "species.dynamictrees.birch": "Bouleau", - "species.dynamictrees.tall_birch": "Grand bouleau", - "species.dynamictrees.jungle": "Acajou", - "species.dynamictrees.mega_jungle": "Acajou géant", - "species.dynamictrees.dark_oak": "Chêne noir", - "species.dynamictrees.acacia": "Acacia", - "species.dynamictrees.apple_oak": "Pommier", - "species.dynamictrees.crimson": "Champignon carmin", - "species.dynamictrees.mega_crimson": "Champignon carmin géant", - "species.dynamictrees.warped": "Champignon biscornu", - "species.dynamictrees.mega_warped": "Champignon biscornu géant", - "item.dynamictrees.oak_seed": "Gland de chêne", - "item.dynamictrees.spruce_seed": "Cône d'épicéa", - "item.dynamictrees.birch_seed": "Graine de bouleau", - "item.dynamictrees.jungle_seed": "Pomme d'acajou", - "item.dynamictrees.dark_oak_seed": "Gland de chêne noir", - "item.dynamictrees.acacia_seed": "Graine d'acacia", - "item.dynamictrees.apple_oak_seed": "Pépin de pomme", - "item.dynamictrees.crimson_seed": "Chapeau de champignon carmin", - "item.dynamictrees.warped_seed": "Chapeau de champignon biscornu", - "item.dynamictrees.dendro_potion.biochar": "Potion bio-charbon de base", - "item.dynamictrees.dendro_potion.depletion": "Potion d'épuisement", - "item.dynamictrees.dendro_potion.gigas": "Potion de gigantisme", - "item.dynamictrees.dendro_potion.burgeoning": "Potion de bourgeonnement", - "item.dynamictrees.dendro_potion.fertility": "Potion de fertilité", - "item.dynamictrees.dendro_potion.persistence": "Potion de persistance", - "item.dynamictrees.dendro_potion.transform": "Potion de transformation", - "item.dynamictrees.dendro_potion.harvest": "Potion de récolte", - "item.dynamictrees.dendro_potion.denuding": "Potion de déboisement", - "item.dynamictrees.dirt_bucket": "Seau de terre", - "item.dynamictrees.staff": "Bâton des bois", - "block.dynamictrees.potted_sapling": "Pousse en pot", - "chat.registry_name": "Nom de registre: %s", - "tooltip.dynamictrees.species": "Espèce: %s", - "tooltip.dynamictrees.fertility": "Fertilité: %s", - "tooltip.dynamictrees.jo_code": "JoCode: %s", - "tooltip.dynamictrees.force_planting": "Plantation forcée:%s", - "tooltip.dynamictrees.seed_life_span": "Durée de vie des graines:%s", - "tooltip.dynamictrees.enabled": "Activé", - "commands.dynamictrees.success.get_tree": "Espèce: %s JoCode: %s", - "commands.dynamictrees.error.get_tree": "Impossible de trouver des espèces d'arbres à la position %s.", - "commands.dynamictrees.success.set_tree": "Placement de l'arbre réussi à la position %s de l'espèce %s with JoCode %s.", - "commands.dynamictrees.success.kill_tree": "Destruction de l'arbre réussi à la position %s.", - "commands.dynamictrees.error.unknown_species": "Espèces inconnues %s.", - "commands.dynamictrees.success.get_fertility": "Fertilité du sol de l'arbre à la position %s est de %s.", - "commands.dynamictrees.success.set_fertility": "Placement de fertilité du sol réussi à la position %s vers %s.", - "commands.dynamictrees.success.grow_pulse": "Envoi réussi de %s impulsions de croissance à l'arbre à la position %s.", - "commands.dynamictrees.success.set_xor": "Placement des coordonnées réussi Xor vers %s.", - "commands.dynamictrees.success.rotate_jo_code": "Rotation JoCode: %s", - "commands.dynamictrees.error.species_equal": "L'espèce ciblée est la même que l'espèce donnée.", - "commands.dynamictrees.success.transform": "Transformation de l'espèce %s à la position %s en l'espèce %s.", - "commands.dynamictrees.error.not_transformable": "L'espèce %s n'est pas transformable.", - "commands.dynamictrees.success.create_staff": "Bâton des bois créé avec succès avec des espèces %s, code %s, couleur %s, peut lire %s, utilisations totale %s à la position %s.", - "commands.dynamictrees.success.create_transform_potion": "Création de la potion de transformation réussi pour l'espèce %s à la position %s.", - "commands.dynamictrees.success.clear_orphaned": "%s morceaux de branches orphelines effacé avec succès.", - "commands.dynamictrees.success.purge_trees": "%s arbres purgés avec succès.", - "potion.biochar.description": "Potion d'arbre de base", - "potion.depletion.description": "Détruit la fertilité du sol des arbres", - "potion.gigas.description": "Permet à un arbre de devenir géant", - "potion.burgeoning.description": "Fait pousser rapidement un arbre", - "potion.fertility.description": "Fertilise complètement le sol des arbres", - "potion.persistence.description": "Empêche un arbre de changer", - "potion.transform.description": "Transforme un arbre en un arbre %s", - "potion.transform.description.empty": "Potion d'arbre de base pour transformations", - "potion.harvest.description": "Accélère la production de fruits", - "potion.denuding.description": "Enlève toute l'écorce et les feuilles d'un arbre", - "death.attack.falling_tree": "%1$s a été écrasé par un arbre qui tombe", - "block.dynamictrees.rooty_water": "Racines aquatiques" -} \ No newline at end of file diff --git a/src/generated/resources/assets/dynamictrees/lang/it_it.json b/src/generated/resources/assets/dynamictrees/lang/it_it.json deleted file mode 100644 index 2911bf57f..000000000 --- a/src/generated/resources/assets/dynamictrees/lang/it_it.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "itemGroup.dynamictrees": "Dynamic Trees", - - "block.dynamictrees.oak_branch": "Albero di quercia", - "block.dynamictrees.spruce_branch": "Albero di abete", - "block.dynamictrees.birch_branch": "Albero di betulla", - "block.dynamictrees.jungle_branch": "Albero della giungla", - "block.dynamictrees.dark_oak_branch": "Albero di quercia scura", - "block.dynamictrees.acacia_branch": "Albero di acacia", - "block.dynamictrees.crimson_branch": "Fungo cremisi", - "block.dynamictrees.warped_branch": "Fungo distorto", - - "species.dynamictrees.oak": "Quercia", - "species.dynamictrees.swamp_oak": "Quercia di palude", - "species.dynamictrees.spruce": "Abete", - "species.dynamictrees.mega_spruce": "Abete gigante", - "species.dynamictrees.birch": "Betulla", - "species.dynamictrees.tall_birch": "Betulla alta", - "species.dynamictrees.jungle": "Giungla", - "species.dynamictrees.mega_jungle": "Giungla gigante", - "species.dynamictrees.dark_oak": "Quercia scura", - "species.dynamictrees.acacia": "Acacia", - "species.dynamictrees.apple_oak": "Melo", - "species.dynamictrees.crimson": "Cremisi", - "species.dynamictrees.mega_crimson": "Cremisi grande", - "species.dynamictrees.warped": "Distorto", - "species.dynamictrees.mega_warped": "Distorto grande", - "species.dynamictrees.red_mushroom": "Fungo rosso", - "species.dynamictrees.brown_mushroom": "Fungo marrone", - - "item.dynamictrees.oak_seed": "Ghianda di quercia", - "item.dynamictrees.spruce_seed": "Pigna di abete", - "item.dynamictrees.birch_seed": "Amento di betulla", - "item.dynamictrees.jungle_seed": "Baccello della giungla", - "item.dynamictrees.dark_oak_seed": "Ghianda di quercia scura", - "item.dynamictrees.acacia_seed": "Seme di acacia", - "item.dynamictrees.apple_oak_seed": "Seme di melo", - "item.dynamictrees.crimson_seed": "Cappello cremisi", - "item.dynamictrees.warped_seed": "Cappello distorto", - - "item.dynamictrees.dendro_potion.biochar": "Pozione base di biochar", - "item.dynamictrees.dendro_potion.depletion": "Potzione di esaurimento", - "item.dynamictrees.dendro_potion.gigas": "Pozione di gigantismo", - "item.dynamictrees.dendro_potion.burgeoning": "Pozione della fioritura", - "item.dynamictrees.dendro_potion.fertility": "Pozione della fertilità", - "item.dynamictrees.dendro_potion.persistence": "Pozione di persistenza", - "item.dynamictrees.dendro_potion.transform": "Pozione della transformazione", - "item.dynamictrees.dendro_potion.harvest": "Pozione del raccolto", - "item.dynamictrees.dendro_potion.denuding": "Pozione della denudazione", - - "item.dynamictrees.dirt_bucket": "Secchio di terra", - "item.dynamictrees.staff": "Staffa della foresta", - "block.dynamictrees.potted_sapling": "Arboscello in vaso", - - "chat.registry_name": "Nome di registro: %s", - - "tooltip.dynamictrees.species": "Specie: %s", - "tooltip.dynamictrees.fertility": "Fertilità: %s", - "tooltip.dynamictrees.jo_code": "JoCode: %s", - "tooltip.dynamictrees.force_planting": "Forza piantagione: %s", - "tooltip.dynamictrees.seed_life_span": "Durata vita del seme: %s", - - "tooltip.dynamictrees.enabled": "Abilitato", - - "commands.dynamictrees.success.get_tree": "Specie: %s JoCode: %s", - "commands.dynamictrees.error.get_tree": "Impossibile trovare specie arboree in posizione %s.", - "commands.dynamictrees.success.set_tree": "Impostare correttamente l'albero alla posizione %s sulla specie %s con JoCode %s.", - "commands.dynamictrees.success.kill_tree": "Albero ucciso con successo alla posizione %s.", - "commands.dynamictrees.error.unknown_species": "Specie sconosciuta %s.", - "commands.dynamictrees.success.get_fertility": "Fertilità dell'albero alla posizione %s è %s.", - "commands.dynamictrees.success.set_fertility": "Impostata con successo la fertilità dell'albero in posizione %s a %s.", - "commands.dynamictrees.success.grow_pulse": "Inviati con successo %s impulsi di crescita all'albero in posizione %s.", - "commands.dynamictrees.success.set_xor": "Coordinate Xor settate con successo a %s.", - "commands.dynamictrees.success.rotate_jo_code": "Rotazione JoCode: %s", - "commands.dynamictrees.error.species_equal": "Le specie volute sono le stesse delle specie date.", - "commands.dynamictrees.success.transform": "Specie trasformata con successo %s nella posizione %s in specie %s.", - "commands.dynamictrees.error.not_transformable": "Specie %s non è transformabile.", - "commands.dynamictrees.success.create_staff": "Staffa creata con successo con specie %s, codice %s, colore %s, sola lettura %s e max utilizzi %s in posizione %s.", - "commands.dynamictrees.success.create_transform_potion": "Pozione di trasformazione creata con successo per la specie %s in posizione %s.", - "commands.dynamictrees.success.clear_orphaned": "Cancellate con successo %s categorie orfane.", - "commands.dynamictrees.success.purge_trees": "Alberi %s eliminati con successo.", - - "potion.biochar.description": "Pozione per alberi base per fermentazione", - "potion.depletion.description": "Distrugge la fertilità del suolo degli alberi", - "potion.gigas.description": "Autorizza un albero a diventare gigante", - "potion.burgeoning.description": "Fa crescere velocemente un albero", - "potion.fertility.description": "Concima completamente il terreno dell' albero", - "potion.persistence.description": "Ferma il cambiamento dell'albero", - "potion.transform.description": "Trasforma l'albero in un albero %s", - "potion.transform.description.empty": "Pozione dell'albero base per le trasformazioni", - "potion.harvest.description": "Velocizza la produzione di frutti", - "potion.denuding.description": "Rimuove tutta la corteccia e le foglie dall'albero", - - "death.attack.falling_tree": "%1$s è stato schiacciato da un albero", - - "block.dynamictrees.rooty_water": "Radici acquatiche" -} diff --git a/src/generated/resources/assets/dynamictrees/lang/ko_kr.json b/src/generated/resources/assets/dynamictrees/lang/ko_kr.json deleted file mode 100755 index 939741ad7..000000000 --- a/src/generated/resources/assets/dynamictrees/lang/ko_kr.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "itemGroup.dynamictrees": "다이나믹 트리", - "block.dynamictrees.oak_branch": "참나무", - "block.dynamictrees.spruce_branch": "가문비나무", - "block.dynamictrees.birch_branch": "자작나무", - "block.dynamictrees.jungle_branch": "정글 나무", - "block.dynamictrees.dark_oak_branch": "검은 참나무", - "block.dynamictrees.acacia_branch": "아카시아 나무", - "item.dynamictrees.oak_seed": "참나무 도토리", - "item.dynamictrees.spruce_seed": "가문비나무 구과", - "item.dynamictrees.birch_seed": "자작나무 꽃차례", - "item.dynamictrees.jungle_seed": "정글 나무 꼬투리", - "item.dynamictrees.dark_oak_seed": "검은 참나무 도토리", - "item.dynamictrees.acacia_seed": "아카시아 나무 씨앗", - "item.dynamictrees.apple_oak_seed": "사과 씨앗", - "item.dynamictrees.dendro_potion.biochar": "바이오숯 포션", - "item.dynamictrees.dendro_potion.depletion": "고갈의 포션", - "item.dynamictrees.dendro_potion.burgeoning": "급성장의 포션", - "item.dynamictrees.dendro_potion.fertility": "풍요의 포션", - "item.dynamictrees.dendro_potion.persistence": "잔존의 포션", - "item.dynamictrees.dendro_potion.transform": "변화의 포션", - "item.dynamictrees.dirt_bucket": "흙 양동이", - "item.dynamictrees.staff": "자연의 지팡이" -} \ No newline at end of file diff --git a/src/generated/resources/assets/dynamictrees/lang/nl_nl.json b/src/generated/resources/assets/dynamictrees/lang/nl_nl.json deleted file mode 100755 index 6a0b2eec0..000000000 --- a/src/generated/resources/assets/dynamictrees/lang/nl_nl.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "itemGroup.dynamictrees": "Dynamic Trees", - "block.dynamictrees.oak_branch": "Eikenboom", - "block.dynamictrees.spruce_branch": "Sparreboom", - "block.dynamictrees.birch_branch": "Berkenboom", - "block.dynamictrees.jungle_branch": "Oerwoud Boom", - "block.dynamictrees.dark_oak_branch": "Donkere Eikenboom", - "block.dynamictrees.acacia_branch": "Acacia Boom", - "block.dynamictrees.crimson_branch": "Helrode Boom", - "block.dynamictrees.warped_branch": "Spookachtige Boom", - "species.dynamictrees.oak": "Eik", - "species.dynamictrees.swamp_oak": "Moeras Eik", - "species.dynamictrees.spruce": "Sparren", - "species.dynamictrees.mega_spruce": "Mega Sparren", - "species.dynamictrees.birch": "Berk", - "species.dynamictrees.tall_birch": "Hoge Berk", - "species.dynamictrees.jungle": "Oerwoud", - "species.dynamictrees.mega_jungle": "Mega Oerwoud", - "species.dynamictrees.dark_oak": "Donkere Eik", - "species.dynamictrees.acacia": "Acacia", - "species.dynamictrees.apple_oak": "Appel Eik", - "species.dynamictrees.crimson": "Helrood", - "species.dynamictrees.mega_crimson": "Mega Helrood", - "species.dynamictrees.warped": "Spookachtig", - "species.dynamictrees.mega_warped": "Mega Spookachtig", - "item.dynamictrees.oak_seed": "Eiken Eikel", - "item.dynamictrees.spruce_seed": "Sparren Kegel", - "item.dynamictrees.birch_seed": "Berken Katje", - "item.dynamictrees.jungle_seed": "Oerwoud Peul", - "item.dynamictrees.dark_oak_seed": "Donkere Eiken Eikel", - "item.dynamictrees.acacia_seed": "Acacia Zaad", - "item.dynamictrees.apple_oak_seed": "Appelpit", - "item.dynamictrees.crimson_seed": "Helrode Kap", - "item.dynamictrees.warped_seed": "Spookachtige Kap", - "item.dynamictrees.dendro_potion.biochar": "Biokool Basis Drank", - "item.dynamictrees.dendro_potion.depletion": "Drank van Uitputting", - "item.dynamictrees.dendro_potion.gigas": "Drank van Giganten", - "item.dynamictrees.dendro_potion.burgeoning": "Drank van Ontluiken", - "item.dynamictrees.dendro_potion.fertility": "Drank van Vruchtbaarheid", - "item.dynamictrees.dendro_potion.persistence": "Drank van Volharding", - "item.dynamictrees.dendro_potion.transform": "Drank van Transformatie", - "item.dynamictrees.dirt_bucket": "Aarden Emmer", - "item.dynamictrees.staff": "Bosland Staf", - "block.dynamictrees.potted_sapling": "Gepotte Jonge Boom", - "chat.registry_name": "Registreer Naam: %s", - "tooltip.dynamictrees.species": "Soort: %s", - "tooltip.dynamictrees.jo_code": "JoCode: %s", - "commands.dynamictrees.success.get_tree": "Soort: %s JoCode: %s", - "commands.dynamictrees.error.get_tree": "Kan niet de boom soort vinden op deze positie %s.", - "commands.dynamictrees.success.set_tree": "Succesvol de boom op de positie gezet %s to soort %s with JoCode %s.", - "commands.dynamictrees.success.kill_tree": "Succesvol de boom verwijderd op de positie %s.", - "commands.dynamictrees.error.unknown_species": "Onbekende Soort %s.", - "death.attack.falling_tree": "%1$s was verpletterd door een vallende boom" -} \ No newline at end of file diff --git a/src/generated/resources/assets/dynamictrees/lang/pl_pl.json b/src/generated/resources/assets/dynamictrees/lang/pl_pl.json deleted file mode 100755 index d76af7bdb..000000000 --- a/src/generated/resources/assets/dynamictrees/lang/pl_pl.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "itemGroup.dynamictrees": "Dynamic Trees", - "block.dynamictrees.oak_branch": "Dębowe", - "block.dynamictrees.spruce_branch": "Świerkowe", - "block.dynamictrees.birch_branch": "Brzozowe", - "block.dynamictrees.jungle_branch": "Dżunglowe", - "block.dynamictrees.dark_oak_branch": "Ciemnego Dębu", - "block.dynamictrees.acacia_branch": "Akacjowe", - "block.dynamictrees.crimson_branch": "Szkarłatny Trzon", - "block.dynamictrees.warped_branch": "Spaczony Trzon", - "species.dynamictrees.oak": "Dąb", - "species.dynamictrees.swamp_oak": "Dąb Bagienny", - "species.dynamictrees.spruce": "Świerk", - "species.dynamictrees.mega_spruce": "Wielki Świerk", - "species.dynamictrees.birch": "Brzoza", - "species.dynamictrees.tall_birch": "Wysoka Brzoza", - "species.dynamictrees.jungle": "Dżungla", - "species.dynamictrees.mega_jungle": "Wielka Dżungla", - "species.dynamictrees.dark_oak": "Ciemny Dąb", - "species.dynamictrees.acacia": "Akacja", - "species.dynamictrees.apple_oak": "Dąb Jabłkowy", - "species.dynamictrees.crimson": "Szkarłatny", - "species.dynamictrees.mega_crimson": "Wielki Szkarłatny", - "species.dynamictrees.warped": "Spaczony", - "species.dynamictrees.mega_warped": "Wielki Spaczony", - "item.dynamictrees.oak_seed": "Żołądź Dębowy", - "item.dynamictrees.spruce_seed": "Szyszka Świerkowa", - "item.dynamictrees.birch_seed": "Kotka Brzozowa", - "item.dynamictrees.jungle_seed": "Strąk Dżunglowy", - "item.dynamictrees.dark_oak_seed": "Żołądź Ciemnego Dębu", - "item.dynamictrees.acacia_seed": "Nasiono Akacji", - "item.dynamictrees.apple_oak_seed": "Jabłkowa Pestka", - "item.dynamictrees.crimson_seed": "Szkarłatny Kapelusz", - "item.dynamictrees.warped_seed": "Spaczony Kapelusz", - "item.dynamictrees.dendro_potion.biochar": "Mikstura Bazowa Biowęglowa", - "item.dynamictrees.dendro_potion.depletion": "Mikstura Uszczuplenia", - "item.dynamictrees.dendro_potion.gigas": "Mikstura Wielkości", - "item.dynamictrees.dendro_potion.burgeoning": "Mikstura Rozkwitu", - "item.dynamictrees.dendro_potion.fertility": "Mikstura Żyzności", - "item.dynamictrees.dendro_potion.persistence": "Mikstura Trwałości", - "item.dynamictrees.dendro_potion.transform": "Mikstura Transformacji", - "item.dynamictrees.dirt_bucket": "Wiaderko Ziemi", - "item.dynamictrees.staff": "Leśna Laska", - "chat.registry_name": "Nazwa Rejestru: %s", - "commands.dynamictrees.success.get_tree": "Nie można znaleźć gatunków drzew %s na pozycji %s.", - "commands.dynamictrees.success.set_tree": "Pomyślnie ustawiono drzewo na pozycji %s do gatunków %s z JoCode %s.", - "commands.dynamictrees.success.kill_tree": "Pomyślnie zabito drzewo na pozycji %s.", - "commands.dynamictrees.error.unknown_species": "Nieznany gatunek %s.", - "commands.dynamictrees.success.get_fertility": "Życie w glebie drzewa na pozycji %s jest %s.", - "commands.dynamictrees.success.set_fertility": "Pomyślnie ustawiono życie gleby drzewa na pozycji %s do %s.", - "commands.dynamictrees.success.grow_pulse": "Pomyślnie wysłane %s impulsy wzrostu na drzewo na pozycji %s.", - "commands.dynamictrees.success.set_xor": "Pomyślnie ustawiono współrzędne Xlub do %s.", - "commands.dynamictrees.success.rotate_jo_code": "Obrócony JoCode: %s", - "commands.dynamictrees.error.species_equal": "Gatunek docelowy jest taki sam, jak dany gatunek.", - "commands.dynamictrees.success.transform": "Gatunek pomyślnie przekształcony %s na pozycji %s do gatunku %s.", - "commands.dynamictrees.error.not_transformable": "Gatunek %s nie podlega transformacji.", - "commands.dynamictrees.success.create_staff": "Pomyślnie stworzono laskę z gatunku %s, kod %s, kolor %s, tylko do odczytu %s, i maksymalne zastosowania %s na pozycji %s.", - "commands.dynamictrees.success.create_transform_potion": "Pomyślnie stworzono miksturę transformacji dla gatunku %s na pozycji %s.", - "commands.dynamictrees.success.clear_orphaned": "Pomyślnie wyczyszczono %s samotne połączenia gałęzi.", - "commands.dynamictrees.success.purge_trees": "Pomyślnie wyczyszczono %s drzewa.", - "potion.biochar.description": "Bazowa drzewna mikstura do warzenia", - "potion.depletion.description": "Niszczy żyzność gleby drzew", - "potion.gigas.description": "Pozwala drzewu osiągnąć mega rozmiar", - "potion.burgeoning.description": "Szybko wyrasta drzewo", - "potion.fertility.description": "W pełni nawozi glebę drzewa", - "potion.persistence.description": "Powstrzymuje drzewo przed zmienianiem", - "potion.transform.description": "Przekształca drzewo w %s drzewo", - "potion.transform.description.empty": "Bazowa drzewna mikstura do transformacji warzenia", - "death.attack.falling_tree": "%1$s został zgnieciony przez spadające drzewo", - "block.dynamictrees.rooty_water": "Korzenie Wodne" -} \ No newline at end of file diff --git a/src/generated/resources/assets/dynamictrees/lang/ru_ru.json b/src/generated/resources/assets/dynamictrees/lang/ru_ru.json deleted file mode 100755 index 70d7cab5a..000000000 --- a/src/generated/resources/assets/dynamictrees/lang/ru_ru.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "itemGroup.dynamictrees": "Динамические деревья", - "block.dynamictrees.oak_branch": "Дуб", - "block.dynamictrees.spruce_branch": "Ель", - "block.dynamictrees.birch_branch": "Берёза", - "block.dynamictrees.jungle_branch": "Тропическое дерево", - "block.dynamictrees.dark_oak_branch": "Тёмный дуб", - "block.dynamictrees.acacia_branch": "Акация", - "block.dynamictrees.crimson_branch": "Багровое дерево", - "block.dynamictrees.warped_branch": "Искажённое дерево", - "species.dynamictrees.oak": "Дуб", - "species.dynamictrees.swamp_oak": "Болотный дуб", - "species.dynamictrees.spruce": "Ель", - "species.dynamictrees.mega_spruce": "Мега ель", - "species.dynamictrees.birch": "Берёза", - "species.dynamictrees.tall_birch": "Высокая береза", - "species.dynamictrees.jungle": "Тропическое", - "species.dynamictrees.mega_jungle": "Мега тропическое", - "species.dynamictrees.dark_oak": "Тёмный дуб", - "species.dynamictrees.acacia": "Акация", - "species.dynamictrees.apple_oak": "Яблоня", - "species.dynamictrees.crimson": "Багровый", - "species.dynamictrees.mega_crimson": "Мега багровый", - "species.dynamictrees.warped": "Искажённый", - "species.dynamictrees.mega_warped": "Мега искажённый", - "item.dynamictrees.oak_seed": "Жёлудь дуба", - "item.dynamictrees.spruce_seed": "Еловая шишка", - "item.dynamictrees.birch_seed": "Березовая сережка", - "item.dynamictrees.jungle_seed": "Джунглевый стручок", - "item.dynamictrees.dark_oak_seed": "Жёлудь тёмного дуба", - "item.dynamictrees.acacia_seed": "Семя акации", - "item.dynamictrees.apple_oak_seed": "Яблочное зёрнышко", - "item.dynamictrees.crimson_seed": "Багровая шляпка", - "item.dynamictrees.warped_seed": "Искажённая шляпка", - "item.dynamictrees.dendro_potion.biochar": "Основное зелье", - "item.dynamictrees.dendro_potion.depletion": "Зелье истощения", - "item.dynamictrees.dendro_potion.gigas": "Зелье Гигаса", - "item.dynamictrees.dendro_potion.burgeoning": "Зелье роста", - "item.dynamictrees.dendro_potion.fertility": "Зелье плодородия", - "item.dynamictrees.dendro_potion.persistence": "Зелье стойкости", - "item.dynamictrees.dendro_potion.transform": "Зелье трансформации", - "item.dynamictrees.dendro_potion.harvest": "Зелье урожая", - "item.dynamictrees.dendro_potion.denuding": "Зелье оголения", - "item.dynamictrees.dirt_bucket": "Ведро грязи", - "item.dynamictrees.staff": "Лесной посох", - "block.dynamictrees.potted_sapling": "Саженец в горшке", - "chat.registry_name": "Имя в реестре: %s", - "tooltip.dynamictrees.species": "Вид: %s", - "tooltip.dynamictrees.fertility": "Плодородие: %s", - "tooltip.dynamictrees.jo_code": "JoCode: %s", - "tooltip.dynamictrees.force_planting": "Принудительная посадка: %s", - "tooltip.dynamictrees.seed_life_span": "Продолжительность жизни семян: %s", - "tooltip.dynamictrees.enabled": "Включено", - "commands.dynamictrees.success.get_tree": "Виды: %s JoCode: %s", - "commands.dynamictrees.error.get_tree": "Не удалось найти вид дерева на позиции %s.", - "commands.dynamictrees.success.set_tree": "Дерево на позиции %s успешно установлено в вид %s с JoCode %s.", - "commands.dynamictrees.success.kill_tree": "Дерево на позиции %s успешно уничтожено.", - "commands.dynamictrees.error.unknown_species": "Неизвестный вид %s.", - "commands.dynamictrees.success.get_fertility": "Плодородие дерева на позиции %s сейчас %s.", - "commands.dynamictrees.success.set_fertility": "Плодородие дерева на позиции %s успешно установлено на %s.", - "commands.dynamictrees.success.grow_pulse": "Успешно отправлено %s импульсов роста к дереву на позиции %s.", - "commands.dynamictrees.success.set_xor": "Координаты Xor успешно поставлены на %s", - "commands.dynamictrees.success.rotate_jo_code": "Повёрнут JoCode: %s", - "commands.dynamictrees.error.species_equal": "Изначальный вид такой же, как и новый вид.", - "commands.dynamictrees.success.transform": "Успешно трансформированн вид %s на позиции %s на вид %s.", - "commands.dynamictrees.error.not_transformable": "Вид %s нельзя трансформировать.", - "commands.dynamictrees.success.create_staff": "Успешно создан персонал с разновидностями %s, кодом %s, цветом %s, чтением только %s, и максимальными использованиями %s на позиции %s.", - "commands.dynamictrees.success.create_transform_potion": "Успешно создано зелье трансформации для вида %s на позиции %s.", - "commands.dynamictrees.success.clear_orphaned": "Успешно очищено %s отделённых ответвлений.", - "commands.dynamictrees.success.purge_trees": "Успешно очищено от %s деревьев.", - "potion.biochar.description": "Базовое зелье для зельеварения", - "potion.depletion.description": "Убирает удобрение почвы дерева", - "potion.gigas.description": "Позволяет дереву стать мега-размера", - "potion.burgeoning.description": "Быстрее вырастит дерево", - "potion.fertility.description": "Полностью удобряет почву дерева", - "potion.persistence.description": "Прекращает изменение дерева", - "potion.transform.description": "Трансформирует дерево в §a%s §7дерево", - "potion.transform.description.empty": "Базовое зелье для зелий трансформации", - "potion.harvest.description": "Ускоряет рост фруктов", - "potion.denuding.description": "Удаляет всю кору и листья с дерева", - "death.attack.falling_tree": "%1$s раздавлен(а) падающим деревом", - "block.dynamictrees.rooty_water": "Водные корни", - "species.dynamictrees.red_mushroom": "Red Mushroom", - "species.dynamictrees.brown_mushroom": "Brown Mushroom" -} \ No newline at end of file diff --git a/src/generated/resources/assets/dynamictrees/lang/sv_se.json b/src/generated/resources/assets/dynamictrees/lang/sv_se.json deleted file mode 100755 index 8f26637ad..000000000 --- a/src/generated/resources/assets/dynamictrees/lang/sv_se.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "itemGroup.dynamictrees": "Dynamic Trees", - "block.dynamictrees.oak_branch": "Ekträd", - "block.dynamictrees.spruce_branch": "Granträd", - "block.dynamictrees.birch_branch": "Björkträd", - "block.dynamictrees.jungle_branch": "Djungelträd", - "block.dynamictrees.dark_oak_branch": "Mörkt ekträd", - "block.dynamictrees.acacia_branch": "Akaciaträd", - "item.dynamictrees.oak_seed": "Ekollon", - "item.dynamictrees.spruce_seed": "Grankotte", - "item.dynamictrees.birch_seed": "Björkhänge", - "item.dynamictrees.jungle_seed": "Djungelkapsel", - "item.dynamictrees.dark_oak_seed": "Mörkt ekollon", - "item.dynamictrees.acacia_seed": "Akaciafrö", - "item.dynamictrees.apple_oak_seed": "Äppelkärna", - "item.dynamictrees.dendro_potion.biochar": "Biokolsbrygdbas", - "item.dynamictrees.dendro_potion.depletion": "Exploateringsbrygd", - "item.dynamictrees.dendro_potion.burgeoning": "Snabbväxtlighetsbrygd", - "item.dynamictrees.dendro_potion.fertility": "Fertilitetsbrygd", - "item.dynamictrees.dendro_potion.persistence": "Beständighetsbrygd", - "item.dynamictrees.dendro_potion.transform": "Omvandlingsbrygd", - "item.dynamictrees.dirt_bucket": "Jordhink", - "item.dynamictrees.staff": "Skogsstav", - "death.attack.falling_tree": "%1$s krossades av ett fallande träd" -} \ No newline at end of file diff --git a/src/generated/resources/assets/dynamictrees/lang/uk_ua.json b/src/generated/resources/assets/dynamictrees/lang/uk_ua.json deleted file mode 100755 index 9f484007e..000000000 --- a/src/generated/resources/assets/dynamictrees/lang/uk_ua.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "itemGroup.dynamictrees": "Динамічні дерева", - "block.dynamictrees.oak_branch": "Дуб", - "block.dynamictrees.spruce_branch": "Смерека", - "block.dynamictrees.birch_branch": "Береза", - "block.dynamictrees.jungle_branch": "Тропічне дерево", - "block.dynamictrees.dark_oak_branch": "Темний дуб", - "block.dynamictrees.acacia_branch": "Акація", - "species.dynamictrees.oak": "Дуб", - "species.dynamictrees.swamp_oak": "Болотний дуб", - "species.dynamictrees.spruce": "Ялина", - "species.dynamictrees.mega_spruce": "Мега ялина", - "species.dynamictrees.birch": "Береза", - "species.dynamictrees.jungle": "Тропічне", - "species.dynamictrees.mega_jungle": "Мега тропічне", - "species.dynamictrees.dark_oak": "Темный дуб", - "species.dynamictrees.acacia": "Акація", - "species.dynamictrees.apple_oak": "Яблуня", - "item.dynamictrees.oak_seed": "Жолудь дуба", - "item.dynamictrees.spruce_seed": "Шишка смереки", - "item.dynamictrees.birch_seed": "Березовий котик", - "item.dynamictrees.jungle_seed": "Стручок джунглів", - "item.dynamictrees.dark_oak_seed": "Жолудь темного дуба", - "item.dynamictrees.acacia_seed": "Насіння акації", - "item.dynamictrees.apple_oak_seed": "Яблучне зернятко", - "item.dynamictrees.dendro_potion.biochar": "Основне зілля", - "item.dynamictrees.dendro_potion.depletion": "Зілля виснаження", - "item.dynamictrees.dendro_potion.burgeoning": "Зілля росту", - "item.dynamictrees.dendro_potion.fertility": "Зілля родючості", - "item.dynamictrees.dendro_potion.persistence": "Зілля стійкості", - "item.dynamictrees.dendro_potion.transform": "Зілля перетворення", - "item.dynamictrees.dirt_bucket": "Відро бруду", - "item.dynamictrees.staff": "Лісовий посох", - "commands.dynamictrees.error.not_transformable": "Вид %s не може бути трансформований", - "potion.biochar.description": "Базове зілля для зіллєваріння", - "potion.depletion.description": "Прибирає удобрення ґрунту дерева", - "potion.gigas.description": "Дозволяє дереву стати мега-розміру", - "potion.burgeoning.description": "Швидше виростить дерево", - "potion.fertility.description": "Повністю удобрює ґрунт дерева", - "potion.persistence.description": "Припиняє зміну дерева", - "potion.transform.description": "Трансформує дерево у §a%s §7дерево", - "potion.transform.description.empty": "Базове зілля для зіль трансформації", - "death.attack.falling_tree": "%1$s розтрощений(на) падаючим деревом" -} \ No newline at end of file diff --git a/src/generated/resources/assets/dynamictrees/lang/zh_cn.json b/src/generated/resources/assets/dynamictrees/lang/zh_cn.json deleted file mode 100755 index 26a816330..000000000 --- a/src/generated/resources/assets/dynamictrees/lang/zh_cn.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "itemGroup.dynamictrees": "有活力的树", - "block.dynamictrees.oak_branch": "橡木", - "block.dynamictrees.spruce_branch": "云杉木", - "block.dynamictrees.birch_branch": "白桦木", - "block.dynamictrees.jungle_branch": "丛林木", - "block.dynamictrees.dark_oak_branch": "深色橡木", - "block.dynamictrees.acacia_branch": "金合欢木", - "item.dynamictrees.oak_seed": "橡子", - "item.dynamictrees.spruce_seed": "云杉球果", - "item.dynamictrees.birch_seed": "白桦絮", - "item.dynamictrees.jungle_seed": "丛林木荚", - "item.dynamictrees.dark_oak_seed": "深色橡子", - "item.dynamictrees.acacia_seed": "金合欢种子", - "item.dynamictrees.apple_oak_seed": "苹果仁", - "item.dynamictrees.dendro_potion.biochar": "木炭溶液", - "item.dynamictrees.dendro_potion.depletion": "枯竭药水", - "item.dynamictrees.dendro_potion.burgeoning": "生长药水", - "item.dynamictrees.dendro_potion.fertility": "肥沃药水", - "item.dynamictrees.dendro_potion.persistence": "定型药水", - "item.dynamictrees.dendro_potion.transform": "转生药水", - "item.dynamictrees.dirt_bucket": "泥桶", - "item.dynamictrees.staff": "森林之杖" -} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/acacia_leaves.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/acacia_leaves.json index 12cb7e7d1..782e6bd24 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/blocks/acacia_leaves.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/blocks/acacia_leaves.json @@ -38,7 +38,7 @@ "name": "minecraft:acacia_leaves" }, { - "type": "minecraft:item", + "type": "dynamictrees:seed_item", "conditions": [ { "condition": "minecraft:survives_explosion" @@ -56,8 +56,7 @@ { "condition": "dynamictrees:seasonal_seed_drop_chance" } - ], - "name": "dynamictrees:acacia_seed" + ] } ] } diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/apple_oak_leaves.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/apple_oak_leaves.json deleted file mode 100644 index 5caae3945..000000000 --- a/src/generated/resources/data/dynamictrees/loot_tables/blocks/apple_oak_leaves.json +++ /dev/null @@ -1,131 +0,0 @@ -{ - "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": "minecraft:oak_leaves" - }, - { - "type": "minecraft:item", - "conditions": [ - { - "condition": "minecraft:survives_explosion" - }, - { - "condition": "minecraft:table_bonus", - "enchantment": "minecraft:fortune", - "chances": [ - 0.05, - 0.0625, - 0.083333336, - 0.1 - ] - }, - { - "condition": "dynamictrees:seasonal_seed_drop_chance" - } - ], - "name": "dynamictrees:apple_oak_seed" - } - ] - } - ] - }, - { - "rolls": 1, - "entries": [ - { - "type": "minecraft:item", - "conditions": [ - { - "condition": "minecraft:table_bonus", - "enchantment": "minecraft:fortune", - "chances": [ - 0.02, - 0.022222223, - 0.025, - 0.033333335, - 0.1 - ] - } - ], - "functions": [ - { - "function": "minecraft:set_count", - "count": { - "min": 1.0, - "max": 2.0, - "type": "minecraft:uniform" - } - }, - { - "function": "minecraft:explosion_decay" - } - ], - "name": "minecraft:stick" - } - ], - "conditions": [ - { - "condition": "minecraft:inverted", - "term": { - "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 - } - } - ] - } - } - ] - } - } - ] - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/birch_leaves.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/birch_leaves.json index a423985a8..84217c7f5 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/blocks/birch_leaves.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/blocks/birch_leaves.json @@ -38,7 +38,7 @@ "name": "minecraft:birch_leaves" }, { - "type": "minecraft:item", + "type": "dynamictrees:seed_item", "conditions": [ { "condition": "minecraft:survives_explosion" @@ -56,8 +56,7 @@ { "condition": "dynamictrees:seasonal_seed_drop_chance" } - ], - "name": "dynamictrees:birch_seed" + ] } ] } diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/dark_oak_leaves.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/dark_oak_leaves.json index 070d62df4..a93bdf30b 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/blocks/dark_oak_leaves.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/blocks/dark_oak_leaves.json @@ -38,7 +38,7 @@ "name": "minecraft:dark_oak_leaves" }, { - "type": "minecraft:item", + "type": "dynamictrees:seed_item", "conditions": [ { "condition": "minecraft:survives_explosion" @@ -56,8 +56,7 @@ { "condition": "dynamictrees:seasonal_seed_drop_chance" } - ], - "name": "dynamictrees:dark_oak_seed" + ] } ] } diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/jungle_leaves.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/jungle_leaves.json index 1bfdc8132..6520d9e2e 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/blocks/jungle_leaves.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/blocks/jungle_leaves.json @@ -38,7 +38,7 @@ "name": "minecraft:jungle_leaves" }, { - "type": "minecraft:item", + "type": "dynamictrees:seed_item", "conditions": [ { "condition": "minecraft:survives_explosion" @@ -57,8 +57,7 @@ { "condition": "dynamictrees:seasonal_seed_drop_chance" } - ], - "name": "dynamictrees:jungle_seed" + ] } ] } diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/mega_crimson_wart.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/mega_crimson_wart.json deleted file mode 100644 index 2a09e336b..000000000 --- a/src/generated/resources/data/dynamictrees/loot_tables/blocks/mega_crimson_wart.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "pools": [ - { - "rolls": 1, - "entries": [ - { - "type": "minecraft:item", - "name": "minecraft:nether_wart_block" - } - ], - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ] - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/mega_warped_wart.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/mega_warped_wart.json deleted file mode 100644 index 01e80b4cb..000000000 --- a/src/generated/resources/data/dynamictrees/loot_tables/blocks/mega_warped_wart.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "pools": [ - { - "rolls": 1, - "entries": [ - { - "type": "minecraft:item", - "name": "minecraft:warped_wart_block" - } - ], - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ] - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/oak_leaves.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/oak_leaves.json index 10c0284bf..ceb4ff104 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/blocks/oak_leaves.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/blocks/oak_leaves.json @@ -38,7 +38,7 @@ "name": "minecraft:oak_leaves" }, { - "type": "minecraft:item", + "type": "dynamictrees:seed_item", "conditions": [ { "condition": "minecraft:survives_explosion" @@ -56,8 +56,7 @@ { "condition": "dynamictrees:seasonal_seed_drop_chance" } - ], - "name": "dynamictrees:oak_seed" + ] } ] } diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/spruce_leaves.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/spruce_leaves.json index f3954c87e..9281aa8cc 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/blocks/spruce_leaves.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/blocks/spruce_leaves.json @@ -38,7 +38,7 @@ "name": "minecraft:spruce_leaves" }, { - "type": "minecraft:item", + "type": "dynamictrees:seed_item", "conditions": [ { "condition": "minecraft:survives_explosion" @@ -56,8 +56,7 @@ { "condition": "dynamictrees:seasonal_seed_drop_chance" } - ], - "name": "dynamictrees:spruce_seed" + ] } ] } diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/acacia.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/acacia.json index 994217542..167e03fc7 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/acacia.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/acacia.json @@ -5,7 +5,7 @@ "rolls": 1, "entries": [ { - "type": "minecraft:item", + "type": "dynamictrees:seed_item", "conditions": [ { "condition": "minecraft:survives_explosion" @@ -23,8 +23,7 @@ { "condition": "dynamictrees:seasonal_seed_drop_chance" } - ], - "name": "dynamictrees:acacia_seed" + ] } ] }, diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/apple_oak.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/apple_oak.json deleted file mode 100644 index 55d53a5e5..000000000 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/apple_oak.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "type": "dynamictrees:leaves", - "pools": [ - { - "rolls": 1, - "entries": [ - { - "type": "minecraft:item", - "conditions": [ - { - "condition": "minecraft:survives_explosion" - }, - { - "condition": "minecraft:table_bonus", - "enchantment": "minecraft:fortune", - "chances": [ - 0.05, - 0.0625, - 0.083333336, - 0.1 - ] - }, - { - "condition": "dynamictrees:seasonal_seed_drop_chance" - } - ], - "name": "dynamictrees:apple_oak_seed" - } - ] - }, - { - "rolls": 1, - "entries": [ - { - "type": "minecraft:item", - "conditions": [ - { - "condition": "minecraft:table_bonus", - "enchantment": "minecraft:fortune", - "chances": [ - 0.02, - 0.022222223, - 0.025, - 0.033333335, - 0.1 - ] - } - ], - "functions": [ - { - "function": "minecraft:set_count", - "count": { - "min": 1.0, - "max": 2.0, - "type": "minecraft:uniform" - } - }, - { - "function": "minecraft:explosion_decay" - } - ], - "name": "minecraft:stick" - } - ] - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/birch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/birch.json index b1aa8cb36..167e03fc7 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/birch.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/birch.json @@ -5,7 +5,7 @@ "rolls": 1, "entries": [ { - "type": "minecraft:item", + "type": "dynamictrees:seed_item", "conditions": [ { "condition": "minecraft:survives_explosion" @@ -23,8 +23,7 @@ { "condition": "dynamictrees:seasonal_seed_drop_chance" } - ], - "name": "dynamictrees:birch_seed" + ] } ] }, diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/dark_oak.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/dark_oak.json index dff3bdbdd..167e03fc7 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/dark_oak.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/dark_oak.json @@ -5,7 +5,7 @@ "rolls": 1, "entries": [ { - "type": "minecraft:item", + "type": "dynamictrees:seed_item", "conditions": [ { "condition": "minecraft:survives_explosion" @@ -23,8 +23,7 @@ { "condition": "dynamictrees:seasonal_seed_drop_chance" } - ], - "name": "dynamictrees:dark_oak_seed" + ] } ] }, diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/jungle.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/jungle.json index ccff3811c..cea20b1be 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/jungle.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/jungle.json @@ -5,7 +5,7 @@ "rolls": 1, "entries": [ { - "type": "minecraft:item", + "type": "dynamictrees:seed_item", "conditions": [ { "condition": "minecraft:survives_explosion" @@ -24,8 +24,7 @@ { "condition": "dynamictrees:seasonal_seed_drop_chance" } - ], - "name": "dynamictrees:jungle_seed" + ] } ] }, diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/mega_crimson.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/mega_crimson.json deleted file mode 100644 index 6292edd9a..000000000 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/mega_crimson.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "pools": [ - { - "rolls": 1, - "entries": [ - { - "type": "minecraft:item", - "name": "minecraft:nether_wart_block" - } - ], - "conditions": [ - { - "condition": "minecraft:survives_explosion" - }, - { - "condition": "minecraft:table_bonus", - "enchantment": "minecraft:fortune", - "chances": [ - 0.1, - 0.1333333, - 0.1666666, - 0.2 - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/mega_warped.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/mega_warped.json deleted file mode 100644 index 3ac4f452e..000000000 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/mega_warped.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "pools": [ - { - "rolls": 1, - "entries": [ - { - "type": "minecraft:item", - "name": "minecraft:warped_wart_block" - } - ], - "conditions": [ - { - "condition": "minecraft:survives_explosion" - }, - { - "condition": "minecraft:table_bonus", - "enchantment": "minecraft:fortune", - "chances": [ - 0.1, - 0.1333333, - 0.1666666, - 0.2 - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/oak.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/oak.json index 8cca306f9..167e03fc7 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/oak.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/oak.json @@ -5,7 +5,7 @@ "rolls": 1, "entries": [ { - "type": "minecraft:item", + "type": "dynamictrees:seed_item", "conditions": [ { "condition": "minecraft:survives_explosion" @@ -23,8 +23,7 @@ { "condition": "dynamictrees:seasonal_seed_drop_chance" } - ], - "name": "dynamictrees:oak_seed" + ] } ] }, diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/spruce.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/spruce.json index 042f90f57..167e03fc7 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/spruce.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/spruce.json @@ -5,7 +5,7 @@ "rolls": 1, "entries": [ { - "type": "minecraft:item", + "type": "dynamictrees:seed_item", "conditions": [ { "condition": "minecraft:survives_explosion" @@ -23,8 +23,7 @@ { "condition": "dynamictrees:seasonal_seed_drop_chance" } - ], - "name": "dynamictrees:spruce_seed" + ] } ] }, diff --git a/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BranchBlock.java b/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BranchBlock.java index 2ce4e7bbc..fd6bce37f 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BranchBlock.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BranchBlock.java @@ -7,6 +7,7 @@ import com.ferreusveritas.dynamictrees.api.treedata.TreePart; import com.ferreusveritas.dynamictrees.blocks.BlockWithDynamicHardness; import com.ferreusveritas.dynamictrees.blocks.leaves.DynamicLeavesBlock; +import com.ferreusveritas.dynamictrees.blocks.leaves.LeavesProperties; import com.ferreusveritas.dynamictrees.data.provider.DTLootTableProvider; import com.ferreusveritas.dynamictrees.entities.FallingTreeEntity; import com.ferreusveritas.dynamictrees.entities.FallingTreeEntity.DestroyType; @@ -466,14 +467,17 @@ public void destroyLeaves(final World world, final BlockPos cutPos, final Specie // Destroy all family compatible leaves. for (final Cell cell : leafMap.getAllNonZeroCells()) { final BlockPos.Mutable pos = cell.getPos(); - final BlockState blockState = world.getBlockState(pos); - if (family.isCompatibleGenericLeaves(species, blockState, world, pos)) { + final BlockState state = world.getBlockState(pos); + if (family.isCompatibleGenericLeaves(species, state, world, pos)) { dropList.clear(); - dropList.addAll(species.getLeavesDrops(world, pos, tool)); + LeavesProperties leaves = TreeHelper.getLeavesOpt(state) + .map(block -> block.getProperties(state)) + .orElse(LeavesProperties.NULL); + dropList.addAll(leaves.getDrops(world, pos, tool, species)); final BlockPos imPos = pos.immutable(); // We are storing this so it must be immutable final BlockPos relPos = imPos.subtract(cutPos); world.setBlock(imPos, BlockStates.AIR, 3); - destroyedLeaves.put(relPos, blockState); + destroyedLeaves.put(relPos, state); dropList.forEach(i -> drops.add(new ItemStackPos(i, relPos))); } } diff --git a/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/DynamicLeavesBlock.java b/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/DynamicLeavesBlock.java index ed30aad6f..7005672d0 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/DynamicLeavesBlock.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/DynamicLeavesBlock.java @@ -11,7 +11,6 @@ import com.ferreusveritas.dynamictrees.init.DTClient; import com.ferreusveritas.dynamictrees.init.DTConfigs; import com.ferreusveritas.dynamictrees.items.Seed; -import com.ferreusveritas.dynamictrees.loot.DTLootParameterSets; import com.ferreusveritas.dynamictrees.loot.DTLootParameters; import com.ferreusveritas.dynamictrees.systems.GrowSignal; import com.ferreusveritas.dynamictrees.trees.Family; @@ -70,7 +69,7 @@ @SuppressWarnings("deprecation") public class DynamicLeavesBlock extends LeavesBlock implements TreePart, Ageable, RayTraceCollision { - public LeavesProperties properties = LeavesProperties.NULL_PROPERTIES; + public LeavesProperties properties = LeavesProperties.NULL; public DynamicLeavesBlock(final LeavesProperties leavesProperties, final Properties properties) { this(properties); @@ -623,8 +622,9 @@ public List getDrops(BlockState state, LootContext.Builder builder) { lootTableName = getLootTable(); } else { pos = new BlockPos(originPos.x(), originPos.y(), originPos.z()); - species = getExactSpecies(builder.getLevel(), pos, getProperties(state)); - lootTableName = species.getLeavesBlockDropsPath(); + LeavesProperties leavesProperties = getProperties(state); + lootTableName = leavesProperties.getBlockDropsPath(); + species = getExactSpecies(builder.getLevel(), pos, leavesProperties); } if (lootTableName == LootTables.EMPTY) { @@ -633,6 +633,7 @@ public List getDrops(BlockState state, LootContext.Builder builder) { ServerWorld world = builder.getLevel(); LootContext context = builder .withParameter(LootParameters.BLOCK_STATE, state) + .withParameter(DTLootParameters.SPECIES, species) .withParameter(DTLootParameters.SEASONAL_SEED_DROP_FACTOR, species.seasonalSeedDropFactor(WorldContext.create(world), pos)) .create(LootParameterSets.BLOCK); diff --git a/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/LeavesProperties.java b/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/LeavesProperties.java index 883f22b11..db6850a7b 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/LeavesProperties.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/LeavesProperties.java @@ -11,16 +11,28 @@ import com.ferreusveritas.dynamictrees.client.BlockColorMultipliers; import com.ferreusveritas.dynamictrees.data.DTBlockTags; import com.ferreusveritas.dynamictrees.data.provider.DTBlockStateProvider; +import com.ferreusveritas.dynamictrees.data.provider.DTLootTableProvider; import com.ferreusveritas.dynamictrees.init.DTTrees; import com.ferreusveritas.dynamictrees.loot.DTLootParameterSets; +import com.ferreusveritas.dynamictrees.loot.DTLootParameters; import com.ferreusveritas.dynamictrees.resources.Resources; import com.ferreusveritas.dynamictrees.trees.Family; import com.ferreusveritas.dynamictrees.trees.Resettable; import com.ferreusveritas.dynamictrees.trees.Species; -import com.ferreusveritas.dynamictrees.util.*; +import com.ferreusveritas.dynamictrees.util.BlockStates; +import com.ferreusveritas.dynamictrees.util.LazyValue; +import com.ferreusveritas.dynamictrees.util.MutableLazyValue; +import com.ferreusveritas.dynamictrees.util.Optionals; +import com.ferreusveritas.dynamictrees.util.ResourceLocationUtils; +import com.ferreusveritas.dynamictrees.util.ToolTypes; +import com.ferreusveritas.dynamictrees.util.WorldContext; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.block.*; +import net.minecraft.block.AbstractBlock; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.material.MaterialColor; import net.minecraft.client.Minecraft; @@ -30,7 +42,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.ShearsItem; import net.minecraft.loot.LootContext; +import net.minecraft.loot.LootParameterSets; import net.minecraft.loot.LootParameters; +import net.minecraft.loot.LootTable; import net.minecraft.tags.ITag; import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; @@ -48,7 +62,9 @@ import javax.annotation.Nullable; import java.awt.*; +import java.util.Collection; import java.util.Collections; +import java.util.Iterator; import java.util.List; import java.util.Optional; import java.util.Random; @@ -65,7 +81,7 @@ public class LeavesProperties extends RegistryEntry implements .group(ResourceLocation.CODEC.fieldOf(Resources.RESOURCE_LOCATION.toString()).forGetter(LeavesProperties::getRegistryName)) .apply(instance, LeavesProperties::new)); - public static final LeavesProperties NULL_PROPERTIES = new LeavesProperties() { + public static final LeavesProperties NULL = new LeavesProperties() { @Override public LeavesProperties setFamily(Family family) { return this; @@ -135,7 +151,7 @@ public boolean updateTick(World worldIn, BlockPos pos, BlockState state, Random /** * Central registry for all {@link LeavesProperties} objects. */ - public static final TypedRegistry REGISTRY = new TypedRegistry<>(LeavesProperties.class, NULL_PROPERTIES, new TypedRegistry.EntryType<>(CODEC)); + public static final TypedRegistry REGISTRY = new TypedRegistry<>(LeavesProperties.class, NULL, new TypedRegistry.EntryType<>(CODEC)); protected static final int maxHydro = 7; @@ -199,6 +215,9 @@ public BlockState getPrimitiveLeaves() { } public Optional getPrimitiveLeavesBlock() { + if (this.primitiveLeaves == null) { + return Optional.empty(); + } return Optionals.ofBlock(this.primitiveLeaves.getBlock()); } @@ -462,6 +481,77 @@ public AbstractBlock.Properties getDefaultBlockProperties(final Material materia .isViewBlocking((s, r, p) -> false); } + /////////////////////////////////////////// + // LOOT + /////////////////////////////////////////// + + /** + * Chances for leaves to drop seeds. Used in data gen for loot tables. + */ + private float[] seedDropChances = new float[]{0.05F, 0.0625F, 0.083333336F, 0.1F}; + + public void setSeedDropChances(float[] seedDropChances) { + this.seedDropChances = (float[]) seedDropChances; + } + + public void setSeedDropChances(Collection seedDropChances) { + this.seedDropChances = new float[seedDropChances.size()]; + Iterator iterator = seedDropChances.iterator(); + for (int i = 0; i < seedDropChances.size(); i++) { + this.seedDropChances[i] = iterator.next(); + } + } + + private final LazyValue blockDropsPath = LazyValue.supplied(() -> + ResourceLocationUtils.prefix(blockRegistryName, "blocks/")); + + public ResourceLocation getBlockDropsPath() { + return blockDropsPath.get(); + } + + public boolean shouldGenerateBlockDrops() { + return shouldGenerateDrops(); + } + + public LootTable.Builder createBlockDrops() { + if (primitiveLeaves != null && getPrimitiveLeavesBlock().isPresent()) { + return DTLootTableProvider.createLeavesBlockDrops(primitiveLeaves.getBlock(), seedDropChances); + } + return DTLootTableProvider.createLeavesDrops(seedDropChances, LootParameterSets.BLOCK); + } + + private final LazyValue dropsPath = LazyValue.supplied(() -> + ResourceLocationUtils.prefix(getRegistryName(), "trees/leaves/")); + + public ResourceLocation getDropsPath() { + return dropsPath.get(); + } + + public boolean shouldGenerateDrops() { + return getPrimitiveLeavesBlock().isPresent(); + } + + public LootTable.Builder createDrops() { + return DTLootTableProvider.createLeavesDrops(seedDropChances, DTLootParameterSets.LEAVES); + } + + public List getDrops(World world, BlockPos pos, ItemStack tool, Species species) { + if (world.isClientSide) { + return Collections.emptyList(); + } + return world.getServer().getLootTables().get(getDropsPath()) + .getRandomItems(createLootContext(world, pos, tool, species)); + } + + private LootContext createLootContext(World world, BlockPos pos, ItemStack tool, Species species) { + return new LootContext.Builder(WorldContext.getServerWorldOrThrow(world)) + .withParameter(LootParameters.BLOCK_STATE, world.getBlockState(pos)) + .withParameter(DTLootParameters.SPECIES, species) + .withParameter(DTLootParameters.SEASONAL_SEED_DROP_FACTOR, species.seasonalSeedDropFactor(WorldContext.create(world), pos)) + .withParameter(LootParameters.TOOL, tool) + .create(DTLootParameterSets.LEAVES); + } + /////////////////////////////////////////// // INTERACTION /////////////////////////////////////////// diff --git a/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/WartProperties.java b/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/WartProperties.java index 16cc0b503..831d63e08 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/WartProperties.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/WartProperties.java @@ -2,11 +2,13 @@ import com.ferreusveritas.dynamictrees.api.registry.TypedRegistry; import com.ferreusveritas.dynamictrees.data.DTBlockTags; +import com.ferreusveritas.dynamictrees.data.provider.DTLootTableProvider; import net.minecraft.block.AbstractBlock; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.material.MaterialColor; +import net.minecraft.loot.LootTable; import net.minecraft.tags.ITag; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.ToolType; @@ -45,4 +47,14 @@ public List> defaultLeavesTags() { return Collections.singletonList(DTBlockTags.WART_BLOCKS); } + @Override + public LootTable.Builder createBlockDrops() { + return DTLootTableProvider.createWartBlockDrops(primitiveLeaves.getBlock()); + } + + @Override + public LootTable.Builder createDrops() { + return DTLootTableProvider.createWartDrops(primitiveLeaves.getBlock()); + } + } diff --git a/src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java b/src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java index 21b1315d3..ad4dc1024 100644 --- a/src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java @@ -1,9 +1,11 @@ package com.ferreusveritas.dynamictrees.data.provider; import com.ferreusveritas.dynamictrees.blocks.branches.BranchBlock; +import com.ferreusveritas.dynamictrees.blocks.leaves.LeavesProperties; import com.ferreusveritas.dynamictrees.loot.DTLootParameterSets; import com.ferreusveritas.dynamictrees.loot.condition.SeasonalSeedDropChance; import com.ferreusveritas.dynamictrees.loot.condition.VoluntarySeedDropChance; +import com.ferreusveritas.dynamictrees.loot.entry.SeedItemLootEntry; import com.ferreusveritas.dynamictrees.loot.function.MultiplyLogsCount; import com.ferreusveritas.dynamictrees.loot.function.MultiplySticksCount; import com.ferreusveritas.dynamictrees.trees.Species; @@ -87,65 +89,65 @@ private void addTables() { if (!species.getRegistryName().getNamespace().equals(modId)) { return; } - if (species.shouldGenerateLeavesBlockDrops()) { - final ResourceLocation leavesBlockTablePath = getFullDropsPath(species.getLeavesBlockDropsPath()); - if (!existingFileHelper.exists(leavesBlockTablePath, ResourcePackType.SERVER_DATA)) { - lootTables.put(leavesBlockTablePath, species.createLeavesBlockDrops()); - } - } - if (species.shouldGenerateLeavesDrops()) { - final ResourceLocation leavesTablePath = getFullDropsPath(species.getLeavesDropsPath()); - if (!existingFileHelper.exists(leavesTablePath, ResourcePackType.SERVER_DATA)) { - lootTables.put(leavesTablePath, species.createLeavesDrops()); - } - } - if (species.shouldGenerateVoluntaryDrops()) { - final ResourceLocation leavesTablePath = getFullDropsPath(species.getVoluntaryDropsPath()); - if (!existingFileHelper.exists(leavesTablePath, ResourcePackType.SERVER_DATA)) { - lootTables.put(leavesTablePath, species.createVoluntaryDrops()); - } - } + addVoluntaryTable(species); }); + ForgeRegistries.BLOCKS.getValues().stream() .filter(block -> block instanceof BranchBlock) .map(block -> (BranchBlock) block) .filter(block -> block.getRegistryName().getNamespace().equals(modId)) - .forEach(branchBlock -> { - if (branchBlock.shouldGenerateBranchDrops()) { - final ResourceLocation branchTablePath = getFullDropsPath(branchBlock.getLootTableName()); - if (!existingFileHelper.exists(branchTablePath, ResourcePackType.SERVER_DATA)) { - lootTables.put(branchTablePath, branchBlock.createBranchDrops()); - } - } - }); + .forEach(this::addBranchTable); + + LeavesProperties.REGISTRY.forEach(leavesProperties -> { + addLeavesBlockTable(leavesProperties); + addLeavesTable(leavesProperties); + }); } - private ResourceLocation getFullDropsPath(ResourceLocation path) { - return ResourceLocationUtils.surround(path, "loot_tables/", ".json"); + private void addVoluntaryTable(Species species) { + if (species.shouldGenerateVoluntaryDrops()) { + final ResourceLocation leavesTablePath = getFullDropsPath(species.getVoluntaryDropsPath()); + if (!existingFileHelper.exists(leavesTablePath, ResourcePackType.SERVER_DATA)) { + lootTables.put(leavesTablePath, species.createVoluntaryDrops()); + } + } } - public static LootTable.Builder createLeavesBlockDrops(Block primitiveLeavesBlock) { - return LootTable.lootTable().withPool( - LootPool.lootPool().setRolls(ConstantRange.exactly(1)) - .add(ItemLootEntry.lootTableItem(primitiveLeavesBlock).when(HAS_SHEARS_OR_SILK_TOUCH)) - ).withPool( - LootPool.lootPool().setRolls(ConstantRange.exactly(1)).when(HAS_NO_SHEARS_OR_SILK_TOUCH).add( - ItemLootEntry.lootTableItem(Items.STICK) - .apply(SetCount.setCount(RandomValueRange.between(1.0F, 2.0F))) - .apply(ExplosionDecay.explosionDecay()) - .when(TableBonus.bonusLevelFlatChance( - Enchantments.BLOCK_FORTUNE, 0.02F, 0.022222223F, 0.025F, 0.033333335F, - 0.1F - )) - ) - ).setParamSet(LootParameterSets.BLOCK); + private void addBranchTable(BranchBlock branchBlock) { + if (branchBlock.shouldGenerateBranchDrops()) { + final ResourceLocation branchTablePath = getFullDropsPath(branchBlock.getLootTableName()); + if (!existingFileHelper.exists(branchTablePath, ResourcePackType.SERVER_DATA)) { + lootTables.put(branchTablePath, branchBlock.createBranchDrops()); + } + } + } + + private void addLeavesBlockTable(LeavesProperties leavesProperties) { + if (leavesProperties.shouldGenerateBlockDrops()) { + final ResourceLocation leavesBlockTablePath = getFullDropsPath(leavesProperties.getBlockDropsPath()); + if (!existingFileHelper.exists(leavesBlockTablePath, ResourcePackType.SERVER_DATA)) { + lootTables.put(leavesBlockTablePath, leavesProperties.createBlockDrops()); + } + } + } + + private void addLeavesTable(LeavesProperties leavesProperties) { + if (leavesProperties.shouldGenerateDrops()) { + final ResourceLocation leavesTablePath = getFullDropsPath(leavesProperties.getDropsPath()); + if (!existingFileHelper.exists(leavesTablePath, ResourcePackType.SERVER_DATA)) { + lootTables.put(leavesTablePath, leavesProperties.createDrops()); + } + } } - public static LootTable.Builder createLeavesBlockDrops(Block primitiveLeavesBlock, Item seedItem, - float[] seedChances) { + private ResourceLocation getFullDropsPath(ResourceLocation path) { + return ResourceLocationUtils.surround(path, "loot_tables/", ".json"); + } + + public static LootTable.Builder createLeavesBlockDrops(Block primitiveLeavesBlock, float[] seedChances) { return BlockLootTables.createSilkTouchOrShearsDispatchTable( primitiveLeavesBlock, - ItemLootEntry.lootTableItem(seedItem) + SeedItemLootEntry.lootTableSeedItem() .when(SurvivesExplosion.survivesExplosion()) .when(TableBonus.bonusLevelFlatChance(Enchantments.BLOCK_FORTUNE, seedChances)) .when(SeasonalSeedDropChance.seasonalSeedDropChance()) @@ -169,24 +171,10 @@ public static LootTable.Builder createWartBlockDrops(Block primitiveWartBlock) { ); } - public static LootTable.Builder createLeavesDrops() { - return LootTable.lootTable().withPool( - LootPool.lootPool().setRolls(ConstantRange.exactly(1)).add( - ItemLootEntry.lootTableItem(Items.STICK) - .apply(SetCount.setCount(RandomValueRange.between(1.0F, 2.0F))) - .apply(ExplosionDecay.explosionDecay()) - .when(TableBonus.bonusLevelFlatChance( - Enchantments.BLOCK_FORTUNE, 0.02F, 0.022222223F, 0.025F, 0.033333335F, - 0.1F - )) - ) - ).setParamSet(LootParameterSets.BLOCK); - } - - public static LootTable.Builder createLeavesDrops(Item seedItem, float[] seedChances, LootParameterSet parameterSet) { + public static LootTable.Builder createLeavesDrops(float[] seedChances, LootParameterSet parameterSet) { return LootTable.lootTable().withPool( LootPool.lootPool().setRolls(ConstantRange.exactly(1)).add( - ItemLootEntry.lootTableItem(seedItem) + SeedItemLootEntry.lootTableSeedItem() .when(SurvivesExplosion.survivesExplosion()) .when(TableBonus.bonusLevelFlatChance(Enchantments.BLOCK_FORTUNE, seedChances)) .when(SeasonalSeedDropChance.seasonalSeedDropChance()) diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/DTLootParameterSets.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/DTLootParameterSets.java index 9c2d52117..b89a8e102 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/loot/DTLootParameterSets.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/DTLootParameterSets.java @@ -14,6 +14,7 @@ public final class DTLootParameterSets { public static final LootParameterSet LEAVES = register("leaves", builder -> builder.required(LootParameters.BLOCK_STATE) + .required(DTLootParameters.SPECIES) .required(DTLootParameters.SEASONAL_SEED_DROP_FACTOR) .required(LootParameters.TOOL) .optional(LootParameters.EXPLOSION_RADIUS) @@ -27,6 +28,7 @@ public final class DTLootParameterSets { public static final LootParameterSet BRANCHES = register("branches", builder -> builder.required(LootParameters.TOOL) + .required(DTLootParameters.SPECIES) .required(DTLootParameters.VOLUME) .optional(LootParameters.EXPLOSION_RADIUS) ); diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/DTLootEntries.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/DTLootEntries.java index c286494c1..cb63bd0a0 100644 --- a/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/DTLootEntries.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/DTLootEntries.java @@ -11,8 +11,10 @@ */ public final class DTLootEntries { - public static LootPoolEntryType - ITEM_BY_SPECIES = register("dynamictrees:item_by_species", new ItemBySpeciesLootEntry.Serializer()); + public static LootPoolEntryType ITEM_BY_SPECIES = + register("dynamictrees:item_by_species", new ItemBySpeciesLootEntry.Serializer()); + public static LootPoolEntryType SEED_ITEM = + register("dynamictrees:seed_item", new SeedItemLootEntry.Serializer()); private static LootPoolEntryType register(String name, ILootSerializer serializer) { return Registry.register(Registry.LOOT_POOL_ENTRY_TYPE, new ResourceLocation(name), new LootPoolEntryType(serializer)); diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/SeedItemLootEntry.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/SeedItemLootEntry.java new file mode 100644 index 000000000..af03ae3a9 --- /dev/null +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/SeedItemLootEntry.java @@ -0,0 +1,49 @@ +package com.ferreusveritas.dynamictrees.loot.entry; + +import com.ferreusveritas.dynamictrees.loot.DTLootParameters; +import com.ferreusveritas.dynamictrees.trees.Species; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonObject; +import net.minecraft.item.ItemStack; +import net.minecraft.loot.LootContext; +import net.minecraft.loot.LootPoolEntryType; +import net.minecraft.loot.StandaloneLootEntry; +import net.minecraft.loot.conditions.ILootCondition; +import net.minecraft.loot.functions.ILootFunction; + +import java.util.function.Consumer; + +/** + * @author Harley O'Connor + */ +public final class SeedItemLootEntry extends StandaloneLootEntry { + + public SeedItemLootEntry(int weight, int quality, ILootCondition[] conditions, ILootFunction[] functions) { + super(weight, quality, conditions, functions); + } + + @Override + public LootPoolEntryType getType() { + return DTLootEntries.SEED_ITEM; + } + + @Override + protected void createItemStack(Consumer stackConsumer, LootContext context) { + final Species species = context.getParamOrNull(DTLootParameters.SPECIES); + assert species != null; + stackConsumer.accept(species.getSeedStack(1)); + } + + public static StandaloneLootEntry.Builder lootTableSeedItem() { + return simpleBuilder(SeedItemLootEntry::new); + } + + public static class Serializer extends StandaloneLootEntry.Serializer { + @Override + protected SeedItemLootEntry deserialize(JsonObject json, JsonDeserializationContext context, + int weight, int quality, ILootCondition[] conditions, + ILootFunction[] functions) { + return new SeedItemLootEntry(weight, quality, conditions, functions); + } + } +} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/resources/loader/LeavesPropertiesResourceLoader.java b/src/main/java/com/ferreusveritas/dynamictrees/resources/loader/LeavesPropertiesResourceLoader.java index 4efff80bb..4a1e204f3 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/resources/loader/LeavesPropertiesResourceLoader.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/resources/loader/LeavesPropertiesResourceLoader.java @@ -11,6 +11,7 @@ import com.ferreusveritas.dynamictrees.deserialisation.ResourceLocationDeserialiser; import com.ferreusveritas.dynamictrees.deserialisation.result.JsonResult; import com.ferreusveritas.dynamictrees.trees.Family; +import com.ferreusveritas.dynamictrees.trees.Species; import com.ferreusveritas.dynamictrees.util.ToolTypes; import com.google.gson.JsonElement; import com.google.gson.JsonObject; @@ -36,7 +37,9 @@ public void registerAppliers() { .register("color", Integer.class, LeavesProperties::setColorNumber); // Primitive leaves are needed before gathering data. - this.gatherDataAppliers.register("primitive_leaves", Block.class, LeavesProperties::setPrimitiveLeaves); + this.gatherDataAppliers + .register("primitive_leaves", Block.class, LeavesProperties::setPrimitiveLeaves) + .registerListApplier("seed_drop_chances", Float.class, LeavesProperties::setSeedDropChances); // Primitive leaves are needed both client and server (so cannot be done on load). this.setupAppliers.register("primitive_leaves", Block.class, LeavesProperties::setPrimitiveLeaves) diff --git a/src/main/java/com/ferreusveritas/dynamictrees/resources/loader/SpeciesResourceLoader.java b/src/main/java/com/ferreusveritas/dynamictrees/resources/loader/SpeciesResourceLoader.java index 212c5d0f7..2634753dd 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/resources/loader/SpeciesResourceLoader.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/resources/loader/SpeciesResourceLoader.java @@ -81,9 +81,7 @@ public void registerAppliers () { .register("sapling_shape", VoxelShape.class, Species::setSaplingShape); // We need the sapling shape to know which parent smartmodel the sapling model should use. - this.gatherDataAppliers - .register("sapling_shape", VoxelShape.class, Species::setSaplingShape) - .registerListApplier("seed_chances", Float.class, Species::setSeedChances);; + this.gatherDataAppliers.register("sapling_shape", VoxelShape.class, Species::setSaplingShape); this.reloadAppliers .register("tapering", Float.class, Species::setTapering) diff --git a/src/main/java/com/ferreusveritas/dynamictrees/systems/genfeatures/AlternativeLeavesGenFeature.java b/src/main/java/com/ferreusveritas/dynamictrees/systems/genfeatures/AlternativeLeavesGenFeature.java index cb3f8b18a..911c75f3a 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/systems/genfeatures/AlternativeLeavesGenFeature.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/systems/genfeatures/AlternativeLeavesGenFeature.java @@ -18,7 +18,6 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IWorld; -import net.minecraft.world.World; import java.util.LinkedList; import java.util.List; @@ -39,7 +38,7 @@ protected void registerProperties() { } public GenFeatureConfiguration createDefaultConfiguration() { - return super.createDefaultConfiguration().with(ALT_LEAVES, LeavesProperties.NULL_PROPERTIES).with(ALT_LEAVES_BLOCK, Blocks.AIR) + return super.createDefaultConfiguration().with(ALT_LEAVES, LeavesProperties.NULL).with(ALT_LEAVES_BLOCK, Blocks.AIR) .with(PLACE_CHANCE, 0.5f).with(QUANTITY, 5); } diff --git a/src/main/java/com/ferreusveritas/dynamictrees/systems/genfeatures/ConiferTopperGenFeature.java b/src/main/java/com/ferreusveritas/dynamictrees/systems/genfeatures/ConiferTopperGenFeature.java index 50ec3c602..6a01c6b0d 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/systems/genfeatures/ConiferTopperGenFeature.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/systems/genfeatures/ConiferTopperGenFeature.java @@ -27,7 +27,7 @@ protected void registerProperties() { @Override public GenFeatureConfiguration createDefaultConfiguration() { return super.createDefaultConfiguration() - .with(LEAVES_PROPERTIES, LeavesProperties.NULL_PROPERTIES); + .with(LEAVES_PROPERTIES, LeavesProperties.NULL); } @Override diff --git a/src/main/java/com/ferreusveritas/dynamictrees/trees/Family.java b/src/main/java/com/ferreusveritas/dynamictrees/trees/Family.java index 1f55f57a4..830bd9f4b 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/trees/Family.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/trees/Family.java @@ -133,7 +133,7 @@ public Species getSpeciesForLocation(IWorld world, BlockPos trunkPos) { protected Species commonSpecies; - protected LeavesProperties commonLeaves = LeavesProperties.NULL_PROPERTIES; + protected LeavesProperties commonLeaves = LeavesProperties.NULL; //Branches /** diff --git a/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java b/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java index 1946e5007..58fce1290 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java @@ -94,7 +94,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.loot.LootContext; -import net.minecraft.loot.LootParameterSets; import net.minecraft.loot.LootParameters; import net.minecraft.loot.LootTable; import net.minecraft.loot.LootTableManager; @@ -221,7 +220,7 @@ public static Codec createDefaultCodec( .forGetter(Species::getRegistryName), Family.REGISTRY.getGetterCodec().fieldOf("family").forGetter(Species::getFamily), LeavesProperties.REGISTRY.getGetterCodec().optionalFieldOf("leaves_properties", - LeavesProperties.NULL_PROPERTIES).forGetter(Species::getLeavesProperties)) + LeavesProperties.NULL).forGetter(Species::getLeavesProperties)) .apply(instance, constructor)); } @@ -291,7 +290,7 @@ private static DataResult read(ResourceLocation name) { protected final List acceptableBlocksForGrowth = Lists.newArrayList(); //Leaves - protected LeavesProperties leavesProperties = LeavesProperties.NULL_PROPERTIES; + protected LeavesProperties leavesProperties = LeavesProperties.NULL; /** * A list of leaf blocks the species accepts as its own. Used for the falling tree renderer @@ -391,8 +390,7 @@ public Species reset() { public Species setPreReloadDefaults() { return this.setDefaultGrowingParameters() .setSaplingShape(CommonVoxelShapes.SAPLING) - .setSaplingSound(SoundType.GRASS) - .setSeedChances(new float[]{0.05F, 0.0625F, 0.083333336F, 0.1F}); + .setSaplingSound(SoundType.GRASS); } /** @@ -761,41 +759,6 @@ public Species setSeed(final Seed seed) { return this; } - /** - * Chances for leaves to drop seeds. Used in data gen for loot tables. - */ - private float[] seedChances = new float[]{0.05F, 0.0625F, 0.083333336F, 0.1F}; - - public Species setSeedChances(float[] seedChances) { - this.seedChances = (float[]) seedChances; - return this; - } - - public Species setSeedChances(Collection seedChances) { - this.seedChances = new float[seedChances.size()]; - Iterator iterator = seedChances.iterator(); - for (int i = 0; i < seedChances.size(); i++) { - this.seedChances[i] = iterator.next(); - } - return this; - } - - public List getLeavesDrops(World world, BlockPos pos, ItemStack tool) { - if (world.isClientSide) { - return Collections.emptyList(); - } - return getLootTable(world.getServer().getLootTables(), species -> species.leavesDropsPath.get()) - .getRandomItems(createLeavesLootContext(world, pos, tool)); - } - - private LootContext createLeavesLootContext(World world, BlockPos pos, ItemStack tool) { - return new LootContext.Builder(WorldContext.getServerWorldOrThrow(world)) - .withParameter(LootParameters.BLOCK_STATE, world.getBlockState(pos)) - .withParameter(DTLootParameters.SEASONAL_SEED_DROP_FACTOR, seasonalSeedDropFactor(WorldContext.create(world), pos)) - .withParameter(LootParameters.TOOL, tool) - .create(DTLootParameterSets.LEAVES); - } - public List getVoluntaryDrops(World world, BlockPos rootPos, int fertility) { if (world.isClientSide) { return Collections.emptyList(); @@ -2295,55 +2258,6 @@ public void generateItemModelData(DTItemModelProvider provider) { this.seedModelGenerator.get().generate(provider, this); } - public boolean shouldGenerateLeavesBlockDrops() { - return shouldGenerateLeavesDrops(); - } - - private final LazyValue leavesBlockDropsTableName = LazyValue.supplied(() -> { - LeavesProperties leavesProperties = this.leavesProperties; - if (leavesProperties == null) { - leavesProperties = getCommonSpecies().leavesProperties; - } - return ResourceLocationUtils.suffix(getRegistryName(), - (leavesProperties == null ? "_leaves" : leavesProperties.getBlockRegistryNameSuffix())); - }); - - private final LazyValue leavesBlockDropsPath = LazyValue.supplied(() -> - ResourceLocationUtils.prefix(leavesBlockDropsTableName.get(), "blocks/")); - - public ResourceLocation getLeavesBlockDropsPath() { - return leavesBlockDropsPath.get(); - } - - public LootTable.Builder createLeavesBlockDrops() { - if (getPrimitiveLeaves().isPresent() && seed != null) { - return DTLootTableProvider.createLeavesBlockDrops(getPrimitiveLeaves().get(), this.seed, seedChances); - } else if (seed == null) { - return DTLootTableProvider.createLeavesBlockDrops(getPrimitiveLeaves().get()); - } - return DTLootTableProvider.createLeavesDrops(seed, seedChances, LootParameterSets.BLOCK); - } - - public boolean shouldGenerateLeavesDrops() { - final boolean hasPrimitiveLeaves = getPrimitiveLeaves().isPresent(); - final boolean hasSeed = this.seed != null; - return ((hasPrimitiveLeaves || hasSeed) && isCommonSpecies()) || (hasPrimitiveLeaves && hasSeed); - } - - private final LazyValue leavesDropsPath = LazyValue.supplied(() -> - ResourceLocationUtils.prefix(getRegistryName(), "trees/leaves/")); - - public ResourceLocation getLeavesDropsPath() { - return leavesDropsPath.get(); - } - - public LootTable.Builder createLeavesDrops() { - if (seed == null) { - return DTLootTableProvider.createLeavesDrops(); - } - return DTLootTableProvider.createLeavesDrops(seed, seedChances, DTLootParameterSets.LEAVES); - } - public boolean shouldGenerateVoluntaryDrops() { return this.seed != null; } diff --git a/src/main/java/com/ferreusveritas/dynamictrees/trees/species/NetherFungusSpecies.java b/src/main/java/com/ferreusveritas/dynamictrees/trees/species/NetherFungusSpecies.java index f219377b3..51408d39e 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/trees/species/NetherFungusSpecies.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/trees/species/NetherFungusSpecies.java @@ -6,7 +6,6 @@ import com.ferreusveritas.dynamictrees.blocks.rootyblocks.SoilHelper; import com.ferreusveritas.dynamictrees.data.DTBlockTags; import com.ferreusveritas.dynamictrees.data.DTItemTags; -import com.ferreusveritas.dynamictrees.data.provider.DTLootTableProvider; import com.ferreusveritas.dynamictrees.systems.genfeatures.GenFeatures; import com.ferreusveritas.dynamictrees.trees.Family; import com.ferreusveritas.dynamictrees.trees.Species; @@ -16,7 +15,6 @@ import net.minecraft.block.Blocks; import net.minecraft.block.SoundType; import net.minecraft.item.Item; -import net.minecraft.loot.LootTable; import net.minecraft.tags.ITag; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; @@ -107,24 +105,4 @@ public void addSaplingTextures(BiConsumer textureConsu textureConsumer.accept("cap", capLocation); } - @Override - public boolean shouldGenerateLeavesBlockDrops() { - return getPrimitiveLeaves().isPresent(); - } - - @Override - public LootTable.Builder createLeavesBlockDrops() { - return DTLootTableProvider.createWartBlockDrops(getPrimitiveLeaves().get()); - } - - @Override - public boolean shouldGenerateLeavesDrops() { - return getPrimitiveLeaves().isPresent(); - } - - @Override - public LootTable.Builder createLeavesDrops() { - return DTLootTableProvider.createWartDrops(getPrimitiveLeaves().get()); - } - } diff --git a/src/main/resources/trees/dynamictrees/leaves_properties/jungle.json b/src/main/resources/trees/dynamictrees/leaves_properties/jungle.json index a3cdb97dc..05a910dcb 100755 --- a/src/main/resources/trees/dynamictrees/leaves_properties/jungle.json +++ b/src/main/resources/trees/dynamictrees/leaves_properties/jungle.json @@ -1,4 +1,7 @@ { "primitive_leaves": "minecraft:jungle_leaves", - "light_requirement": 12 + "light_requirement": 12, + + "_comment": "Seed chances are for data gen only, changing these will NOT have an effect until data is regenerated.", + "seed_drop_chances": [ 0.025, 0.027777778, 0.03125, 0.041666668, 0.1 ] } \ No newline at end of file diff --git a/src/main/resources/trees/dynamictrees/species/jungle.json b/src/main/resources/trees/dynamictrees/species/jungle.json index 54b0a28dc..e16c96627 100755 --- a/src/main/resources/trees/dynamictrees/species/jungle.json +++ b/src/main/resources/trees/dynamictrees/species/jungle.json @@ -34,8 +34,5 @@ } }, "undergrowth" - ], - - "_comment": "Seed chances are for data gen only, changing these will NOT have an effect until data is regenerated.", - "seed_chances": [ 0.025, 0.027777778, 0.03125, 0.041666668, 0.1 ] + ] } \ No newline at end of file diff --git a/src/main/resources/trees/dynamictrees/species/mega_jungle.json b/src/main/resources/trees/dynamictrees/species/mega_jungle.json index 1ee1cb447..66bb4c6a1 100755 --- a/src/main/resources/trees/dynamictrees/species/mega_jungle.json +++ b/src/main/resources/trees/dynamictrees/species/mega_jungle.json @@ -46,8 +46,5 @@ }, "clear_volume", "bottom_flare" - ], - - "_comment": "Seed chances are for data gen only, changing these will NOT have an effect until data is regenerated.", - "seed_chances": [ 0.025, 0.027777778, 0.03125, 0.041666668, 0.1 ] + ] } \ No newline at end of file From 07f08d953706d03a6b9873c5e4d1a1ae0ff6befa Mon Sep 17 00:00:00 2001 From: Harleyoc1 Date: Tue, 9 Aug 2022 17:38:58 +0100 Subject: [PATCH 07/17] Change IsSpecies condition to SpeciesMatches and use regex instead of raw name comparison --- gradle.properties | 2 +- .../loot/condition/DTLootConditions.java | 2 +- .../{IsSpecies.java => SpeciesMatches.java} | 27 +++++++++---------- 3 files changed, 15 insertions(+), 16 deletions(-) rename src/main/java/com/ferreusveritas/dynamictrees/loot/condition/{IsSpecies.java => SpeciesMatches.java} (50%) diff --git a/gradle.properties b/gradle.properties index f64b6d871..d1759ac60 100755 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ modName=DynamicTrees modId=dynamictrees -modVersion=0.10.0-Beta-LR3 +modVersion=0.10.0-Beta-LR5 group=com.ferreusveritas.dynamictrees mcVersion=1.16.5 diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/DTLootConditions.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/DTLootConditions.java index fe0ce25ae..a536a4a8d 100644 --- a/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/DTLootConditions.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/DTLootConditions.java @@ -11,7 +11,7 @@ */ public final class DTLootConditions { - public static final LootConditionType IS_SPECIES = register("dynamictrees:is_species", new IsSpecies.Serializer()); + public static final LootConditionType SPECIES_MATCHES = register("dynamictrees:species_matches", new SpeciesMatches.Serializer()); public static final LootConditionType SEASONAL_SEED_DROP_CHANCE = register("dynamictrees:seasonal_seed_drop_chance", new SeasonalSeedDropChance.Serializer()); public static final LootConditionType VOLUNTARY_SEED_DROP_CHANCE = register("dynamictrees:voluntary_seed_drop_chance", new VoluntarySeedDropChance.Serializer()); diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/IsSpecies.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/SpeciesMatches.java similarity index 50% rename from src/main/java/com/ferreusveritas/dynamictrees/loot/condition/IsSpecies.java rename to src/main/java/com/ferreusveritas/dynamictrees/loot/condition/SpeciesMatches.java index 15154809f..b4dbd9bd9 100644 --- a/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/IsSpecies.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/SpeciesMatches.java @@ -10,44 +10,43 @@ import net.minecraft.loot.LootContext; import net.minecraft.loot.conditions.ILootCondition; import net.minecraft.util.JSONUtils; -import net.minecraft.util.ResourceLocation; /** * @author Harley O'Connor */ -public final class IsSpecies implements ILootCondition { +public final class SpeciesMatches implements ILootCondition { - private final ResourceLocation name; + private final String regex; - public IsSpecies(ResourceLocation name) { - this.name = name; + public SpeciesMatches(String regex) { + this.regex = regex; } @Override public LootConditionType getType() { - return DTLootConditions.IS_SPECIES; + return DTLootConditions.SPECIES_MATCHES; } @Override public boolean test(LootContext context) { final Species species = context.getParamOrNull(DTLootParameters.SPECIES); assert species != null; - return species.getRegistryName().equals(name); + return String.valueOf(species.getRegistryName()).matches(regex); } - public static ILootCondition.IBuilder isSpecies(ResourceLocation name) { - return () -> new IsSpecies(name); + public static ILootCondition.IBuilder speciesMatches(String regex) { + return () -> new SpeciesMatches(regex); } - public static class Serializer implements ILootSerializer { + public static class Serializer implements ILootSerializer { @Override - public void serialize(JsonObject json, IsSpecies value, JsonSerializationContext context) { - json.addProperty("name", String.valueOf(value.name)); + public void serialize(JsonObject json, SpeciesMatches value, JsonSerializationContext context) { + json.addProperty("name", String.valueOf(value.regex)); } @Override - public IsSpecies deserialize(JsonObject json, JsonDeserializationContext context) { - return new IsSpecies(new ResourceLocation(JSONUtils.getAsString(json, "name"))); + public SpeciesMatches deserialize(JsonObject json, JsonDeserializationContext context) { + return new SpeciesMatches(JSONUtils.getAsString(json, "name")); } } From d6a1c1d09b728a882aff673f3c63bb5c21c4bc0a Mon Sep 17 00:00:00 2001 From: Harleyoc1 Date: Wed, 10 Aug 2022 10:38:47 +0100 Subject: [PATCH 08/17] Update default seed drop chances --- gradle.properties | 2 +- src/generated/resources/.cache/cache | 24 ++--- .../assets/dynamictrees/lang/de_de.json | 83 ++++++++++++++++ .../assets/dynamictrees/lang/es_es.json | 83 ++++++++++++++++ .../assets/dynamictrees/lang/es_mx.json | 83 ++++++++++++++++ .../assets/dynamictrees/lang/fr_fr.json | 83 ++++++++++++++++ .../assets/dynamictrees/lang/it_it.json | 97 +++++++++++++++++++ .../assets/dynamictrees/lang/ko_kr.json | 24 +++++ .../assets/dynamictrees/lang/nl_nl.json | 54 +++++++++++ .../assets/dynamictrees/lang/pl_pl.json | 71 ++++++++++++++ .../assets/dynamictrees/lang/ru_ru.json | 85 ++++++++++++++++ .../assets/dynamictrees/lang/sv_se.json | 25 +++++ .../assets/dynamictrees/lang/uk_ua.json | 44 +++++++++ .../assets/dynamictrees/lang/zh_cn.json | 24 +++++ .../loot_tables/blocks/acacia_leaves.json | 8 +- .../loot_tables/blocks/birch_leaves.json | 8 +- .../loot_tables/blocks/dark_oak_leaves.json | 8 +- .../loot_tables/blocks/jungle_leaves.json | 7 +- .../loot_tables/blocks/oak_leaves.json | 8 +- .../loot_tables/blocks/spruce_leaves.json | 8 +- .../loot_tables/trees/leaves/acacia.json | 8 +- .../loot_tables/trees/leaves/birch.json | 8 +- .../loot_tables/trees/leaves/dark_oak.json | 8 +- .../loot_tables/trees/leaves/jungle.json | 7 +- .../loot_tables/trees/leaves/oak.json | 8 +- .../loot_tables/trees/leaves/spruce.json | 8 +- .../blocks/leaves/LeavesProperties.java | 2 +- .../leaves_properties/jungle.json | 5 +- 28 files changed, 817 insertions(+), 66 deletions(-) create mode 100644 src/generated/resources/assets/dynamictrees/lang/de_de.json create mode 100644 src/generated/resources/assets/dynamictrees/lang/es_es.json create mode 100644 src/generated/resources/assets/dynamictrees/lang/es_mx.json create mode 100644 src/generated/resources/assets/dynamictrees/lang/fr_fr.json create mode 100644 src/generated/resources/assets/dynamictrees/lang/it_it.json create mode 100644 src/generated/resources/assets/dynamictrees/lang/ko_kr.json create mode 100644 src/generated/resources/assets/dynamictrees/lang/nl_nl.json create mode 100644 src/generated/resources/assets/dynamictrees/lang/pl_pl.json create mode 100644 src/generated/resources/assets/dynamictrees/lang/ru_ru.json create mode 100644 src/generated/resources/assets/dynamictrees/lang/sv_se.json create mode 100644 src/generated/resources/assets/dynamictrees/lang/uk_ua.json create mode 100644 src/generated/resources/assets/dynamictrees/lang/zh_cn.json diff --git a/gradle.properties b/gradle.properties index d1759ac60..4e35243fb 100755 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ modName=DynamicTrees modId=dynamictrees -modVersion=0.10.0-Beta-LR5 +modVersion=0.10.0-Beta-LR6 group=com.ferreusveritas.dynamictrees mcVersion=1.16.5 diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index 5a2475f8a..60b008046 100755 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -93,13 +93,13 @@ e93499abbe31d9e789e29af06798a9caddc88e80 assets/dynamictrees/models/item/spruce_ 0a004b585c1035911f357ecaefec8799388a6d11 assets/dynamictrees/models/item/spruce_seed.json f19f3fb00967e33d24bce3ac224ebe952e5d3cd4 assets/dynamictrees/models/item/warped_branch.json 6f06586da567331dbe6251acb1aa1a554de5cfa6 assets/dynamictrees/models/item/warped_seed.json -a5edf7116643871a12a784a1b19d5a59061b72e1 data/dynamictrees/loot_tables/blocks/acacia_leaves.json -c67d7f34987a5f85b8f832632473d9ab8081d72e data/dynamictrees/loot_tables/blocks/birch_leaves.json +8ec8548bf39e74c89bd1af35ac15ed1f61df60e0 data/dynamictrees/loot_tables/blocks/acacia_leaves.json +bd755992edc0863661049241755d6d2d918d4254 data/dynamictrees/loot_tables/blocks/birch_leaves.json 2a9c0717ddf89f86514ef3e161f9679ccc7bee29 data/dynamictrees/loot_tables/blocks/crimson_wart.json -baab650063d6efc524a7dfacf2e983986fc306fe data/dynamictrees/loot_tables/blocks/dark_oak_leaves.json -c664597000eb6bb9d661adc8f6f89ddf42ff313c data/dynamictrees/loot_tables/blocks/jungle_leaves.json -1bfe2ec3b69704ccaeb20d4e72a48a94a30967eb data/dynamictrees/loot_tables/blocks/oak_leaves.json -95037f732cd18529c721f674f36471167700a761 data/dynamictrees/loot_tables/blocks/spruce_leaves.json +ce5c5f799db7d83f546fee5351bd44670b160645 data/dynamictrees/loot_tables/blocks/dark_oak_leaves.json +c2b3626fa1216775e5ca487a5d5249c204de8916 data/dynamictrees/loot_tables/blocks/jungle_leaves.json +535fc0acf78658ba6e26050247c7b82eedfa7959 data/dynamictrees/loot_tables/blocks/oak_leaves.json +f6e27d06751389a868918c1d7755df5d2d45a475 data/dynamictrees/loot_tables/blocks/spruce_leaves.json 3b375ed7e64d3d6d18499bbc1af30e5cd931e134 data/dynamictrees/loot_tables/blocks/warped_wart.json f6d16a6825ddeaecdd0ddb2c2b1886f60ea82944 data/dynamictrees/loot_tables/trees/branches/acacia.json 8f45ffe7eebe4d5b164e23d5481a7b6af801655e data/dynamictrees/loot_tables/trees/branches/birch.json @@ -117,13 +117,13 @@ bca98cb1ec99edd9eb9f05bc0b2945a05b42899f data/dynamictrees/loot_tables/trees/bra 1c6d89c3fb1339f881e4e32cfae3b47f2504fd35 data/dynamictrees/loot_tables/trees/branches/stripped_spruce.json 9a3b714da894635be7b9a53d94c639652033b33c data/dynamictrees/loot_tables/trees/branches/stripped_warped.json 05f6da26478527e105eca41987455f402c95c913 data/dynamictrees/loot_tables/trees/branches/warped.json -3318e735a30793bad9a064415d477ea07bab55f2 data/dynamictrees/loot_tables/trees/leaves/acacia.json -3318e735a30793bad9a064415d477ea07bab55f2 data/dynamictrees/loot_tables/trees/leaves/birch.json +18fb82213e5bed379c7bc6fe55ee1149fb7979b8 data/dynamictrees/loot_tables/trees/leaves/acacia.json +18fb82213e5bed379c7bc6fe55ee1149fb7979b8 data/dynamictrees/loot_tables/trees/leaves/birch.json 1fa0122268c45577f8d382b8d8f54eab235c52cb data/dynamictrees/loot_tables/trees/leaves/crimson.json -3318e735a30793bad9a064415d477ea07bab55f2 data/dynamictrees/loot_tables/trees/leaves/dark_oak.json -05a23cbd71c2de8369eeb33b52a9c170e126ec7c data/dynamictrees/loot_tables/trees/leaves/jungle.json -3318e735a30793bad9a064415d477ea07bab55f2 data/dynamictrees/loot_tables/trees/leaves/oak.json -3318e735a30793bad9a064415d477ea07bab55f2 data/dynamictrees/loot_tables/trees/leaves/spruce.json +18fb82213e5bed379c7bc6fe55ee1149fb7979b8 data/dynamictrees/loot_tables/trees/leaves/dark_oak.json +18fb82213e5bed379c7bc6fe55ee1149fb7979b8 data/dynamictrees/loot_tables/trees/leaves/jungle.json +18fb82213e5bed379c7bc6fe55ee1149fb7979b8 data/dynamictrees/loot_tables/trees/leaves/oak.json +18fb82213e5bed379c7bc6fe55ee1149fb7979b8 data/dynamictrees/loot_tables/trees/leaves/spruce.json ade396476908421578ad8a9d9136de4da8608e7f data/dynamictrees/loot_tables/trees/leaves/warped.json 1afd145bc713c49a951b1aae9e958436c1e01fad data/dynamictrees/loot_tables/trees/voluntary/acacia.json f7155cfadea4513beea11b7af3a8b16595fc5966 data/dynamictrees/loot_tables/trees/voluntary/apple_oak.json diff --git a/src/generated/resources/assets/dynamictrees/lang/de_de.json b/src/generated/resources/assets/dynamictrees/lang/de_de.json new file mode 100644 index 000000000..07b8a82a1 --- /dev/null +++ b/src/generated/resources/assets/dynamictrees/lang/de_de.json @@ -0,0 +1,83 @@ +{ + "itemGroup.dynamictrees": "Dynamic Trees", + "block.dynamictrees.oak_branch": "Eichen Baum", + "block.dynamictrees.spruce_branch": "Fichten Baum", + "block.dynamictrees.birch_branch": "Birken Baum", + "block.dynamictrees.jungle_branch": "Tropen Baum", + "block.dynamictrees.dark_oak_branch": "Schwarz-Eichen Baum", + "block.dynamictrees.acacia_branch": "Akazien Baum", + "block.dynamictrees.crimson_branch": "Karmesin Pilz", + "block.dynamictrees.warped_branch": "Wirr-Pilz", + "species.dynamictrees.oak": "Eiche", + "species.dynamictrees.swamp_oak": "Sumpf-Eiche", + "species.dynamictrees.spruce": "Fichte", + "species.dynamictrees.mega_spruce": "Super Fichte", + "species.dynamictrees.birch": "Birke", + "species.dynamictrees.tall_birch": "Große Birke", + "species.dynamictrees.jungle": "Tropenbaum", + "species.dynamictrees.mega_jungle": "Super Tropenbaum", + "species.dynamictrees.dark_oak": "Schwarz-Eiche", + "species.dynamictrees.acacia": "Akazie", + "species.dynamictrees.apple_oak": "Apfelbaum", + "species.dynamictrees.crimson": "Karmesin-Pilz", + "species.dynamictrees.mega_crimson": "Super Karmesin-Pilz", + "species.dynamictrees.warped": "Wirr-Pilz", + "species.dynamictrees.mega_warped": "Super Wirr-Pilz", + "item.dynamictrees.oak_seed": "Eichel", + "item.dynamictrees.spruce_seed": "Fichtenzapfen", + "item.dynamictrees.birch_seed": "Birkenkätzchen", + "item.dynamictrees.jungle_seed": "Tropbenbaumschote", + "item.dynamictrees.dark_oak_seed": "Schwarz-Eichen Eichel", + "item.dynamictrees.acacia_seed": "Akazien Samen", + "item.dynamictrees.apple_oak_seed": "Apfelkern", + "item.dynamictrees.crimson_seed": "Karmesin Hut", + "item.dynamictrees.warped_seed": "Wirr Hut", + "item.dynamictrees.dendro_potion.biochar": "Biokohlen Basistrank", + "item.dynamictrees.dendro_potion.depletion": "Trank der Verarmung", + "item.dynamictrees.dendro_potion.gigas": "Trank des Superwachstums", + "item.dynamictrees.dendro_potion.burgeoning": "Trank des Aufkeimens", + "item.dynamictrees.dendro_potion.fertility": "Trank der Düngung", + "item.dynamictrees.dendro_potion.persistence": "Trank des Verharrens", + "item.dynamictrees.dendro_potion.transform": "Trank der Transformation", + "item.dynamictrees.dendro_potion.harvest": "Trank der Ernte", + "item.dynamictrees.dendro_potion.denuding": "Trank der Entblößung", + "item.dynamictrees.dirt_bucket": "Eimer mit Erde", + "item.dynamictrees.staff": "Waldland Stab", + "block.dynamictrees.potted_sapling": "Eingetopfter Setzling", + "chat.registry_name": "Register Name: %s", + "tooltip.dynamictrees.species": "Spezies: %s", + "tooltip.dynamictrees.fertility": "Fertilität: %s", + "tooltip.dynamictrees.jo_code": "JoCode: %s", + "tooltip.dynamictrees.force_planting": "Pflanzung erzwingen: %s", + "tooltip.dynamictrees.seed_life_span": "Lebensdauer verschnellern: %s", + "tooltip.dynamictrees.enabled": "Aktiv", + "commands.dynamictrees.success.get_tree": "Spezies: %s JoCode: %s", + "commands.dynamictrees.error.get_tree": "Konnte die Spezies bei %s nicht finden.", + "commands.dynamictrees.success.set_tree": "Baum wurde erfolgreich an Position %s to spezies %s with JoCode %s gesetzt.", + "commands.dynamictrees.success.kill_tree": "Baum wurde erfolgreich an Position %s getötet.", + "commands.dynamictrees.error.unknown_species": "Unbekannte Spezies %s.", + "commands.dynamictrees.success.get_fertility": "Fertilität des Baumes an Position %s ist %s.", + "commands.dynamictrees.success.set_fertility": "Fertilität des Baumes an Position %s erfolgreich auf %s gesetzt.", + "commands.dynamictrees.success.grow_pulse": "Wachstumsimpuls von %s wurde erfolgreich an Baum auf Position %s gesendet.", + "commands.dynamictrees.success.set_xor": "Koordinaten wurden erfolgreich von Xor auf %s gesetzt.", + "commands.dynamictrees.success.rotate_jo_code": "JoCode wurde rotiert:", + "commands.dynamictrees.error.species_equal": "Zielspezies ist schon die jetzige Spezies.", + "commands.dynamictrees.success.transform": "Spezies %s wurde erfolgreich an Position %s zu Spezies %s geändert.", + "commands.dynamictrees.error.not_transformable": "Spezies %s kann nicht umgewandelt werden.", + "commands.dynamictrees.success.create_staff": "Stab wurde erfolgreich mit Spezies %s, Code %s, Farbe %s, nur lesen %s, und maximal %s Benutzungen an Position %s kreiert.", + "commands.dynamictrees.success.create_transform_potion": "Trank der Umwandlung wurde erfolgreich für Spezies %s an Position %s erstellt.", + "commands.dynamictrees.success.clear_orphaned": "%s Unangebundene Netzwerke aus Zweigen wurde erfolgreich entfernt.", + "commands.dynamictrees.success.purge_trees": "%s Bäume wurden erfolgreich gesäubert.", + "potion.biochar.description": "Basis für das Brauen von Baumtränken", + "potion.depletion.description": "Zerstört die Fruchbarkeit des durchwurzelten Bodens", + "potion.gigas.description": "Erlaubt dem Baum seine Superform zu erlangen", + "potion.burgeoning.description": "Lässt den Baum schnell wachsen", + "potion.fertility.description": "Düngt den durchwurzelten Boden komplett", + "potion.persistence.description": "Der Baum bleibt in seinem jetzigen Zustand", + "potion.transform.description": "Transformiert einen Baum in eine %s tree", + "potion.transform.description.empty": "Basistrank für das Brauen von Transformationen", + "potion.harvest.description": "Verschnellert die Frutifikation", + "potion.denuding.description": "Entfernt alles an Rinde und Laub vom jeweiligen Baum.", + "death.attack.falling_tree": "%1$s wurde von einem fallenden Baum zerschmettert", + "block.dynamictrees.rooty_water": "Wasserwurzeln" +} \ No newline at end of file diff --git a/src/generated/resources/assets/dynamictrees/lang/es_es.json b/src/generated/resources/assets/dynamictrees/lang/es_es.json new file mode 100644 index 000000000..29903127b --- /dev/null +++ b/src/generated/resources/assets/dynamictrees/lang/es_es.json @@ -0,0 +1,83 @@ +{ + "itemGroup.dynamictrees": "Dynamic Trees", + "block.dynamictrees.oak_branch": "Roble", + "block.dynamictrees.spruce_branch": "Abeto", + "block.dynamictrees.birch_branch": "Abedúl", + "block.dynamictrees.jungle_branch": "Árbol de jungla", + "block.dynamictrees.dark_oak_branch": "Roble oscuro", + "block.dynamictrees.acacia_branch": "Acacia", + "block.dynamictrees.crimson_branch": "Hongo carmesí", + "block.dynamictrees.warped_branch": "Hongo distorsionado", + "species.dynamictrees.oak": "Roble", + "species.dynamictrees.swamp_oak": "Roble de pantano", + "species.dynamictrees.spruce": "Abeto", + "species.dynamictrees.mega_spruce": "Abeto gigante", + "species.dynamictrees.birch": "Abedul", + "species.dynamictrees.tall_birch": "Abedul alto", + "species.dynamictrees.jungle": "Jungla", + "species.dynamictrees.mega_jungle": "Jungla gigante", + "species.dynamictrees.dark_oak": "Roble oscuro", + "species.dynamictrees.acacia": "Acacia", + "species.dynamictrees.apple_oak": "Manzano", + "species.dynamictrees.crimson": "Hongo Carmesí", + "species.dynamictrees.mega_crimson": "Hongo carmesí gigante", + "species.dynamictrees.warped": "Hongo distorsionado", + "species.dynamictrees.mega_warped": "Hongo distorsionado Gigante", + "item.dynamictrees.oak_seed": "Bellota de roble", + "item.dynamictrees.spruce_seed": "Piña de abeto", + "item.dynamictrees.birch_seed": "Amento de abedúl", + "item.dynamictrees.jungle_seed": "Vaina de jungla", + "item.dynamictrees.dark_oak_seed": "Bellota de roble oscuro", + "item.dynamictrees.acacia_seed": "Semilla de acacia", + "item.dynamictrees.apple_oak_seed": "Semilla de manzana", + "item.dynamictrees.crimson_seed": "Tapa de hongo carmesí", + "item.dynamictrees.warped_seed": "Tapa de hongo distorsionado", + "item.dynamictrees.dendro_potion.biochar": "Poción base de biocarbón", + "item.dynamictrees.dendro_potion.depletion": "Poción de agotamiento", + "item.dynamictrees.dendro_potion.gigas": "Poción de gigantismo", + "item.dynamictrees.dendro_potion.burgeoning": "Poción de florecimiento", + "item.dynamictrees.dendro_potion.fertility": "Poción de fertilidad", + "item.dynamictrees.dendro_potion.persistence": "Poción de persistencia", + "item.dynamictrees.dendro_potion.transform": "Poción de transformación", + "item.dynamictrees.dendro_potion.harvest": "Poción de cosecha", + "item.dynamictrees.dendro_potion.denuding": "Poción de descortezar", + "item.dynamictrees.dirt_bucket": "Cubo con Tierra", + "item.dynamictrees.staff": "Bastón del Bosque", + "block.dynamictrees.potted_sapling": "Pimpollo enmacetado", + "chat.registry_name": "Nombre de registro: %s", + "tooltip.dynamictrees.species": "Especie: %s", + "tooltip.dynamictrees.fertility": "Fertilidad: %s", + "tooltip.dynamictrees.jo_code": "JoCode: %s", + "tooltip.dynamictrees.force_planting": "Forzar plantación: %s", + "tooltip.dynamictrees.seed_life_span": "Longitud de vida de la semilla: %s", + "tooltip.dynamictrees.enabled": "Activado", + "commands.dynamictrees.success.get_tree": "Especie: %s JoCode: %s", + "commands.dynamictrees.error.get_tree": "No se encontraron especies de árboles en la posición %s.", + "commands.dynamictrees.success.set_tree": "Se ha colocado correctamente un árbol en la posición %s con la especie %s y el JoCode %s.", + "commands.dynamictrees.success.kill_tree": "Árbol en la posición %s eliminado correctamente.", + "commands.dynamictrees.error.unknown_species": "Especie %s desconocida.", + "commands.dynamictrees.success.get_fertility": "La fertilidad del suelo del árbol en la posición %s es %s.", + "commands.dynamictrees.success.set_fertility": "La fertilidad del suelo del árbol en la posición %s ha sido correctamente modificada a %s.", + "commands.dynamictrees.success.grow_pulse": "%s pulsos de crecimiento enviados exitosamente al árbol en la posición %s.", + "commands.dynamictrees.success.set_xor": "La coordenada Xor a sido correctamente configurada a %s.", + "commands.dynamictrees.success.rotate_jo_code": "JoCode rotado: %s", + "commands.dynamictrees.error.species_equal": "La especie elegida es la misma que la especie dada.", + "commands.dynamictrees.success.transform": "La especie %s en la posición %s ha sido exitosamente transformada a la especie %s.", + "commands.dynamictrees.error.not_transformable": "La especie %s no se puede transformar.", + "commands.dynamictrees.success.create_staff": "Bastón con la especie %s, código %s, color %s, solo lectura %s, y maximos usos %s creada correctamente en la posición %s.", + "commands.dynamictrees.success.create_transform_potion": "Poción de transformación para la especie %s creada correctamente en la posición %s.", + "commands.dynamictrees.success.clear_orphaned": "%s redes de ramas solitarias han sido borradas correctamente.", + "commands.dynamictrees.success.purge_trees": "%s árboles purgados correctamente.", + "potion.biochar.description": "Poción base para destilar pociones de árboles", + "potion.depletion.description": "Destruye la fertilidad del suelo de un árbol", + "potion.gigas.description": "Permite que un árbol tenga un gran tamaño", + "potion.burgeoning.description": "Crezca un árbol rápidamente", + "potion.fertility.description": "Fertiliza el suelo de un árbol completamente", + "potion.persistence.description": "Evita que un árbol cambie", + "potion.transform.description": "Transforma un árbol en un árbol de %s", + "potion.transform.description.empty": "Poción base para destilar pociones de transformación de árboles", + "potion.harvest.description": "Acelera la producción de fruta", + "potion.denuding.description": "Elimina la corteza y las hojas de un árbol", + "death.attack.falling_tree": "%1$s fue aplastado por un árbol", + "block.dynamictrees.rooty_water": "Raíces de agua" +} \ No newline at end of file diff --git a/src/generated/resources/assets/dynamictrees/lang/es_mx.json b/src/generated/resources/assets/dynamictrees/lang/es_mx.json new file mode 100644 index 000000000..2a85029f8 --- /dev/null +++ b/src/generated/resources/assets/dynamictrees/lang/es_mx.json @@ -0,0 +1,83 @@ +{ + "itemGroup.dynamictrees": "Dynamic Trees", + "block.dynamictrees.oak_branch": "Roble", + "block.dynamictrees.spruce_branch": "Abeto", + "block.dynamictrees.birch_branch": "Abedúl", + "block.dynamictrees.jungle_branch": "Árbol de jungla", + "block.dynamictrees.dark_oak_branch": "Roble oscuro", + "block.dynamictrees.acacia_branch": "Acacia", + "block.dynamictrees.crimson_branch": "Hongo carmesí", + "block.dynamictrees.warped_branch": "Hongo distorsionado", + "species.dynamictrees.oak": "Roble", + "species.dynamictrees.swamp_oak": "Roble de pantano", + "species.dynamictrees.spruce": "Abeto", + "species.dynamictrees.mega_spruce": "Mega abeto", + "species.dynamictrees.birch": "Abedúl", + "species.dynamictrees.tall_birch": "Abedúl alto", + "species.dynamictrees.jungle": "Jungla", + "species.dynamictrees.mega_jungle": "Mega jungla", + "species.dynamictrees.dark_oak": "Roble oscuro", + "species.dynamictrees.acacia": "Acacia", + "species.dynamictrees.apple_oak": "Manzano", + "species.dynamictrees.crimson": "Hongo carmesí", + "species.dynamictrees.mega_crimson": "Mega hongo carmesí", + "species.dynamictrees.warped": "Hongo distorsionado", + "species.dynamictrees.mega_warped": "Mega hongo distorsionado", + "item.dynamictrees.oak_seed": "Bellota de roble", + "item.dynamictrees.spruce_seed": "Piña de abeto", + "item.dynamictrees.birch_seed": "Amento de abedúl", + "item.dynamictrees.jungle_seed": "Semillas de jungla", + "item.dynamictrees.dark_oak_seed": "Bellota de roble oscuro", + "item.dynamictrees.acacia_seed": "Semilla de acacia", + "item.dynamictrees.apple_oak_seed": "Semilla de manzana", + "item.dynamictrees.crimson_seed": "Tapa de hongo carmesí", + "item.dynamictrees.warped_seed": "Tapa de hongo distorsionado", + "item.dynamictrees.dendro_potion.biochar": "Poción base de biocarbón", + "item.dynamictrees.dendro_potion.depletion": "Poción de agotamiento", + "item.dynamictrees.dendro_potion.gigas": "Poción de gigantismo", + "item.dynamictrees.dendro_potion.burgeoning": "Poción de florecimiento", + "item.dynamictrees.dendro_potion.fertility": "Poción de fertilidad", + "item.dynamictrees.dendro_potion.persistence": "Poción de persistencia", + "item.dynamictrees.dendro_potion.transform": "Poción de transformación", + "item.dynamictrees.dendro_potion.harvest": "Poción de cosecha", + "item.dynamictrees.dendro_potion.denuding": "Poción de descortezar", + "item.dynamictrees.dirt_bucket": "Cubeta con tierra", + "item.dynamictrees.staff": "Bastón del Bosque", + "block.dynamictrees.potted_sapling": "Retoño enmacetado", + "chat.registry_name": "Nombre de registro: %s", + "tooltip.dynamictrees.species": "Especie: %s", + "tooltip.dynamictrees.fertility": "Fertilidad: %s", + "tooltip.dynamictrees.jo_code": "JoCode: %s", + "tooltip.dynamictrees.force_planting": "Forzar plantación: %s", + "tooltip.dynamictrees.seed_life_span": "Longitud de vida de la semilla: %s", + "tooltip.dynamictrees.enabled": "Activado", + "commands.dynamictrees.success.get_tree": "Especie: %s JoCode: %s", + "commands.dynamictrees.error.get_tree": "No se encontraron especies de árboles en la posición %s.", + "commands.dynamictrees.success.set_tree": "Se ha colocado correctamente un árbol en la posición %s con la especie %s y el JoCode %s.", + "commands.dynamictrees.success.kill_tree": "Árbol en la posición %s eliminado correctamente.", + "commands.dynamictrees.error.unknown_species": "Especie %s desconocida.", + "commands.dynamictrees.success.get_fertility": "La fertilidad del suelo del árbol en la posición %s es %s.", + "commands.dynamictrees.success.set_fertility": "La fertilidad del suelo del árbol en la posición %s ha sido correctamente modificada a %s.", + "commands.dynamictrees.success.grow_pulse": "%s pulsos de crecimiento enviados exitosamente al árbol en la posición %s.", + "commands.dynamictrees.success.set_xor": "La coordenada Xor a sido correctamente configurada a %s.", + "commands.dynamictrees.success.rotate_jo_code": "JoCode girado: %s", + "commands.dynamictrees.error.species_equal": "La especie elegida es la misma que la especie dada.", + "commands.dynamictrees.success.transform": "La especie %s en la posición %s ha sido exitosamente transformada a la especie %s.", + "commands.dynamictrees.error.not_transformable": "La especie %s no se puede transformar.", + "commands.dynamictrees.success.create_staff": "Bastón con la especie %s, código %s, color %s, solo lectura %s, y maximos usos %s creada correctamente en la posición %s.", + "commands.dynamictrees.success.create_transform_potion": "Poción de transformación para la especie %s creada correctamente en la posición %s.", + "commands.dynamictrees.success.clear_orphaned": "%s redes de ramas solitarias han sido borradas correctamente.", + "commands.dynamictrees.success.purge_trees": "%s árboles purgados correctamente.", + "potion.biochar.description": "Poción base para destilar pociones de árboles", + "potion.depletion.description": "Destruye la fertilidad del suelo de un árbol", + "potion.gigas.description": "Permite que un árbol tenga un gran tamaño", + "potion.burgeoning.description": "Crezca un árbol rápidamente", + "potion.fertility.description": "Fertiliza el suelo de un árbol completamente", + "potion.persistence.description": "Evita que un árbol cambie", + "potion.transform.description": "Transforma un árbol en un árbol de %s", + "potion.transform.description.empty": "Poción base para destilar pociones de transformación de árboles", + "potion.harvest.description": "Acelera la producción de fruta", + "potion.denuding.description": "Elimina la corteza y las hojas de un árbol", + "death.attack.falling_tree": "%1$s fue aplastado por un árbol que le cayó encima", + "block.dynamictrees.rooty_water": "Raíces de agua" +} \ No newline at end of file diff --git a/src/generated/resources/assets/dynamictrees/lang/fr_fr.json b/src/generated/resources/assets/dynamictrees/lang/fr_fr.json new file mode 100644 index 000000000..6778d891b --- /dev/null +++ b/src/generated/resources/assets/dynamictrees/lang/fr_fr.json @@ -0,0 +1,83 @@ +{ + "itemGroup.dynamictrees": "Dynamic Trees", + "block.dynamictrees.oak_branch": "Chêne", + "block.dynamictrees.spruce_branch": "Épicéa", + "block.dynamictrees.birch_branch": "Bouleau", + "block.dynamictrees.jungle_branch": "Acajou", + "block.dynamictrees.dark_oak_branch": "Chêne noir", + "block.dynamictrees.acacia_branch": "Acacia", + "block.dynamictrees.crimson_branch": "Champignon carmin", + "block.dynamictrees.warped_branch": "Champignon biscornu", + "species.dynamictrees.oak": "Chêne", + "species.dynamictrees.swamp_oak": "Chêne des marais", + "species.dynamictrees.spruce": "Épicéa", + "species.dynamictrees.mega_spruce": "Épicéa géant", + "species.dynamictrees.birch": "Bouleau", + "species.dynamictrees.tall_birch": "Grand bouleau", + "species.dynamictrees.jungle": "Acajou", + "species.dynamictrees.mega_jungle": "Acajou géant", + "species.dynamictrees.dark_oak": "Chêne noir", + "species.dynamictrees.acacia": "Acacia", + "species.dynamictrees.apple_oak": "Pommier", + "species.dynamictrees.crimson": "Champignon carmin", + "species.dynamictrees.mega_crimson": "Champignon carmin géant", + "species.dynamictrees.warped": "Champignon biscornu", + "species.dynamictrees.mega_warped": "Champignon biscornu géant", + "item.dynamictrees.oak_seed": "Gland de chêne", + "item.dynamictrees.spruce_seed": "Cône d'épicéa", + "item.dynamictrees.birch_seed": "Graine de bouleau", + "item.dynamictrees.jungle_seed": "Pomme d'acajou", + "item.dynamictrees.dark_oak_seed": "Gland de chêne noir", + "item.dynamictrees.acacia_seed": "Graine d'acacia", + "item.dynamictrees.apple_oak_seed": "Pépin de pomme", + "item.dynamictrees.crimson_seed": "Chapeau de champignon carmin", + "item.dynamictrees.warped_seed": "Chapeau de champignon biscornu", + "item.dynamictrees.dendro_potion.biochar": "Potion bio-charbon de base", + "item.dynamictrees.dendro_potion.depletion": "Potion d'épuisement", + "item.dynamictrees.dendro_potion.gigas": "Potion de gigantisme", + "item.dynamictrees.dendro_potion.burgeoning": "Potion de bourgeonnement", + "item.dynamictrees.dendro_potion.fertility": "Potion de fertilité", + "item.dynamictrees.dendro_potion.persistence": "Potion de persistance", + "item.dynamictrees.dendro_potion.transform": "Potion de transformation", + "item.dynamictrees.dendro_potion.harvest": "Potion de récolte", + "item.dynamictrees.dendro_potion.denuding": "Potion de déboisement", + "item.dynamictrees.dirt_bucket": "Seau de terre", + "item.dynamictrees.staff": "Bâton des bois", + "block.dynamictrees.potted_sapling": "Pousse en pot", + "chat.registry_name": "Nom de registre: %s", + "tooltip.dynamictrees.species": "Espèce: %s", + "tooltip.dynamictrees.fertility": "Fertilité: %s", + "tooltip.dynamictrees.jo_code": "JoCode: %s", + "tooltip.dynamictrees.force_planting": "Plantation forcée:%s", + "tooltip.dynamictrees.seed_life_span": "Durée de vie des graines:%s", + "tooltip.dynamictrees.enabled": "Activé", + "commands.dynamictrees.success.get_tree": "Espèce: %s JoCode: %s", + "commands.dynamictrees.error.get_tree": "Impossible de trouver des espèces d'arbres à la position %s.", + "commands.dynamictrees.success.set_tree": "Placement de l'arbre réussi à la position %s de l'espèce %s with JoCode %s.", + "commands.dynamictrees.success.kill_tree": "Destruction de l'arbre réussi à la position %s.", + "commands.dynamictrees.error.unknown_species": "Espèces inconnues %s.", + "commands.dynamictrees.success.get_fertility": "Fertilité du sol de l'arbre à la position %s est de %s.", + "commands.dynamictrees.success.set_fertility": "Placement de fertilité du sol réussi à la position %s vers %s.", + "commands.dynamictrees.success.grow_pulse": "Envoi réussi de %s impulsions de croissance à l'arbre à la position %s.", + "commands.dynamictrees.success.set_xor": "Placement des coordonnées réussi Xor vers %s.", + "commands.dynamictrees.success.rotate_jo_code": "Rotation JoCode: %s", + "commands.dynamictrees.error.species_equal": "L'espèce ciblée est la même que l'espèce donnée.", + "commands.dynamictrees.success.transform": "Transformation de l'espèce %s à la position %s en l'espèce %s.", + "commands.dynamictrees.error.not_transformable": "L'espèce %s n'est pas transformable.", + "commands.dynamictrees.success.create_staff": "Bâton des bois créé avec succès avec des espèces %s, code %s, couleur %s, peut lire %s, utilisations totale %s à la position %s.", + "commands.dynamictrees.success.create_transform_potion": "Création de la potion de transformation réussi pour l'espèce %s à la position %s.", + "commands.dynamictrees.success.clear_orphaned": "%s morceaux de branches orphelines effacé avec succès.", + "commands.dynamictrees.success.purge_trees": "%s arbres purgés avec succès.", + "potion.biochar.description": "Potion d'arbre de base", + "potion.depletion.description": "Détruit la fertilité du sol des arbres", + "potion.gigas.description": "Permet à un arbre de devenir géant", + "potion.burgeoning.description": "Fait pousser rapidement un arbre", + "potion.fertility.description": "Fertilise complètement le sol des arbres", + "potion.persistence.description": "Empêche un arbre de changer", + "potion.transform.description": "Transforme un arbre en un arbre %s", + "potion.transform.description.empty": "Potion d'arbre de base pour transformations", + "potion.harvest.description": "Accélère la production de fruits", + "potion.denuding.description": "Enlève toute l'écorce et les feuilles d'un arbre", + "death.attack.falling_tree": "%1$s a été écrasé par un arbre qui tombe", + "block.dynamictrees.rooty_water": "Racines aquatiques" +} \ No newline at end of file diff --git a/src/generated/resources/assets/dynamictrees/lang/it_it.json b/src/generated/resources/assets/dynamictrees/lang/it_it.json new file mode 100644 index 000000000..2911bf57f --- /dev/null +++ b/src/generated/resources/assets/dynamictrees/lang/it_it.json @@ -0,0 +1,97 @@ +{ + "itemGroup.dynamictrees": "Dynamic Trees", + + "block.dynamictrees.oak_branch": "Albero di quercia", + "block.dynamictrees.spruce_branch": "Albero di abete", + "block.dynamictrees.birch_branch": "Albero di betulla", + "block.dynamictrees.jungle_branch": "Albero della giungla", + "block.dynamictrees.dark_oak_branch": "Albero di quercia scura", + "block.dynamictrees.acacia_branch": "Albero di acacia", + "block.dynamictrees.crimson_branch": "Fungo cremisi", + "block.dynamictrees.warped_branch": "Fungo distorto", + + "species.dynamictrees.oak": "Quercia", + "species.dynamictrees.swamp_oak": "Quercia di palude", + "species.dynamictrees.spruce": "Abete", + "species.dynamictrees.mega_spruce": "Abete gigante", + "species.dynamictrees.birch": "Betulla", + "species.dynamictrees.tall_birch": "Betulla alta", + "species.dynamictrees.jungle": "Giungla", + "species.dynamictrees.mega_jungle": "Giungla gigante", + "species.dynamictrees.dark_oak": "Quercia scura", + "species.dynamictrees.acacia": "Acacia", + "species.dynamictrees.apple_oak": "Melo", + "species.dynamictrees.crimson": "Cremisi", + "species.dynamictrees.mega_crimson": "Cremisi grande", + "species.dynamictrees.warped": "Distorto", + "species.dynamictrees.mega_warped": "Distorto grande", + "species.dynamictrees.red_mushroom": "Fungo rosso", + "species.dynamictrees.brown_mushroom": "Fungo marrone", + + "item.dynamictrees.oak_seed": "Ghianda di quercia", + "item.dynamictrees.spruce_seed": "Pigna di abete", + "item.dynamictrees.birch_seed": "Amento di betulla", + "item.dynamictrees.jungle_seed": "Baccello della giungla", + "item.dynamictrees.dark_oak_seed": "Ghianda di quercia scura", + "item.dynamictrees.acacia_seed": "Seme di acacia", + "item.dynamictrees.apple_oak_seed": "Seme di melo", + "item.dynamictrees.crimson_seed": "Cappello cremisi", + "item.dynamictrees.warped_seed": "Cappello distorto", + + "item.dynamictrees.dendro_potion.biochar": "Pozione base di biochar", + "item.dynamictrees.dendro_potion.depletion": "Potzione di esaurimento", + "item.dynamictrees.dendro_potion.gigas": "Pozione di gigantismo", + "item.dynamictrees.dendro_potion.burgeoning": "Pozione della fioritura", + "item.dynamictrees.dendro_potion.fertility": "Pozione della fertilità", + "item.dynamictrees.dendro_potion.persistence": "Pozione di persistenza", + "item.dynamictrees.dendro_potion.transform": "Pozione della transformazione", + "item.dynamictrees.dendro_potion.harvest": "Pozione del raccolto", + "item.dynamictrees.dendro_potion.denuding": "Pozione della denudazione", + + "item.dynamictrees.dirt_bucket": "Secchio di terra", + "item.dynamictrees.staff": "Staffa della foresta", + "block.dynamictrees.potted_sapling": "Arboscello in vaso", + + "chat.registry_name": "Nome di registro: %s", + + "tooltip.dynamictrees.species": "Specie: %s", + "tooltip.dynamictrees.fertility": "Fertilità: %s", + "tooltip.dynamictrees.jo_code": "JoCode: %s", + "tooltip.dynamictrees.force_planting": "Forza piantagione: %s", + "tooltip.dynamictrees.seed_life_span": "Durata vita del seme: %s", + + "tooltip.dynamictrees.enabled": "Abilitato", + + "commands.dynamictrees.success.get_tree": "Specie: %s JoCode: %s", + "commands.dynamictrees.error.get_tree": "Impossibile trovare specie arboree in posizione %s.", + "commands.dynamictrees.success.set_tree": "Impostare correttamente l'albero alla posizione %s sulla specie %s con JoCode %s.", + "commands.dynamictrees.success.kill_tree": "Albero ucciso con successo alla posizione %s.", + "commands.dynamictrees.error.unknown_species": "Specie sconosciuta %s.", + "commands.dynamictrees.success.get_fertility": "Fertilità dell'albero alla posizione %s è %s.", + "commands.dynamictrees.success.set_fertility": "Impostata con successo la fertilità dell'albero in posizione %s a %s.", + "commands.dynamictrees.success.grow_pulse": "Inviati con successo %s impulsi di crescita all'albero in posizione %s.", + "commands.dynamictrees.success.set_xor": "Coordinate Xor settate con successo a %s.", + "commands.dynamictrees.success.rotate_jo_code": "Rotazione JoCode: %s", + "commands.dynamictrees.error.species_equal": "Le specie volute sono le stesse delle specie date.", + "commands.dynamictrees.success.transform": "Specie trasformata con successo %s nella posizione %s in specie %s.", + "commands.dynamictrees.error.not_transformable": "Specie %s non è transformabile.", + "commands.dynamictrees.success.create_staff": "Staffa creata con successo con specie %s, codice %s, colore %s, sola lettura %s e max utilizzi %s in posizione %s.", + "commands.dynamictrees.success.create_transform_potion": "Pozione di trasformazione creata con successo per la specie %s in posizione %s.", + "commands.dynamictrees.success.clear_orphaned": "Cancellate con successo %s categorie orfane.", + "commands.dynamictrees.success.purge_trees": "Alberi %s eliminati con successo.", + + "potion.biochar.description": "Pozione per alberi base per fermentazione", + "potion.depletion.description": "Distrugge la fertilità del suolo degli alberi", + "potion.gigas.description": "Autorizza un albero a diventare gigante", + "potion.burgeoning.description": "Fa crescere velocemente un albero", + "potion.fertility.description": "Concima completamente il terreno dell' albero", + "potion.persistence.description": "Ferma il cambiamento dell'albero", + "potion.transform.description": "Trasforma l'albero in un albero %s", + "potion.transform.description.empty": "Pozione dell'albero base per le trasformazioni", + "potion.harvest.description": "Velocizza la produzione di frutti", + "potion.denuding.description": "Rimuove tutta la corteccia e le foglie dall'albero", + + "death.attack.falling_tree": "%1$s è stato schiacciato da un albero", + + "block.dynamictrees.rooty_water": "Radici acquatiche" +} diff --git a/src/generated/resources/assets/dynamictrees/lang/ko_kr.json b/src/generated/resources/assets/dynamictrees/lang/ko_kr.json new file mode 100644 index 000000000..939741ad7 --- /dev/null +++ b/src/generated/resources/assets/dynamictrees/lang/ko_kr.json @@ -0,0 +1,24 @@ +{ + "itemGroup.dynamictrees": "다이나믹 트리", + "block.dynamictrees.oak_branch": "참나무", + "block.dynamictrees.spruce_branch": "가문비나무", + "block.dynamictrees.birch_branch": "자작나무", + "block.dynamictrees.jungle_branch": "정글 나무", + "block.dynamictrees.dark_oak_branch": "검은 참나무", + "block.dynamictrees.acacia_branch": "아카시아 나무", + "item.dynamictrees.oak_seed": "참나무 도토리", + "item.dynamictrees.spruce_seed": "가문비나무 구과", + "item.dynamictrees.birch_seed": "자작나무 꽃차례", + "item.dynamictrees.jungle_seed": "정글 나무 꼬투리", + "item.dynamictrees.dark_oak_seed": "검은 참나무 도토리", + "item.dynamictrees.acacia_seed": "아카시아 나무 씨앗", + "item.dynamictrees.apple_oak_seed": "사과 씨앗", + "item.dynamictrees.dendro_potion.biochar": "바이오숯 포션", + "item.dynamictrees.dendro_potion.depletion": "고갈의 포션", + "item.dynamictrees.dendro_potion.burgeoning": "급성장의 포션", + "item.dynamictrees.dendro_potion.fertility": "풍요의 포션", + "item.dynamictrees.dendro_potion.persistence": "잔존의 포션", + "item.dynamictrees.dendro_potion.transform": "변화의 포션", + "item.dynamictrees.dirt_bucket": "흙 양동이", + "item.dynamictrees.staff": "자연의 지팡이" +} \ No newline at end of file diff --git a/src/generated/resources/assets/dynamictrees/lang/nl_nl.json b/src/generated/resources/assets/dynamictrees/lang/nl_nl.json new file mode 100644 index 000000000..6a0b2eec0 --- /dev/null +++ b/src/generated/resources/assets/dynamictrees/lang/nl_nl.json @@ -0,0 +1,54 @@ +{ + "itemGroup.dynamictrees": "Dynamic Trees", + "block.dynamictrees.oak_branch": "Eikenboom", + "block.dynamictrees.spruce_branch": "Sparreboom", + "block.dynamictrees.birch_branch": "Berkenboom", + "block.dynamictrees.jungle_branch": "Oerwoud Boom", + "block.dynamictrees.dark_oak_branch": "Donkere Eikenboom", + "block.dynamictrees.acacia_branch": "Acacia Boom", + "block.dynamictrees.crimson_branch": "Helrode Boom", + "block.dynamictrees.warped_branch": "Spookachtige Boom", + "species.dynamictrees.oak": "Eik", + "species.dynamictrees.swamp_oak": "Moeras Eik", + "species.dynamictrees.spruce": "Sparren", + "species.dynamictrees.mega_spruce": "Mega Sparren", + "species.dynamictrees.birch": "Berk", + "species.dynamictrees.tall_birch": "Hoge Berk", + "species.dynamictrees.jungle": "Oerwoud", + "species.dynamictrees.mega_jungle": "Mega Oerwoud", + "species.dynamictrees.dark_oak": "Donkere Eik", + "species.dynamictrees.acacia": "Acacia", + "species.dynamictrees.apple_oak": "Appel Eik", + "species.dynamictrees.crimson": "Helrood", + "species.dynamictrees.mega_crimson": "Mega Helrood", + "species.dynamictrees.warped": "Spookachtig", + "species.dynamictrees.mega_warped": "Mega Spookachtig", + "item.dynamictrees.oak_seed": "Eiken Eikel", + "item.dynamictrees.spruce_seed": "Sparren Kegel", + "item.dynamictrees.birch_seed": "Berken Katje", + "item.dynamictrees.jungle_seed": "Oerwoud Peul", + "item.dynamictrees.dark_oak_seed": "Donkere Eiken Eikel", + "item.dynamictrees.acacia_seed": "Acacia Zaad", + "item.dynamictrees.apple_oak_seed": "Appelpit", + "item.dynamictrees.crimson_seed": "Helrode Kap", + "item.dynamictrees.warped_seed": "Spookachtige Kap", + "item.dynamictrees.dendro_potion.biochar": "Biokool Basis Drank", + "item.dynamictrees.dendro_potion.depletion": "Drank van Uitputting", + "item.dynamictrees.dendro_potion.gigas": "Drank van Giganten", + "item.dynamictrees.dendro_potion.burgeoning": "Drank van Ontluiken", + "item.dynamictrees.dendro_potion.fertility": "Drank van Vruchtbaarheid", + "item.dynamictrees.dendro_potion.persistence": "Drank van Volharding", + "item.dynamictrees.dendro_potion.transform": "Drank van Transformatie", + "item.dynamictrees.dirt_bucket": "Aarden Emmer", + "item.dynamictrees.staff": "Bosland Staf", + "block.dynamictrees.potted_sapling": "Gepotte Jonge Boom", + "chat.registry_name": "Registreer Naam: %s", + "tooltip.dynamictrees.species": "Soort: %s", + "tooltip.dynamictrees.jo_code": "JoCode: %s", + "commands.dynamictrees.success.get_tree": "Soort: %s JoCode: %s", + "commands.dynamictrees.error.get_tree": "Kan niet de boom soort vinden op deze positie %s.", + "commands.dynamictrees.success.set_tree": "Succesvol de boom op de positie gezet %s to soort %s with JoCode %s.", + "commands.dynamictrees.success.kill_tree": "Succesvol de boom verwijderd op de positie %s.", + "commands.dynamictrees.error.unknown_species": "Onbekende Soort %s.", + "death.attack.falling_tree": "%1$s was verpletterd door een vallende boom" +} \ No newline at end of file diff --git a/src/generated/resources/assets/dynamictrees/lang/pl_pl.json b/src/generated/resources/assets/dynamictrees/lang/pl_pl.json new file mode 100644 index 000000000..d76af7bdb --- /dev/null +++ b/src/generated/resources/assets/dynamictrees/lang/pl_pl.json @@ -0,0 +1,71 @@ +{ + "itemGroup.dynamictrees": "Dynamic Trees", + "block.dynamictrees.oak_branch": "Dębowe", + "block.dynamictrees.spruce_branch": "Świerkowe", + "block.dynamictrees.birch_branch": "Brzozowe", + "block.dynamictrees.jungle_branch": "Dżunglowe", + "block.dynamictrees.dark_oak_branch": "Ciemnego Dębu", + "block.dynamictrees.acacia_branch": "Akacjowe", + "block.dynamictrees.crimson_branch": "Szkarłatny Trzon", + "block.dynamictrees.warped_branch": "Spaczony Trzon", + "species.dynamictrees.oak": "Dąb", + "species.dynamictrees.swamp_oak": "Dąb Bagienny", + "species.dynamictrees.spruce": "Świerk", + "species.dynamictrees.mega_spruce": "Wielki Świerk", + "species.dynamictrees.birch": "Brzoza", + "species.dynamictrees.tall_birch": "Wysoka Brzoza", + "species.dynamictrees.jungle": "Dżungla", + "species.dynamictrees.mega_jungle": "Wielka Dżungla", + "species.dynamictrees.dark_oak": "Ciemny Dąb", + "species.dynamictrees.acacia": "Akacja", + "species.dynamictrees.apple_oak": "Dąb Jabłkowy", + "species.dynamictrees.crimson": "Szkarłatny", + "species.dynamictrees.mega_crimson": "Wielki Szkarłatny", + "species.dynamictrees.warped": "Spaczony", + "species.dynamictrees.mega_warped": "Wielki Spaczony", + "item.dynamictrees.oak_seed": "Żołądź Dębowy", + "item.dynamictrees.spruce_seed": "Szyszka Świerkowa", + "item.dynamictrees.birch_seed": "Kotka Brzozowa", + "item.dynamictrees.jungle_seed": "Strąk Dżunglowy", + "item.dynamictrees.dark_oak_seed": "Żołądź Ciemnego Dębu", + "item.dynamictrees.acacia_seed": "Nasiono Akacji", + "item.dynamictrees.apple_oak_seed": "Jabłkowa Pestka", + "item.dynamictrees.crimson_seed": "Szkarłatny Kapelusz", + "item.dynamictrees.warped_seed": "Spaczony Kapelusz", + "item.dynamictrees.dendro_potion.biochar": "Mikstura Bazowa Biowęglowa", + "item.dynamictrees.dendro_potion.depletion": "Mikstura Uszczuplenia", + "item.dynamictrees.dendro_potion.gigas": "Mikstura Wielkości", + "item.dynamictrees.dendro_potion.burgeoning": "Mikstura Rozkwitu", + "item.dynamictrees.dendro_potion.fertility": "Mikstura Żyzności", + "item.dynamictrees.dendro_potion.persistence": "Mikstura Trwałości", + "item.dynamictrees.dendro_potion.transform": "Mikstura Transformacji", + "item.dynamictrees.dirt_bucket": "Wiaderko Ziemi", + "item.dynamictrees.staff": "Leśna Laska", + "chat.registry_name": "Nazwa Rejestru: %s", + "commands.dynamictrees.success.get_tree": "Nie można znaleźć gatunków drzew %s na pozycji %s.", + "commands.dynamictrees.success.set_tree": "Pomyślnie ustawiono drzewo na pozycji %s do gatunków %s z JoCode %s.", + "commands.dynamictrees.success.kill_tree": "Pomyślnie zabito drzewo na pozycji %s.", + "commands.dynamictrees.error.unknown_species": "Nieznany gatunek %s.", + "commands.dynamictrees.success.get_fertility": "Życie w glebie drzewa na pozycji %s jest %s.", + "commands.dynamictrees.success.set_fertility": "Pomyślnie ustawiono życie gleby drzewa na pozycji %s do %s.", + "commands.dynamictrees.success.grow_pulse": "Pomyślnie wysłane %s impulsy wzrostu na drzewo na pozycji %s.", + "commands.dynamictrees.success.set_xor": "Pomyślnie ustawiono współrzędne Xlub do %s.", + "commands.dynamictrees.success.rotate_jo_code": "Obrócony JoCode: %s", + "commands.dynamictrees.error.species_equal": "Gatunek docelowy jest taki sam, jak dany gatunek.", + "commands.dynamictrees.success.transform": "Gatunek pomyślnie przekształcony %s na pozycji %s do gatunku %s.", + "commands.dynamictrees.error.not_transformable": "Gatunek %s nie podlega transformacji.", + "commands.dynamictrees.success.create_staff": "Pomyślnie stworzono laskę z gatunku %s, kod %s, kolor %s, tylko do odczytu %s, i maksymalne zastosowania %s na pozycji %s.", + "commands.dynamictrees.success.create_transform_potion": "Pomyślnie stworzono miksturę transformacji dla gatunku %s na pozycji %s.", + "commands.dynamictrees.success.clear_orphaned": "Pomyślnie wyczyszczono %s samotne połączenia gałęzi.", + "commands.dynamictrees.success.purge_trees": "Pomyślnie wyczyszczono %s drzewa.", + "potion.biochar.description": "Bazowa drzewna mikstura do warzenia", + "potion.depletion.description": "Niszczy żyzność gleby drzew", + "potion.gigas.description": "Pozwala drzewu osiągnąć mega rozmiar", + "potion.burgeoning.description": "Szybko wyrasta drzewo", + "potion.fertility.description": "W pełni nawozi glebę drzewa", + "potion.persistence.description": "Powstrzymuje drzewo przed zmienianiem", + "potion.transform.description": "Przekształca drzewo w %s drzewo", + "potion.transform.description.empty": "Bazowa drzewna mikstura do transformacji warzenia", + "death.attack.falling_tree": "%1$s został zgnieciony przez spadające drzewo", + "block.dynamictrees.rooty_water": "Korzenie Wodne" +} \ No newline at end of file diff --git a/src/generated/resources/assets/dynamictrees/lang/ru_ru.json b/src/generated/resources/assets/dynamictrees/lang/ru_ru.json new file mode 100644 index 000000000..70d7cab5a --- /dev/null +++ b/src/generated/resources/assets/dynamictrees/lang/ru_ru.json @@ -0,0 +1,85 @@ +{ + "itemGroup.dynamictrees": "Динамические деревья", + "block.dynamictrees.oak_branch": "Дуб", + "block.dynamictrees.spruce_branch": "Ель", + "block.dynamictrees.birch_branch": "Берёза", + "block.dynamictrees.jungle_branch": "Тропическое дерево", + "block.dynamictrees.dark_oak_branch": "Тёмный дуб", + "block.dynamictrees.acacia_branch": "Акация", + "block.dynamictrees.crimson_branch": "Багровое дерево", + "block.dynamictrees.warped_branch": "Искажённое дерево", + "species.dynamictrees.oak": "Дуб", + "species.dynamictrees.swamp_oak": "Болотный дуб", + "species.dynamictrees.spruce": "Ель", + "species.dynamictrees.mega_spruce": "Мега ель", + "species.dynamictrees.birch": "Берёза", + "species.dynamictrees.tall_birch": "Высокая береза", + "species.dynamictrees.jungle": "Тропическое", + "species.dynamictrees.mega_jungle": "Мега тропическое", + "species.dynamictrees.dark_oak": "Тёмный дуб", + "species.dynamictrees.acacia": "Акация", + "species.dynamictrees.apple_oak": "Яблоня", + "species.dynamictrees.crimson": "Багровый", + "species.dynamictrees.mega_crimson": "Мега багровый", + "species.dynamictrees.warped": "Искажённый", + "species.dynamictrees.mega_warped": "Мега искажённый", + "item.dynamictrees.oak_seed": "Жёлудь дуба", + "item.dynamictrees.spruce_seed": "Еловая шишка", + "item.dynamictrees.birch_seed": "Березовая сережка", + "item.dynamictrees.jungle_seed": "Джунглевый стручок", + "item.dynamictrees.dark_oak_seed": "Жёлудь тёмного дуба", + "item.dynamictrees.acacia_seed": "Семя акации", + "item.dynamictrees.apple_oak_seed": "Яблочное зёрнышко", + "item.dynamictrees.crimson_seed": "Багровая шляпка", + "item.dynamictrees.warped_seed": "Искажённая шляпка", + "item.dynamictrees.dendro_potion.biochar": "Основное зелье", + "item.dynamictrees.dendro_potion.depletion": "Зелье истощения", + "item.dynamictrees.dendro_potion.gigas": "Зелье Гигаса", + "item.dynamictrees.dendro_potion.burgeoning": "Зелье роста", + "item.dynamictrees.dendro_potion.fertility": "Зелье плодородия", + "item.dynamictrees.dendro_potion.persistence": "Зелье стойкости", + "item.dynamictrees.dendro_potion.transform": "Зелье трансформации", + "item.dynamictrees.dendro_potion.harvest": "Зелье урожая", + "item.dynamictrees.dendro_potion.denuding": "Зелье оголения", + "item.dynamictrees.dirt_bucket": "Ведро грязи", + "item.dynamictrees.staff": "Лесной посох", + "block.dynamictrees.potted_sapling": "Саженец в горшке", + "chat.registry_name": "Имя в реестре: %s", + "tooltip.dynamictrees.species": "Вид: %s", + "tooltip.dynamictrees.fertility": "Плодородие: %s", + "tooltip.dynamictrees.jo_code": "JoCode: %s", + "tooltip.dynamictrees.force_planting": "Принудительная посадка: %s", + "tooltip.dynamictrees.seed_life_span": "Продолжительность жизни семян: %s", + "tooltip.dynamictrees.enabled": "Включено", + "commands.dynamictrees.success.get_tree": "Виды: %s JoCode: %s", + "commands.dynamictrees.error.get_tree": "Не удалось найти вид дерева на позиции %s.", + "commands.dynamictrees.success.set_tree": "Дерево на позиции %s успешно установлено в вид %s с JoCode %s.", + "commands.dynamictrees.success.kill_tree": "Дерево на позиции %s успешно уничтожено.", + "commands.dynamictrees.error.unknown_species": "Неизвестный вид %s.", + "commands.dynamictrees.success.get_fertility": "Плодородие дерева на позиции %s сейчас %s.", + "commands.dynamictrees.success.set_fertility": "Плодородие дерева на позиции %s успешно установлено на %s.", + "commands.dynamictrees.success.grow_pulse": "Успешно отправлено %s импульсов роста к дереву на позиции %s.", + "commands.dynamictrees.success.set_xor": "Координаты Xor успешно поставлены на %s", + "commands.dynamictrees.success.rotate_jo_code": "Повёрнут JoCode: %s", + "commands.dynamictrees.error.species_equal": "Изначальный вид такой же, как и новый вид.", + "commands.dynamictrees.success.transform": "Успешно трансформированн вид %s на позиции %s на вид %s.", + "commands.dynamictrees.error.not_transformable": "Вид %s нельзя трансформировать.", + "commands.dynamictrees.success.create_staff": "Успешно создан персонал с разновидностями %s, кодом %s, цветом %s, чтением только %s, и максимальными использованиями %s на позиции %s.", + "commands.dynamictrees.success.create_transform_potion": "Успешно создано зелье трансформации для вида %s на позиции %s.", + "commands.dynamictrees.success.clear_orphaned": "Успешно очищено %s отделённых ответвлений.", + "commands.dynamictrees.success.purge_trees": "Успешно очищено от %s деревьев.", + "potion.biochar.description": "Базовое зелье для зельеварения", + "potion.depletion.description": "Убирает удобрение почвы дерева", + "potion.gigas.description": "Позволяет дереву стать мега-размера", + "potion.burgeoning.description": "Быстрее вырастит дерево", + "potion.fertility.description": "Полностью удобряет почву дерева", + "potion.persistence.description": "Прекращает изменение дерева", + "potion.transform.description": "Трансформирует дерево в §a%s §7дерево", + "potion.transform.description.empty": "Базовое зелье для зелий трансформации", + "potion.harvest.description": "Ускоряет рост фруктов", + "potion.denuding.description": "Удаляет всю кору и листья с дерева", + "death.attack.falling_tree": "%1$s раздавлен(а) падающим деревом", + "block.dynamictrees.rooty_water": "Водные корни", + "species.dynamictrees.red_mushroom": "Red Mushroom", + "species.dynamictrees.brown_mushroom": "Brown Mushroom" +} \ No newline at end of file diff --git a/src/generated/resources/assets/dynamictrees/lang/sv_se.json b/src/generated/resources/assets/dynamictrees/lang/sv_se.json new file mode 100644 index 000000000..8f26637ad --- /dev/null +++ b/src/generated/resources/assets/dynamictrees/lang/sv_se.json @@ -0,0 +1,25 @@ +{ + "itemGroup.dynamictrees": "Dynamic Trees", + "block.dynamictrees.oak_branch": "Ekträd", + "block.dynamictrees.spruce_branch": "Granträd", + "block.dynamictrees.birch_branch": "Björkträd", + "block.dynamictrees.jungle_branch": "Djungelträd", + "block.dynamictrees.dark_oak_branch": "Mörkt ekträd", + "block.dynamictrees.acacia_branch": "Akaciaträd", + "item.dynamictrees.oak_seed": "Ekollon", + "item.dynamictrees.spruce_seed": "Grankotte", + "item.dynamictrees.birch_seed": "Björkhänge", + "item.dynamictrees.jungle_seed": "Djungelkapsel", + "item.dynamictrees.dark_oak_seed": "Mörkt ekollon", + "item.dynamictrees.acacia_seed": "Akaciafrö", + "item.dynamictrees.apple_oak_seed": "Äppelkärna", + "item.dynamictrees.dendro_potion.biochar": "Biokolsbrygdbas", + "item.dynamictrees.dendro_potion.depletion": "Exploateringsbrygd", + "item.dynamictrees.dendro_potion.burgeoning": "Snabbväxtlighetsbrygd", + "item.dynamictrees.dendro_potion.fertility": "Fertilitetsbrygd", + "item.dynamictrees.dendro_potion.persistence": "Beständighetsbrygd", + "item.dynamictrees.dendro_potion.transform": "Omvandlingsbrygd", + "item.dynamictrees.dirt_bucket": "Jordhink", + "item.dynamictrees.staff": "Skogsstav", + "death.attack.falling_tree": "%1$s krossades av ett fallande träd" +} \ No newline at end of file diff --git a/src/generated/resources/assets/dynamictrees/lang/uk_ua.json b/src/generated/resources/assets/dynamictrees/lang/uk_ua.json new file mode 100644 index 000000000..9f484007e --- /dev/null +++ b/src/generated/resources/assets/dynamictrees/lang/uk_ua.json @@ -0,0 +1,44 @@ +{ + "itemGroup.dynamictrees": "Динамічні дерева", + "block.dynamictrees.oak_branch": "Дуб", + "block.dynamictrees.spruce_branch": "Смерека", + "block.dynamictrees.birch_branch": "Береза", + "block.dynamictrees.jungle_branch": "Тропічне дерево", + "block.dynamictrees.dark_oak_branch": "Темний дуб", + "block.dynamictrees.acacia_branch": "Акація", + "species.dynamictrees.oak": "Дуб", + "species.dynamictrees.swamp_oak": "Болотний дуб", + "species.dynamictrees.spruce": "Ялина", + "species.dynamictrees.mega_spruce": "Мега ялина", + "species.dynamictrees.birch": "Береза", + "species.dynamictrees.jungle": "Тропічне", + "species.dynamictrees.mega_jungle": "Мега тропічне", + "species.dynamictrees.dark_oak": "Темный дуб", + "species.dynamictrees.acacia": "Акація", + "species.dynamictrees.apple_oak": "Яблуня", + "item.dynamictrees.oak_seed": "Жолудь дуба", + "item.dynamictrees.spruce_seed": "Шишка смереки", + "item.dynamictrees.birch_seed": "Березовий котик", + "item.dynamictrees.jungle_seed": "Стручок джунглів", + "item.dynamictrees.dark_oak_seed": "Жолудь темного дуба", + "item.dynamictrees.acacia_seed": "Насіння акації", + "item.dynamictrees.apple_oak_seed": "Яблучне зернятко", + "item.dynamictrees.dendro_potion.biochar": "Основне зілля", + "item.dynamictrees.dendro_potion.depletion": "Зілля виснаження", + "item.dynamictrees.dendro_potion.burgeoning": "Зілля росту", + "item.dynamictrees.dendro_potion.fertility": "Зілля родючості", + "item.dynamictrees.dendro_potion.persistence": "Зілля стійкості", + "item.dynamictrees.dendro_potion.transform": "Зілля перетворення", + "item.dynamictrees.dirt_bucket": "Відро бруду", + "item.dynamictrees.staff": "Лісовий посох", + "commands.dynamictrees.error.not_transformable": "Вид %s не може бути трансформований", + "potion.biochar.description": "Базове зілля для зіллєваріння", + "potion.depletion.description": "Прибирає удобрення ґрунту дерева", + "potion.gigas.description": "Дозволяє дереву стати мега-розміру", + "potion.burgeoning.description": "Швидше виростить дерево", + "potion.fertility.description": "Повністю удобрює ґрунт дерева", + "potion.persistence.description": "Припиняє зміну дерева", + "potion.transform.description": "Трансформує дерево у §a%s §7дерево", + "potion.transform.description.empty": "Базове зілля для зіль трансформації", + "death.attack.falling_tree": "%1$s розтрощений(на) падаючим деревом" +} \ No newline at end of file diff --git a/src/generated/resources/assets/dynamictrees/lang/zh_cn.json b/src/generated/resources/assets/dynamictrees/lang/zh_cn.json new file mode 100644 index 000000000..26a816330 --- /dev/null +++ b/src/generated/resources/assets/dynamictrees/lang/zh_cn.json @@ -0,0 +1,24 @@ +{ + "itemGroup.dynamictrees": "有活力的树", + "block.dynamictrees.oak_branch": "橡木", + "block.dynamictrees.spruce_branch": "云杉木", + "block.dynamictrees.birch_branch": "白桦木", + "block.dynamictrees.jungle_branch": "丛林木", + "block.dynamictrees.dark_oak_branch": "深色橡木", + "block.dynamictrees.acacia_branch": "金合欢木", + "item.dynamictrees.oak_seed": "橡子", + "item.dynamictrees.spruce_seed": "云杉球果", + "item.dynamictrees.birch_seed": "白桦絮", + "item.dynamictrees.jungle_seed": "丛林木荚", + "item.dynamictrees.dark_oak_seed": "深色橡子", + "item.dynamictrees.acacia_seed": "金合欢种子", + "item.dynamictrees.apple_oak_seed": "苹果仁", + "item.dynamictrees.dendro_potion.biochar": "木炭溶液", + "item.dynamictrees.dendro_potion.depletion": "枯竭药水", + "item.dynamictrees.dendro_potion.burgeoning": "生长药水", + "item.dynamictrees.dendro_potion.fertility": "肥沃药水", + "item.dynamictrees.dendro_potion.persistence": "定型药水", + "item.dynamictrees.dendro_potion.transform": "转生药水", + "item.dynamictrees.dirt_bucket": "泥桶", + "item.dynamictrees.staff": "森林之杖" +} \ No newline at end of file diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/acacia_leaves.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/acacia_leaves.json index 782e6bd24..9022a87e5 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/blocks/acacia_leaves.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/blocks/acacia_leaves.json @@ -47,10 +47,10 @@ "condition": "minecraft:table_bonus", "enchantment": "minecraft:fortune", "chances": [ - 0.05, - 0.0625, - 0.083333336, - 0.1 + 0.015625, + 0.03125, + 0.046875, + 0.0625 ] }, { diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/birch_leaves.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/birch_leaves.json index 84217c7f5..428af6722 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/blocks/birch_leaves.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/blocks/birch_leaves.json @@ -47,10 +47,10 @@ "condition": "minecraft:table_bonus", "enchantment": "minecraft:fortune", "chances": [ - 0.05, - 0.0625, - 0.083333336, - 0.1 + 0.015625, + 0.03125, + 0.046875, + 0.0625 ] }, { diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/dark_oak_leaves.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/dark_oak_leaves.json index a93bdf30b..28a10575e 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/blocks/dark_oak_leaves.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/blocks/dark_oak_leaves.json @@ -47,10 +47,10 @@ "condition": "minecraft:table_bonus", "enchantment": "minecraft:fortune", "chances": [ - 0.05, - 0.0625, - 0.083333336, - 0.1 + 0.015625, + 0.03125, + 0.046875, + 0.0625 ] }, { diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/jungle_leaves.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/jungle_leaves.json index 6520d9e2e..7a2ebe538 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/blocks/jungle_leaves.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/blocks/jungle_leaves.json @@ -47,11 +47,10 @@ "condition": "minecraft:table_bonus", "enchantment": "minecraft:fortune", "chances": [ - 0.025, - 0.027777778, + 0.015625, 0.03125, - 0.041666668, - 0.1 + 0.046875, + 0.0625 ] }, { diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/oak_leaves.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/oak_leaves.json index ceb4ff104..59ad55a0d 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/blocks/oak_leaves.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/blocks/oak_leaves.json @@ -47,10 +47,10 @@ "condition": "minecraft:table_bonus", "enchantment": "minecraft:fortune", "chances": [ - 0.05, - 0.0625, - 0.083333336, - 0.1 + 0.015625, + 0.03125, + 0.046875, + 0.0625 ] }, { diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/spruce_leaves.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/spruce_leaves.json index 9281aa8cc..e2694373b 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/blocks/spruce_leaves.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/blocks/spruce_leaves.json @@ -47,10 +47,10 @@ "condition": "minecraft:table_bonus", "enchantment": "minecraft:fortune", "chances": [ - 0.05, - 0.0625, - 0.083333336, - 0.1 + 0.015625, + 0.03125, + 0.046875, + 0.0625 ] }, { diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/acacia.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/acacia.json index 167e03fc7..7590d0ec5 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/acacia.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/acacia.json @@ -14,10 +14,10 @@ "condition": "minecraft:table_bonus", "enchantment": "minecraft:fortune", "chances": [ - 0.05, - 0.0625, - 0.083333336, - 0.1 + 0.015625, + 0.03125, + 0.046875, + 0.0625 ] }, { diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/birch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/birch.json index 167e03fc7..7590d0ec5 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/birch.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/birch.json @@ -14,10 +14,10 @@ "condition": "minecraft:table_bonus", "enchantment": "minecraft:fortune", "chances": [ - 0.05, - 0.0625, - 0.083333336, - 0.1 + 0.015625, + 0.03125, + 0.046875, + 0.0625 ] }, { diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/dark_oak.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/dark_oak.json index 167e03fc7..7590d0ec5 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/dark_oak.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/dark_oak.json @@ -14,10 +14,10 @@ "condition": "minecraft:table_bonus", "enchantment": "minecraft:fortune", "chances": [ - 0.05, - 0.0625, - 0.083333336, - 0.1 + 0.015625, + 0.03125, + 0.046875, + 0.0625 ] }, { diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/jungle.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/jungle.json index cea20b1be..7590d0ec5 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/jungle.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/jungle.json @@ -14,11 +14,10 @@ "condition": "minecraft:table_bonus", "enchantment": "minecraft:fortune", "chances": [ - 0.025, - 0.027777778, + 0.015625, 0.03125, - 0.041666668, - 0.1 + 0.046875, + 0.0625 ] }, { diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/oak.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/oak.json index 167e03fc7..7590d0ec5 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/oak.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/oak.json @@ -14,10 +14,10 @@ "condition": "minecraft:table_bonus", "enchantment": "minecraft:fortune", "chances": [ - 0.05, - 0.0625, - 0.083333336, - 0.1 + 0.015625, + 0.03125, + 0.046875, + 0.0625 ] }, { diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/spruce.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/spruce.json index 167e03fc7..7590d0ec5 100644 --- a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/spruce.json +++ b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/spruce.json @@ -14,10 +14,10 @@ "condition": "minecraft:table_bonus", "enchantment": "minecraft:fortune", "chances": [ - 0.05, - 0.0625, - 0.083333336, - 0.1 + 0.015625, + 0.03125, + 0.046875, + 0.0625 ] }, { diff --git a/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/LeavesProperties.java b/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/LeavesProperties.java index db6850a7b..a8742665e 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/LeavesProperties.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/LeavesProperties.java @@ -488,7 +488,7 @@ public AbstractBlock.Properties getDefaultBlockProperties(final Material materia /** * Chances for leaves to drop seeds. Used in data gen for loot tables. */ - private float[] seedDropChances = new float[]{0.05F, 0.0625F, 0.083333336F, 0.1F}; + private float[] seedDropChances = new float[]{0.015625F, 0.03125F, 0.046875F, 0.0625F}; public void setSeedDropChances(float[] seedDropChances) { this.seedDropChances = (float[]) seedDropChances; diff --git a/src/main/resources/trees/dynamictrees/leaves_properties/jungle.json b/src/main/resources/trees/dynamictrees/leaves_properties/jungle.json index 05a910dcb..a3cdb97dc 100755 --- a/src/main/resources/trees/dynamictrees/leaves_properties/jungle.json +++ b/src/main/resources/trees/dynamictrees/leaves_properties/jungle.json @@ -1,7 +1,4 @@ { "primitive_leaves": "minecraft:jungle_leaves", - "light_requirement": 12, - - "_comment": "Seed chances are for data gen only, changing these will NOT have an effect until data is regenerated.", - "seed_drop_chances": [ 0.025, 0.027777778, 0.03125, 0.041666668, 0.1 ] + "light_requirement": 12 } \ No newline at end of file From a59fc8facf50d62ed5dcfd178800946ee66c5549 Mon Sep 17 00:00:00 2001 From: harleyoconnor Date: Sat, 13 Aug 2022 12:03:22 +0100 Subject: [PATCH 09/17] Prevent fruit trees from dropping seeds by default --- gradle.properties | 2 +- .../resources/assets/dynamictrees/lang/de_de.json | 0 .../resources/assets/dynamictrees/lang/es_es.json | 0 .../resources/assets/dynamictrees/lang/es_mx.json | 0 .../resources/assets/dynamictrees/lang/fr_fr.json | 0 .../resources/assets/dynamictrees/lang/it_it.json | 0 .../resources/assets/dynamictrees/lang/ko_kr.json | 0 .../resources/assets/dynamictrees/lang/nl_nl.json | 0 .../resources/assets/dynamictrees/lang/pl_pl.json | 0 .../resources/assets/dynamictrees/lang/ru_ru.json | 0 .../resources/assets/dynamictrees/lang/sv_se.json | 0 .../resources/assets/dynamictrees/lang/uk_ua.json | 0 .../resources/assets/dynamictrees/lang/zh_cn.json | 0 .../loot_tables/blocks/acacia_leaves.json | 0 .../loot_tables/blocks/birch_leaves.json | 0 .../loot_tables/blocks/crimson_wart.json | 0 .../loot_tables/blocks/dark_oak_leaves.json | 0 .../loot_tables/blocks/jungle_leaves.json | 0 .../loot_tables/blocks/oak_leaves.json | 0 .../loot_tables/blocks/spruce_leaves.json | 0 .../loot_tables/blocks/warped_wart.json | 0 .../loot_tables/trees/branches/acacia.json | 0 .../loot_tables/trees/branches/birch.json | 0 .../loot_tables/trees/branches/crimson.json | 0 .../loot_tables/trees/branches/dark_oak.json | 0 .../loot_tables/trees/branches/jungle.json | 0 .../loot_tables/trees/branches/oak.json | 0 .../loot_tables/trees/branches/spruce.json | 0 .../trees/branches/stripped_acacia.json | 0 .../loot_tables/trees/branches/stripped_birch.json | 0 .../trees/branches/stripped_crimson.json | 0 .../trees/branches/stripped_dark_oak.json | 0 .../trees/branches/stripped_jungle.json | 0 .../loot_tables/trees/branches/stripped_oak.json | 0 .../trees/branches/stripped_spruce.json | 0 .../trees/branches/stripped_warped.json | 0 .../loot_tables/trees/branches/warped.json | 0 .../loot_tables/trees/leaves/acacia.json | 0 .../loot_tables/trees/leaves/birch.json | 0 .../loot_tables/trees/leaves/crimson.json | 0 .../loot_tables/trees/leaves/dark_oak.json | 0 .../loot_tables/trees/leaves/jungle.json | 0 .../dynamictrees/loot_tables/trees/leaves/oak.json | 0 .../loot_tables/trees/leaves/spruce.json | 0 .../loot_tables/trees/leaves/warped.json | 0 .../loot_tables/trees/voluntary/acacia.json | 0 .../loot_tables/trees/voluntary/apple_oak.json | 0 .../loot_tables/trees/voluntary/birch.json | 0 .../loot_tables/trees/voluntary/crimson.json | 0 .../loot_tables/trees/voluntary/dark_oak.json | 0 .../loot_tables/trees/voluntary/jungle.json | 0 .../loot_tables/trees/voluntary/oak.json | 0 .../loot_tables/trees/voluntary/spruce.json | 0 .../loot_tables/trees/voluntary/warped.json | 0 .../api/event/TransitionSaplingToTreeEvent.java | 0 .../data/provider/DTLootTableProvider.java | 0 .../ferreusveritas/dynamictrees/loot/DTLoot.java | 0 .../loot/condition/DTLootConditions.java | 0 .../loot/condition/SeasonalSeedDropChance.java | 0 .../loot/condition/SpeciesMatches.java | 0 .../loot/condition/VoluntarySeedDropChance.java | 0 .../dynamictrees/loot/entry/DTLootEntries.java | 0 .../loot/entry/ItemBySpeciesLootEntry.java | 0 .../dynamictrees/loot/entry/SeedItemLootEntry.java | 2 +- .../loot/function/DTLootFunctions.java | 0 .../dynamictrees/loot/function/MultiplyCount.java | 0 .../loot/function/MultiplyLogsCount.java | 0 .../loot/function/MultiplySticksCount.java | 0 .../resources/loader/SpeciesResourceLoader.java | 7 +++++-- .../ferreusveritas/dynamictrees/trees/Species.java | 14 ++++++++++++++ 70 files changed, 21 insertions(+), 4 deletions(-) mode change 100644 => 100755 src/generated/resources/assets/dynamictrees/lang/de_de.json mode change 100644 => 100755 src/generated/resources/assets/dynamictrees/lang/es_es.json mode change 100644 => 100755 src/generated/resources/assets/dynamictrees/lang/es_mx.json mode change 100644 => 100755 src/generated/resources/assets/dynamictrees/lang/fr_fr.json mode change 100644 => 100755 src/generated/resources/assets/dynamictrees/lang/it_it.json mode change 100644 => 100755 src/generated/resources/assets/dynamictrees/lang/ko_kr.json mode change 100644 => 100755 src/generated/resources/assets/dynamictrees/lang/nl_nl.json mode change 100644 => 100755 src/generated/resources/assets/dynamictrees/lang/pl_pl.json mode change 100644 => 100755 src/generated/resources/assets/dynamictrees/lang/ru_ru.json mode change 100644 => 100755 src/generated/resources/assets/dynamictrees/lang/sv_se.json mode change 100644 => 100755 src/generated/resources/assets/dynamictrees/lang/uk_ua.json mode change 100644 => 100755 src/generated/resources/assets/dynamictrees/lang/zh_cn.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/blocks/acacia_leaves.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/blocks/birch_leaves.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/blocks/crimson_wart.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/blocks/dark_oak_leaves.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/blocks/jungle_leaves.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/blocks/oak_leaves.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/blocks/spruce_leaves.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/blocks/warped_wart.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/branches/acacia.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/branches/birch.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/branches/crimson.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/branches/dark_oak.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/branches/jungle.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/branches/oak.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/branches/spruce.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_acacia.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_birch.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_crimson.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_dark_oak.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_jungle.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_oak.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_spruce.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_warped.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/branches/warped.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/acacia.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/birch.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/crimson.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/dark_oak.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/jungle.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/oak.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/spruce.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/warped.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/acacia.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/apple_oak.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/birch.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/crimson.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/dark_oak.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/jungle.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/oak.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/spruce.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/warped.json mode change 100644 => 100755 src/main/java/com/ferreusveritas/dynamictrees/api/event/TransitionSaplingToTreeEvent.java mode change 100644 => 100755 src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java mode change 100644 => 100755 src/main/java/com/ferreusveritas/dynamictrees/loot/DTLoot.java mode change 100644 => 100755 src/main/java/com/ferreusveritas/dynamictrees/loot/condition/DTLootConditions.java mode change 100644 => 100755 src/main/java/com/ferreusveritas/dynamictrees/loot/condition/SeasonalSeedDropChance.java mode change 100644 => 100755 src/main/java/com/ferreusveritas/dynamictrees/loot/condition/SpeciesMatches.java mode change 100644 => 100755 src/main/java/com/ferreusveritas/dynamictrees/loot/condition/VoluntarySeedDropChance.java mode change 100644 => 100755 src/main/java/com/ferreusveritas/dynamictrees/loot/entry/DTLootEntries.java mode change 100644 => 100755 src/main/java/com/ferreusveritas/dynamictrees/loot/entry/ItemBySpeciesLootEntry.java mode change 100644 => 100755 src/main/java/com/ferreusveritas/dynamictrees/loot/entry/SeedItemLootEntry.java mode change 100644 => 100755 src/main/java/com/ferreusveritas/dynamictrees/loot/function/DTLootFunctions.java mode change 100644 => 100755 src/main/java/com/ferreusveritas/dynamictrees/loot/function/MultiplyCount.java mode change 100644 => 100755 src/main/java/com/ferreusveritas/dynamictrees/loot/function/MultiplyLogsCount.java mode change 100644 => 100755 src/main/java/com/ferreusveritas/dynamictrees/loot/function/MultiplySticksCount.java diff --git a/gradle.properties b/gradle.properties index 4e35243fb..7a7f7355b 100755 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ modName=DynamicTrees modId=dynamictrees -modVersion=0.10.0-Beta-LR6 +modVersion=0.10.0-Beta-LR7 group=com.ferreusveritas.dynamictrees mcVersion=1.16.5 diff --git a/src/generated/resources/assets/dynamictrees/lang/de_de.json b/src/generated/resources/assets/dynamictrees/lang/de_de.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/assets/dynamictrees/lang/es_es.json b/src/generated/resources/assets/dynamictrees/lang/es_es.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/assets/dynamictrees/lang/es_mx.json b/src/generated/resources/assets/dynamictrees/lang/es_mx.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/assets/dynamictrees/lang/fr_fr.json b/src/generated/resources/assets/dynamictrees/lang/fr_fr.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/assets/dynamictrees/lang/it_it.json b/src/generated/resources/assets/dynamictrees/lang/it_it.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/assets/dynamictrees/lang/ko_kr.json b/src/generated/resources/assets/dynamictrees/lang/ko_kr.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/assets/dynamictrees/lang/nl_nl.json b/src/generated/resources/assets/dynamictrees/lang/nl_nl.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/assets/dynamictrees/lang/pl_pl.json b/src/generated/resources/assets/dynamictrees/lang/pl_pl.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/assets/dynamictrees/lang/ru_ru.json b/src/generated/resources/assets/dynamictrees/lang/ru_ru.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/assets/dynamictrees/lang/sv_se.json b/src/generated/resources/assets/dynamictrees/lang/sv_se.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/assets/dynamictrees/lang/uk_ua.json b/src/generated/resources/assets/dynamictrees/lang/uk_ua.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/assets/dynamictrees/lang/zh_cn.json b/src/generated/resources/assets/dynamictrees/lang/zh_cn.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/acacia_leaves.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/acacia_leaves.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/birch_leaves.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/birch_leaves.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/crimson_wart.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/crimson_wart.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/dark_oak_leaves.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/dark_oak_leaves.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/jungle_leaves.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/jungle_leaves.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/oak_leaves.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/oak_leaves.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/spruce_leaves.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/spruce_leaves.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/warped_wart.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/warped_wart.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/acacia.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/acacia.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/birch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/birch.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/crimson.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/crimson.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/dark_oak.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/dark_oak.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/jungle.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/jungle.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/oak.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/oak.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/spruce.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/spruce.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_acacia.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_acacia.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_birch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_birch.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_crimson.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_crimson.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_dark_oak.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_dark_oak.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_jungle.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_jungle.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_oak.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_oak.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_spruce.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_spruce.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_warped.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/stripped_warped.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/warped.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/branches/warped.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/acacia.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/acacia.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/birch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/birch.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/crimson.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/crimson.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/dark_oak.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/dark_oak.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/jungle.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/jungle.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/oak.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/oak.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/spruce.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/spruce.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/warped.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/leaves/warped.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/acacia.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/acacia.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/apple_oak.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/apple_oak.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/birch.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/birch.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/crimson.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/crimson.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/dark_oak.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/dark_oak.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/jungle.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/jungle.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/oak.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/oak.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/spruce.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/spruce.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/warped.json b/src/generated/resources/data/dynamictrees/loot_tables/trees/voluntary/warped.json old mode 100644 new mode 100755 diff --git a/src/main/java/com/ferreusveritas/dynamictrees/api/event/TransitionSaplingToTreeEvent.java b/src/main/java/com/ferreusveritas/dynamictrees/api/event/TransitionSaplingToTreeEvent.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java b/src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/DTLoot.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/DTLoot.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/DTLootConditions.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/DTLootConditions.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/SeasonalSeedDropChance.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/SeasonalSeedDropChance.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/SpeciesMatches.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/SpeciesMatches.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/VoluntarySeedDropChance.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/VoluntarySeedDropChance.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/DTLootEntries.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/DTLootEntries.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/ItemBySpeciesLootEntry.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/ItemBySpeciesLootEntry.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/SeedItemLootEntry.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/SeedItemLootEntry.java old mode 100644 new mode 100755 index af03ae3a9..4988bc2f9 --- a/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/SeedItemLootEntry.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/SeedItemLootEntry.java @@ -31,7 +31,7 @@ public LootPoolEntryType getType() { protected void createItemStack(Consumer stackConsumer, LootContext context) { final Species species = context.getParamOrNull(DTLootParameters.SPECIES); assert species != null; - stackConsumer.accept(species.getSeedStack(1)); + stackConsumer.accept(species.shouldDropSeeds() ? species.getSeedStack(1) : ItemStack.EMPTY); } public static StandaloneLootEntry.Builder lootTableSeedItem() { diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/function/DTLootFunctions.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/function/DTLootFunctions.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/function/MultiplyCount.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/function/MultiplyCount.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/function/MultiplyLogsCount.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/function/MultiplyLogsCount.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/function/MultiplySticksCount.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/function/MultiplySticksCount.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/ferreusveritas/dynamictrees/resources/loader/SpeciesResourceLoader.java b/src/main/java/com/ferreusveritas/dynamictrees/resources/loader/SpeciesResourceLoader.java index 2634753dd..44836a592 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/resources/loader/SpeciesResourceLoader.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/resources/loader/SpeciesResourceLoader.java @@ -81,7 +81,9 @@ public void registerAppliers () { .register("sapling_shape", VoxelShape.class, Species::setSaplingShape); // We need the sapling shape to know which parent smartmodel the sapling model should use. - this.gatherDataAppliers.register("sapling_shape", VoxelShape.class, Species::setSaplingShape); + this.gatherDataAppliers + .register("sapling_shape", VoxelShape.class, Species::setSaplingShape) + .register("drop_seeds", Boolean.class, Species::setDropSeeds); this.reloadAppliers .register("tapering", Float.class, Species::setTapering) @@ -110,7 +112,8 @@ public void registerAppliers () { .registerArrayApplier("features", GenFeatureConfiguration.class, Species::addGenFeature) .register("does_rot", Boolean.class, Species::setDoesRot) .registerListApplier("fruits", Fruit.class, Species::addFruits) - .registerListApplier("pods", Pod.class, Species::addPods); + .registerListApplier("pods", Pod.class, Species::addPods) + .register("drop_seeds", Boolean.class, Species::setDropSeeds); super.registerAppliers(); } diff --git a/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java b/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java index 58fce1290..e9a5512dc 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java @@ -303,6 +303,12 @@ private static DataResult read(ResourceLocation name) { */ protected Seed seed; + /** + * If non-null, overrides result of {@link #shouldDropSeeds}, preventing this species from dropping seeds from + * leaves if {@link com.ferreusveritas.dynamictrees.loot.entry.SeedItemLootEntry} is used. + */ + protected Boolean dropSeeds = null; + /** * A blockState that will turn itself into this tree */ @@ -2273,6 +2279,14 @@ public LootTable.Builder createVoluntaryDrops() { return DTLootTableProvider.createVoluntaryDrops(seed); } + public void setDropSeeds(boolean dropSeeds) { + this.dropSeeds = dropSeeds; + } + + public boolean shouldDropSeeds() { + return Optional.ofNullable(dropSeeds).orElse(!this.hasFruits()); + } + @Override public String toLoadDataString() { final RegistryHandler registryHandler = RegistryHandler.get(this.getRegistryName().getNamespace()); From 91308771fea08a69d1c1b271c859c16955ba76c5 Mon Sep 17 00:00:00 2001 From: harleyoconnor Date: Sat, 13 Aug 2022 12:09:23 +0100 Subject: [PATCH 10/17] Only generate leaves tables for selected mod ID --- gradle.properties | 2 +- .../dynamictrees/data/provider/DTLootTableProvider.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 7a7f7355b..a437803c6 100755 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ modName=DynamicTrees modId=dynamictrees -modVersion=0.10.0-Beta-LR7 +modVersion=0.10.0-Beta-LR8 group=com.ferreusveritas.dynamictrees mcVersion=1.16.5 diff --git a/src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java b/src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java index ad4dc1024..37d0b3e90 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java @@ -99,6 +99,9 @@ private void addTables() { .forEach(this::addBranchTable); LeavesProperties.REGISTRY.forEach(leavesProperties -> { + if (!leavesProperties.getRegistryName().getNamespace().equals(modId)) { + return; + } addLeavesBlockTable(leavesProperties); addLeavesTable(leavesProperties); }); From eea4a2b0d8f8e598988004a97ef6e56b1587a2c7 Mon Sep 17 00:00:00 2001 From: harleyoconnor Date: Sat, 13 Aug 2022 12:31:33 +0100 Subject: [PATCH 11/17] Fix growth substance --- .../systems/substances/GrowthSubstance.java | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/ferreusveritas/dynamictrees/systems/substances/GrowthSubstance.java b/src/main/java/com/ferreusveritas/dynamictrees/systems/substances/GrowthSubstance.java index 61137c199..0be58cb91 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/systems/substances/GrowthSubstance.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/systems/substances/GrowthSubstance.java @@ -10,23 +10,18 @@ public class GrowthSubstance implements SubstanceEffect { - private final int pulses; private final int ticksPerPulse; - private final int ticksPerParticlePulse = 8; + private final int ticksPerParticlePulse; private final boolean fillFertility; public GrowthSubstance() { - this(-1, 24); + this(24, 8, true); } - public GrowthSubstance(int pulses, int ticksPerPulse) { - this(pulses, ticksPerPulse, true); - } - - public GrowthSubstance(int pulses, int ticksPerPulse, boolean fillFertility) { - this.pulses = pulses; + public GrowthSubstance(int ticksPerPulse, int ticksPerParticlePulse, boolean fillFertility) { this.ticksPerPulse = ticksPerPulse; - this.fillFertility = fillFertility; + this.ticksPerParticlePulse = ticksPerParticlePulse; + this.fillFertility = fillFertility; } @Override @@ -43,12 +38,10 @@ public boolean apply(World world, BlockPos rootPos) { return true; } - private int pulseCount; - @Override public boolean update(World world, BlockPos rootPos, int deltaTicks, int fertility) { // Stop when fertility has depleted. - if (fertility <= 0 || this.pulseCount >= this.pulses) { + if (fertility <= 0) { return false; } @@ -59,7 +52,6 @@ public boolean update(World world, BlockPos rootPos, int deltaTicks, int fertili } else { if (deltaTicks % this.ticksPerPulse == 0) { TreeHelper.growPulse(world, rootPos); - this.pulseCount++; } } From 67aafcf91c0f9c0f24345dc7eab82857a83c90b0 Mon Sep 17 00:00:00 2001 From: harleyoconnor Date: Sat, 13 Aug 2022 12:54:47 +0100 Subject: [PATCH 12/17] Add data generators for fruit and pod blocks --- gradle.properties | 2 +- src/generated/resources/.cache/cache | 2 + .../loot_tables/blocks/apple_fruit.json | 0 .../loot_tables/blocks/cocoa.json | 0 .../data/provider/DTLootTableProvider.java | 72 ++++++++++++++++--- .../dynamictrees/systems/fruit/Fruit.java | 19 +++++ .../systems/fruit/FruitResourceLoader.java | 2 + .../dynamictrees/systems/pod/Pod.java | 19 +++++ .../systems/pod/PodResourceLoader.java | 2 + 9 files changed, 107 insertions(+), 11 deletions(-) rename src/{main => generated}/resources/data/dynamictrees/loot_tables/blocks/apple_fruit.json (100%) mode change 100755 => 100644 rename src/{main => generated}/resources/data/dynamictrees/loot_tables/blocks/cocoa.json (100%) mode change 100755 => 100644 diff --git a/gradle.properties b/gradle.properties index a437803c6..5b118fff7 100755 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ modName=DynamicTrees modId=dynamictrees -modVersion=0.10.0-Beta-LR8 +modVersion=0.10.0-Beta-LR9 group=com.ferreusveritas.dynamictrees mcVersion=1.16.5 diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index 60b008046..8c588409c 100755 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -94,7 +94,9 @@ e93499abbe31d9e789e29af06798a9caddc88e80 assets/dynamictrees/models/item/spruce_ f19f3fb00967e33d24bce3ac224ebe952e5d3cd4 assets/dynamictrees/models/item/warped_branch.json 6f06586da567331dbe6251acb1aa1a554de5cfa6 assets/dynamictrees/models/item/warped_seed.json 8ec8548bf39e74c89bd1af35ac15ed1f61df60e0 data/dynamictrees/loot_tables/blocks/acacia_leaves.json +308ad8fa0721389bbe9aa6c2cc472582f0ec38ba data/dynamictrees/loot_tables/blocks/apple_fruit.json bd755992edc0863661049241755d6d2d918d4254 data/dynamictrees/loot_tables/blocks/birch_leaves.json +1ef3c41711d46b5076f9871b5434eb45d0f9b745 data/dynamictrees/loot_tables/blocks/cocoa.json 2a9c0717ddf89f86514ef3e161f9679ccc7bee29 data/dynamictrees/loot_tables/blocks/crimson_wart.json ce5c5f799db7d83f546fee5351bd44670b160645 data/dynamictrees/loot_tables/blocks/dark_oak_leaves.json c2b3626fa1216775e5ca487a5d5249c204de8916 data/dynamictrees/loot_tables/blocks/jungle_leaves.json diff --git a/src/main/resources/data/dynamictrees/loot_tables/blocks/apple_fruit.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/apple_fruit.json old mode 100755 new mode 100644 similarity index 100% rename from src/main/resources/data/dynamictrees/loot_tables/blocks/apple_fruit.json rename to src/generated/resources/data/dynamictrees/loot_tables/blocks/apple_fruit.json diff --git a/src/main/resources/data/dynamictrees/loot_tables/blocks/cocoa.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/cocoa.json old mode 100755 new mode 100644 similarity index 100% rename from src/main/resources/data/dynamictrees/loot_tables/blocks/cocoa.json rename to src/generated/resources/data/dynamictrees/loot_tables/blocks/cocoa.json diff --git a/src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java b/src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java index 37d0b3e90..5aa111072 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java @@ -8,6 +8,8 @@ import com.ferreusveritas.dynamictrees.loot.entry.SeedItemLootEntry; import com.ferreusveritas.dynamictrees.loot.function.MultiplyLogsCount; import com.ferreusveritas.dynamictrees.loot.function.MultiplySticksCount; +import com.ferreusveritas.dynamictrees.systems.fruit.Fruit; +import com.ferreusveritas.dynamictrees.systems.pod.Pod; import com.ferreusveritas.dynamictrees.trees.Species; import com.ferreusveritas.dynamictrees.util.ResourceLocationUtils; import com.google.gson.Gson; @@ -15,6 +17,7 @@ import net.minecraft.advancements.criterion.EnchantmentPredicate; import net.minecraft.advancements.criterion.ItemPredicate; import net.minecraft.advancements.criterion.MinMaxBounds; +import net.minecraft.advancements.criterion.StatePropertiesPredicate; import net.minecraft.block.Block; import net.minecraft.data.DataGenerator; import net.minecraft.data.DirectoryCache; @@ -32,6 +35,7 @@ import net.minecraft.loot.LootTable; import net.minecraft.loot.LootTableManager; import net.minecraft.loot.RandomValueRange; +import net.minecraft.loot.conditions.BlockStateProperty; import net.minecraft.loot.conditions.ILootCondition; import net.minecraft.loot.conditions.MatchTool; import net.minecraft.loot.conditions.SurvivesExplosion; @@ -39,6 +43,7 @@ import net.minecraft.loot.functions.ExplosionDecay; import net.minecraft.loot.functions.SetCount; import net.minecraft.resources.ResourcePackType; +import net.minecraft.state.IntegerProperty; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.registries.ForgeRegistries; @@ -85,12 +90,7 @@ public void run(DirectoryCache cache) { } private void addTables() { - Species.REGISTRY.forEach(species -> { - if (!species.getRegistryName().getNamespace().equals(modId)) { - return; - } - addVoluntaryTable(species); - }); + Species.REGISTRY.dataGenerationStream(modId).forEach(this::addVoluntaryTable); ForgeRegistries.BLOCKS.getValues().stream() .filter(block -> block instanceof BranchBlock) @@ -98,13 +98,13 @@ private void addTables() { .filter(block -> block.getRegistryName().getNamespace().equals(modId)) .forEach(this::addBranchTable); - LeavesProperties.REGISTRY.forEach(leavesProperties -> { - if (!leavesProperties.getRegistryName().getNamespace().equals(modId)) { - return; - } + LeavesProperties.REGISTRY.dataGenerationStream(modId).forEach(leavesProperties -> { addLeavesBlockTable(leavesProperties); addLeavesTable(leavesProperties); }); + + Fruit.REGISTRY.dataGenerationStream(modId).forEach(this::addFruitBlockTable); + Pod.REGISTRY.dataGenerationStream(modId).forEach(this::addPodBlockTable); } private void addVoluntaryTable(Species species) { @@ -143,6 +143,24 @@ private void addLeavesTable(LeavesProperties leavesProperties) { } } + private void addFruitBlockTable(Fruit fruit) { + if (fruit.shouldGenerateBlockDrops()) { + final ResourceLocation fruitBlockTablePath = getFullDropsPath(fruit.getBlockDropsPath()); + if (!existingFileHelper.exists(fruitBlockTablePath, ResourcePackType.SERVER_DATA)) { + lootTables.put(fruitBlockTablePath, fruit.createBlockDrops()); + } + } + } + + private void addPodBlockTable(Pod pod) { + if (pod.shouldGenerateBlockDrops()) { + final ResourceLocation fruitBlockTablePath = getFullDropsPath(pod.getBlockDropsPath()); + if (!existingFileHelper.exists(fruitBlockTablePath, ResourcePackType.SERVER_DATA)) { + lootTables.put(fruitBlockTablePath, pod.createBlockDrops()); + } + } + } + private ResourceLocation getFullDropsPath(ResourceLocation path) { return ResourceLocationUtils.surround(path, "loot_tables/", ".json"); } @@ -232,6 +250,40 @@ public static LootTable.Builder createBranchDrops(Block primitiveLogBlock, Item ).setParamSet(DTLootParameterSets.BRANCHES); } + public static LootTable.Builder createFruitDrops(Block fruitBlock, Item fruitItem, IntegerProperty ageProperty, int matureAge) { + return LootTable.lootTable().withPool( + LootPool.lootPool().setRolls(ConstantRange.exactly(1)).add( + ItemLootEntry.lootTableItem(fruitItem) + .when( + BlockStateProperty.hasBlockStateProperties(fruitBlock) + .setProperties( + StatePropertiesPredicate.Builder.properties() + .hasProperty(ageProperty, matureAge) + ) + ) + ) + ).apply(ExplosionDecay.explosionDecay()).setParamSet(LootParameterSets.BLOCK); + } + + public static LootTable.Builder createPodDrops(Block podBlock, Item podItem, IntegerProperty ageProperty, int matureAge) { + return LootTable.lootTable().withPool( + LootPool.lootPool().setRolls(ConstantRange.exactly(1)).add( + ItemLootEntry.lootTableItem(podItem) + .apply( + SetCount.setCount(ConstantRange.exactly(3)) + .when( + BlockStateProperty.hasBlockStateProperties(podBlock) + .setProperties( + StatePropertiesPredicate.Builder.properties() + .hasProperty(ageProperty, matureAge) + ) + ) + ) + .apply(ExplosionDecay.explosionDecay()) + ) + ).setParamSet(LootParameterSets.BLOCK); + } + private void writeTables(DirectoryCache cache) { Path outputFolder = this.generator.getOutputFolder(); lootTables.forEach((key, lootTable) -> { diff --git a/src/main/java/com/ferreusveritas/dynamictrees/systems/fruit/Fruit.java b/src/main/java/com/ferreusveritas/dynamictrees/systems/fruit/Fruit.java index c3c392343..c726e8bc7 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/systems/fruit/Fruit.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/systems/fruit/Fruit.java @@ -6,10 +6,13 @@ import com.ferreusveritas.dynamictrees.blocks.FruitBlock; import com.ferreusveritas.dynamictrees.blocks.GrowableBlock; import com.ferreusveritas.dynamictrees.compat.seasons.SeasonHelper; +import com.ferreusveritas.dynamictrees.data.provider.DTLootTableProvider; import com.ferreusveritas.dynamictrees.init.DTConfigs; import com.ferreusveritas.dynamictrees.init.DTTrees; import com.ferreusveritas.dynamictrees.trees.Resettable; import com.ferreusveritas.dynamictrees.util.AgeProperties; +import com.ferreusveritas.dynamictrees.util.LazyValue; +import com.ferreusveritas.dynamictrees.util.ResourceLocationUtils; import com.ferreusveritas.dynamictrees.util.WorldContext; import net.minecraft.block.AbstractBlock; import net.minecraft.block.Block; @@ -18,6 +21,7 @@ import net.minecraft.block.material.Material; import net.minecraft.block.material.MaterialColor; import net.minecraft.item.ItemStack; +import net.minecraft.loot.LootTable; import net.minecraft.state.IntegerProperty; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.ResourceLocation; @@ -289,6 +293,21 @@ public void setMatureAction(GrowableBlock.MatureAction matureAction) { this.matureAction = matureAction; } + public boolean shouldGenerateBlockDrops() { + return true; + } + + private final LazyValue blockDropsPath = LazyValue.supplied(() -> + ResourceLocationUtils.prefix(block.getRegistryName(), "blocks/")); + + public ResourceLocation getBlockDropsPath() { + return blockDropsPath.get(); + } + + public LootTable.Builder createBlockDrops() { + return DTLootTableProvider.createFruitDrops(block, itemStack.getItem(), ageProperty, maxAge); + } + @Nonnull @Override public Fruit reset() { diff --git a/src/main/java/com/ferreusveritas/dynamictrees/systems/fruit/FruitResourceLoader.java b/src/main/java/com/ferreusveritas/dynamictrees/systems/fruit/FruitResourceLoader.java index 0a9907996..3c59a9def 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/systems/fruit/FruitResourceLoader.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/systems/fruit/FruitResourceLoader.java @@ -34,6 +34,8 @@ public void registerAppliers() { fruit.setBlockShapes(list.toArray(new VoxelShape[0])) ); + this.gatherDataAppliers.register("item_stack", ItemStack.class, Fruit::setItemStack); + this.reloadAppliers .register("can_bone_meal", Boolean.class, Fruit::setCanBoneMeal) .register("item_stack", ItemStack.class, Fruit::setItemStack) diff --git a/src/main/java/com/ferreusveritas/dynamictrees/systems/pod/Pod.java b/src/main/java/com/ferreusveritas/dynamictrees/systems/pod/Pod.java index 8d9a212d1..71558de7d 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/systems/pod/Pod.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/systems/pod/Pod.java @@ -6,10 +6,13 @@ import com.ferreusveritas.dynamictrees.blocks.GrowableBlock; import com.ferreusveritas.dynamictrees.blocks.PodBlock; import com.ferreusveritas.dynamictrees.compat.seasons.SeasonHelper; +import com.ferreusveritas.dynamictrees.data.provider.DTLootTableProvider; import com.ferreusveritas.dynamictrees.init.DTConfigs; import com.ferreusveritas.dynamictrees.init.DTTrees; import com.ferreusveritas.dynamictrees.trees.Resettable; import com.ferreusveritas.dynamictrees.util.AgeProperties; +import com.ferreusveritas.dynamictrees.util.LazyValue; +import com.ferreusveritas.dynamictrees.util.ResourceLocationUtils; import com.ferreusveritas.dynamictrees.util.WorldContext; import com.google.common.collect.Maps; import net.minecraft.block.AbstractBlock; @@ -20,6 +23,7 @@ import net.minecraft.block.material.Material; import net.minecraft.block.material.MaterialColor; import net.minecraft.item.ItemStack; +import net.minecraft.loot.LootTable; import net.minecraft.state.IntegerProperty; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction; @@ -323,6 +327,21 @@ public void setMatureAction(GrowableBlock.MatureAction matureAction) { this.matureAction = matureAction; } + public boolean shouldGenerateBlockDrops() { + return true; + } + + private final LazyValue blockDropsPath = LazyValue.supplied(() -> + ResourceLocationUtils.prefix(block.getRegistryName(), "blocks/")); + + public ResourceLocation getBlockDropsPath() { + return blockDropsPath.get(); + } + + public LootTable.Builder createBlockDrops() { + return DTLootTableProvider.createPodDrops(block, itemStack.getItem(), ageProperty, maxAge); + } + @Nonnull @Override public Pod reset() { diff --git a/src/main/java/com/ferreusveritas/dynamictrees/systems/pod/PodResourceLoader.java b/src/main/java/com/ferreusveritas/dynamictrees/systems/pod/PodResourceLoader.java index b92eb035f..25cadcf92 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/systems/pod/PodResourceLoader.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/systems/pod/PodResourceLoader.java @@ -38,6 +38,8 @@ public void registerAppliers() { this.commonAppliers .register("block_shapes", JsonObject.class, this::readBlockShapes); + this.gatherDataAppliers.register("item_stack", ItemStack.class, Pod::setItemStack); + this.reloadAppliers .register("can_bone_meal", Boolean.class, Pod::setCanBoneMeal) .register("item_stack", ItemStack.class, Pod::setItemStack) From 1b714a8bbb7577a96a7443dd27778ff922c10651 Mon Sep 17 00:00:00 2001 From: harleyoconnor Date: Sun, 14 Aug 2022 11:10:19 +0100 Subject: [PATCH 13/17] Add palm leaves drop generators --- gradle.properties | 2 +- .../blocks/leaves/LeavesProperties.java | 2 +- .../blocks/leaves/PalmLeavesProperties.java | 17 +++++++++++++++ .../data/provider/DTLootTableProvider.java | 21 +++++++++++++++++++ 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 5b118fff7..bd9fa5ce1 100755 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ modName=DynamicTrees modId=dynamictrees -modVersion=0.10.0-Beta-LR9 +modVersion=0.10.0-Beta-LR10 group=com.ferreusveritas.dynamictrees mcVersion=1.16.5 diff --git a/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/LeavesProperties.java b/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/LeavesProperties.java index a8742665e..6745ff7ea 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/LeavesProperties.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/LeavesProperties.java @@ -488,7 +488,7 @@ public AbstractBlock.Properties getDefaultBlockProperties(final Material materia /** * Chances for leaves to drop seeds. Used in data gen for loot tables. */ - private float[] seedDropChances = new float[]{0.015625F, 0.03125F, 0.046875F, 0.0625F}; + protected float[] seedDropChances = new float[]{0.015625F, 0.03125F, 0.046875F, 0.0625F}; public void setSeedDropChances(float[] seedDropChances) { this.seedDropChances = (float[]) seedDropChances; diff --git a/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/PalmLeavesProperties.java b/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/PalmLeavesProperties.java index e8fb3f99b..b44266ce5 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/PalmLeavesProperties.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/PalmLeavesProperties.java @@ -2,12 +2,16 @@ import com.ferreusveritas.dynamictrees.api.registry.TypedRegistry; import com.ferreusveritas.dynamictrees.blocks.branches.BranchBlock; +import com.ferreusveritas.dynamictrees.data.provider.DTLootTableProvider; +import com.ferreusveritas.dynamictrees.loot.DTLootParameterSets; import com.ferreusveritas.dynamictrees.trees.Species; import com.ferreusveritas.dynamictrees.util.CoordUtils; import net.minecraft.block.AbstractBlock; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; +import net.minecraft.loot.LootParameterSets; +import net.minecraft.loot.LootTable; import net.minecraft.state.IntegerProperty; import net.minecraft.state.StateContainer; import net.minecraft.util.Direction; @@ -116,4 +120,17 @@ public VoxelShape getOcclusionShape(BlockState state, IBlockReader world, BlockP } + @Override + public LootTable.Builder createBlockDrops() { + if (primitiveLeaves != null && getPrimitiveLeavesBlock().isPresent()) { + return DTLootTableProvider.createPalmLeavesBlockDrops(primitiveLeaves.getBlock(), seedDropChances); + } + return DTLootTableProvider.createPalmLeavesDrops(seedDropChances, LootParameterSets.BLOCK); + } + + @Override + public LootTable.Builder createDrops() { + return DTLootTableProvider.createPalmLeavesDrops(seedDropChances, DTLootParameterSets.LEAVES); + } + } diff --git a/src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java b/src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java index 5aa111072..1b9bfbad3 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java @@ -184,6 +184,16 @@ public static LootTable.Builder createLeavesBlockDrops(Block primitiveLeavesBloc ).setParamSet(LootParameterSets.BLOCK); } + public static LootTable.Builder createPalmLeavesBlockDrops(Block primitiveLeavesBlock, float[] seedChances) { + return BlockLootTables.createSilkTouchOrShearsDispatchTable( + primitiveLeavesBlock, + SeedItemLootEntry.lootTableSeedItem() + .when(SurvivesExplosion.survivesExplosion()) + .when(TableBonus.bonusLevelFlatChance(Enchantments.BLOCK_FORTUNE, seedChances)) + .when(SeasonalSeedDropChance.seasonalSeedDropChance()) + ).setParamSet(LootParameterSets.BLOCK); + } + public static LootTable.Builder createWartBlockDrops(Block primitiveWartBlock) { return LootTable.lootTable().withPool( LootPool.lootPool().setRolls(ConstantRange.exactly(1)) @@ -214,6 +224,17 @@ public static LootTable.Builder createLeavesDrops(float[] seedChances, LootParam ).setParamSet(parameterSet); } + public static LootTable.Builder createPalmLeavesDrops(float[] seedChances, LootParameterSet parameterSet) { + return LootTable.lootTable().withPool( + LootPool.lootPool().setRolls(ConstantRange.exactly(1)).add( + SeedItemLootEntry.lootTableSeedItem() + .when(SurvivesExplosion.survivesExplosion()) + .when(TableBonus.bonusLevelFlatChance(Enchantments.BLOCK_FORTUNE, seedChances)) + .when(SeasonalSeedDropChance.seasonalSeedDropChance()) + ) + ).setParamSet(parameterSet); + } + public static LootTable.Builder createWartDrops(Block primitiveWartBlock) { return LootTable.lootTable().withPool( LootPool.lootPool().setRolls(ConstantRange.exactly(1)) From 2eb97d98d0399b358dc35463afa88d7673a831bd Mon Sep 17 00:00:00 2001 From: Harleyoc1 Date: Sun, 21 Aug 2022 11:24:26 +0100 Subject: [PATCH 14/17] Add universal seed drop rate config option --- .../com/ferreusveritas/dynamictrees/init/DTConfigs.java | 7 +++++-- .../loot/condition/SeasonalSeedDropChance.java | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/ferreusveritas/dynamictrees/init/DTConfigs.java b/src/main/java/com/ferreusveritas/dynamictrees/init/DTConfigs.java index 9a6a00aed..d370c4d3b 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/init/DTConfigs.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/init/DTConfigs.java @@ -25,6 +25,7 @@ public class DTConfigs { public static final ForgeConfigSpec CLIENT_CONFIG; public static final ForgeConfigSpec.DoubleValue SEED_DROP_RATE; + public static final ForgeConfigSpec.DoubleValue VOLUNTARY_SEED_DROP_RATE; public static final ForgeConfigSpec.DoubleValue SEED_PLANT_RATE; public static final ForgeConfigSpec.IntValue SEED_TIME_TO_LIVE; public static final ForgeConfigSpec.BooleanValue SEED_ONLY_FOREST; @@ -86,8 +87,10 @@ public class DTConfigs { final ForgeConfigSpec.Builder CLIENT_BUILDER = new ForgeConfigSpec.Builder(); SERVER_BUILDER.comment("Seed Settings").push("seeds"); - SEED_DROP_RATE = SERVER_BUILDER.comment("The rate at which seeds voluntarily drop from branches"). - defineInRange("seedDropRate", 0.01, 0.0, 1.0); + SEED_DROP_RATE = SERVER_BUILDER.comment("The rate at which seeds drop from leaves."). + defineInRange("seedDropRate", 1.0, 0.0, 64.0); + VOLUNTARY_SEED_DROP_RATE = SERVER_BUILDER.comment("The rate at which seeds voluntarily drop from branches"). + defineInRange("voluntarySeedDropRate", 0.01, 0.0, 1.0); SEED_PLANT_RATE = SERVER_BUILDER.comment("The rate at which seeds voluntarily plant themselves in their ideal biomes"). defineInRange("seedPlantRate", 1f / 6f, 0.0, 1.0); SEED_TIME_TO_LIVE = SERVER_BUILDER.comment("Ticks before a seed in the world attempts to plant itself or despawn. 1200 = 1 minute"). diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/SeasonalSeedDropChance.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/SeasonalSeedDropChance.java index bb295c5f8..f4f5c2038 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/SeasonalSeedDropChance.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/SeasonalSeedDropChance.java @@ -1,5 +1,6 @@ package com.ferreusveritas.dynamictrees.loot.condition; +import com.ferreusveritas.dynamictrees.init.DTConfigs; import com.ferreusveritas.dynamictrees.loot.DTLootParameters; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonObject; @@ -27,7 +28,7 @@ public LootConditionType getType() { public boolean test(LootContext context) { final Float seasonalSeedDropFactor = context.getParamOrNull(DTLootParameters.SEASONAL_SEED_DROP_FACTOR); assert seasonalSeedDropFactor != null; - return seasonalSeedDropFactor > context.getRandom().nextFloat(); + return DTConfigs.SEED_DROP_RATE.get() * seasonalSeedDropFactor > context.getRandom().nextFloat(); } public static ILootCondition.IBuilder seasonalSeedDropChance() { From 8b704118487e9c62cc43f8bf269ea7441ac5e301 Mon Sep 17 00:00:00 2001 From: Harleyoc1 Date: Sun, 21 Aug 2022 11:55:47 +0100 Subject: [PATCH 15/17] Add species override tables --- .../loot_tables/blocks/apple_fruit.json | 0 .../loot_tables/blocks/cocoa.json | 0 .../blocks/branches/BasicBranchBlock.java | 24 ++++++--- .../blocks/branches/BranchBlock.java | 28 +++++++---- .../blocks/branches/ThickBranchBlock.java | 9 ++-- .../blocks/leaves/DynamicLeavesBlock.java | 15 +++--- .../blocks/leaves/LeavesProperties.java | 31 ++++++++---- .../data/provider/DTLootTableProvider.java | 4 +- .../condition/VoluntarySeedDropChance.java | 2 +- .../dynamictrees/trees/Family.java | 49 ++++++++----------- .../dynamictrees/trees/Species.java | 2 +- .../dynamictrees/util/LootTableSupplier.java | 41 ++++++++++++++++ 12 files changed, 134 insertions(+), 71 deletions(-) mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/blocks/apple_fruit.json mode change 100644 => 100755 src/generated/resources/data/dynamictrees/loot_tables/blocks/cocoa.json create mode 100644 src/main/java/com/ferreusveritas/dynamictrees/util/LootTableSupplier.java diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/apple_fruit.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/apple_fruit.json old mode 100644 new mode 100755 diff --git a/src/generated/resources/data/dynamictrees/loot_tables/blocks/cocoa.json b/src/generated/resources/data/dynamictrees/loot_tables/blocks/cocoa.json old mode 100644 new mode 100755 diff --git a/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BasicBranchBlock.java b/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BasicBranchBlock.java index 743f54e48..070ea7ccf 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BasicBranchBlock.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BasicBranchBlock.java @@ -28,6 +28,7 @@ import net.minecraft.state.StateContainer; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; @@ -61,17 +62,26 @@ public class BasicBranchBlock extends BranchBlock implements IWaterLoggable { private final int maxRadiusForWaterLogging = 7; //the maximum radius for a branch to be allowed to be water logged - public BasicBranchBlock(Material material) { - this(AbstractBlock.Properties.of(material).sound(SoundType.WOOD), RADIUS, MAX_RADIUS); + /** + * @param name name of branch, without a {@code _branch} suffix + */ + public BasicBranchBlock(ResourceLocation name, Material material) { + this(name, AbstractBlock.Properties.of(material).sound(SoundType.WOOD), RADIUS, MAX_RADIUS); } - public BasicBranchBlock(Properties properties) { - this(properties, RADIUS, MAX_RADIUS); + /** + * @param name name of branch, without a {@code _branch} suffix + */ + public BasicBranchBlock(ResourceLocation name, Properties properties) { + this(name, properties, RADIUS, MAX_RADIUS); } - // Useful for more unique subclasses - public BasicBranchBlock(AbstractBlock.Properties properties, final IntegerProperty radiusProperty, final int maxRadius) { - super(properties); + /** + * @param name name of branch, without a {@code _branch} suffix + */ + public BasicBranchBlock(ResourceLocation name, AbstractBlock.Properties properties, IntegerProperty radiusProperty, + int maxRadius) { + super(name, properties); // Create branch state cache. this.branchStates = this.createBranchStates(radiusProperty, maxRadius); diff --git a/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BranchBlock.java b/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BranchBlock.java index fd6bce37f..4bb5998de 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BranchBlock.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BranchBlock.java @@ -23,7 +23,7 @@ import com.ferreusveritas.dynamictrees.util.BlockStates; import com.ferreusveritas.dynamictrees.util.BranchDestructionData; import com.ferreusveritas.dynamictrees.util.Connections; -import com.ferreusveritas.dynamictrees.util.LazyValue; +import com.ferreusveritas.dynamictrees.util.LootTableSupplier; import com.ferreusveritas.dynamictrees.util.ResourceLocationUtils; import com.ferreusveritas.dynamictrees.util.SimpleVoxmap; import com.ferreusveritas.dynamictrees.util.SimpleVoxmap.Cell; @@ -41,6 +41,7 @@ import net.minecraft.item.AxeItem; import net.minecraft.item.ItemStack; import net.minecraft.loot.LootTable; +import net.minecraft.loot.LootTableManager; import net.minecraft.pathfinding.PathType; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ActionResultType; @@ -87,12 +88,19 @@ public abstract class BranchBlock extends BlockWithDynamicHardness implements Tr private ItemStack[] primitiveLogDrops = new ItemStack[]{}; private boolean canBeStripped; - public BranchBlock(Material material) { - this(Properties.of(material)); + /** + * @param name name of branch, without a {@code _branch} suffix + */ + public BranchBlock(ResourceLocation name, Material material) { + this(name, Properties.of(material)); } - public BranchBlock(Properties properties) { + /** + * @param name name of branch, without a {@code _branch} suffix + */ + public BranchBlock(ResourceLocation name, Properties properties) { super(properties); //removes drops from block + lootTableSupplier = new LootTableSupplier("trees/branches/", name); } public BranchBlock setCanBeStripped(boolean truth) { @@ -491,14 +499,14 @@ public boolean canFall() { // DROPS AND HARVESTING /////////////////////////////////////////// - private final LazyValue lootTableName = - LazyValue.supplied(() -> ResourceLocationUtils.prefix( - ResourceLocationUtils.removeSuffix(getRegistryName(), "_branch"), - "trees/branches/" - )); + private final LootTableSupplier lootTableSupplier; public ResourceLocation getLootTableName() { - return lootTableName.get(); + return lootTableSupplier.getName(); + } + + public LootTable getLootTable(LootTableManager lootTableManager, Species species) { + return lootTableSupplier.get(lootTableManager, species); } public LootTable.Builder createBranchDrops() { diff --git a/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/ThickBranchBlock.java b/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/ThickBranchBlock.java index da3088bf8..74ff5ac22 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/ThickBranchBlock.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/ThickBranchBlock.java @@ -13,6 +13,7 @@ import net.minecraft.state.IntegerProperty; import net.minecraft.state.StateContainer; import net.minecraft.util.Direction; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; @@ -32,12 +33,12 @@ public class ThickBranchBlock extends BasicBranchBlock implements Musable { protected static final IntegerProperty RADIUS_DOUBLE = IntegerProperty.create("radius", 1, MAX_RADIUS_THICK); //39 ? - public ThickBranchBlock(Material material) { - this(Properties.of(material)); + public ThickBranchBlock(ResourceLocation name, Material material) { + this(name, Properties.of(material)); } - public ThickBranchBlock(Properties properties) { - super(properties, RADIUS_DOUBLE, MAX_RADIUS_THICK); + public ThickBranchBlock(ResourceLocation name, Properties properties) { + super(name, properties, RADIUS_DOUBLE, MAX_RADIUS_THICK); } public TrunkShellBlock getTrunkShell() { diff --git a/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/DynamicLeavesBlock.java b/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/DynamicLeavesBlock.java index 7005672d0..9033fba20 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/DynamicLeavesBlock.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/DynamicLeavesBlock.java @@ -614,31 +614,30 @@ public List getDrops(@Nullable PlayerEntity player, ItemStack item, W @Override public List getDrops(BlockState state, LootContext.Builder builder) { final Vector3d originPos = builder.getOptionalParameter(LootParameters.ORIGIN); - final ResourceLocation lootTableName; + final LootTable lootTable; Species species = Species.NULL_SPECIES; BlockPos pos = BlockPos.ZERO; + ServerWorld world = builder.getLevel(); if (originPos == null) { - lootTableName = getLootTable(); + lootTable = world.getServer().getLootTables().get(getLootTable()); } else { pos = new BlockPos(originPos.x(), originPos.y(), originPos.z()); LeavesProperties leavesProperties = getProperties(state); - lootTableName = leavesProperties.getBlockDropsPath(); - species = getExactSpecies(builder.getLevel(), pos, leavesProperties); + species = getExactSpecies(world, pos, leavesProperties); + lootTable = leavesProperties.getBlockLootTable(world.getServer().getLootTables(), species); } - if (lootTableName == LootTables.EMPTY) { + if (lootTable.getLootTableId() == LootTables.EMPTY) { return Collections.emptyList(); } else { - ServerWorld world = builder.getLevel(); LootContext context = builder .withParameter(LootParameters.BLOCK_STATE, state) .withParameter(DTLootParameters.SPECIES, species) .withParameter(DTLootParameters.SEASONAL_SEED_DROP_FACTOR, species.seasonalSeedDropFactor(WorldContext.create(world), pos)) .create(LootParameterSets.BLOCK); - LootTable table = world.getServer().getLootTables().get(lootTableName); - return table.getRandomItems(context); + return lootTable.getRandomItems(context); } } diff --git a/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/LeavesProperties.java b/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/LeavesProperties.java index 6745ff7ea..8be745261 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/LeavesProperties.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/blocks/leaves/LeavesProperties.java @@ -20,7 +20,7 @@ import com.ferreusveritas.dynamictrees.trees.Resettable; import com.ferreusveritas.dynamictrees.trees.Species; import com.ferreusveritas.dynamictrees.util.BlockStates; -import com.ferreusveritas.dynamictrees.util.LazyValue; +import com.ferreusveritas.dynamictrees.util.LootTableSupplier; import com.ferreusveritas.dynamictrees.util.MutableLazyValue; import com.ferreusveritas.dynamictrees.util.Optionals; import com.ferreusveritas.dynamictrees.util.ResourceLocationUtils; @@ -45,6 +45,7 @@ import net.minecraft.loot.LootParameterSets; import net.minecraft.loot.LootParameters; import net.minecraft.loot.LootTable; +import net.minecraft.loot.LootTableManager; import net.minecraft.tags.ITag; import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; @@ -183,6 +184,8 @@ public boolean updateTick(World worldIn, BlockPos pos, BlockState state, Random protected boolean canBeSheared = true; private LeavesProperties() { + this.blockLootTableSupplier = new LootTableSupplier("null/", DTTrees.NULL); + this.lootTableSupplier = new LootTableSupplier("null/", DTTrees.NULL); } public LeavesProperties(final ResourceLocation registryName) { @@ -199,6 +202,8 @@ public LeavesProperties(@Nullable final BlockState primitiveLeaves, final CellKi this.cellKit = cellKit; this.setRegistryName(registryName); this.blockRegistryName = ResourceLocationUtils.suffix(registryName, this.getBlockRegistryNameSuffix()); + this.blockLootTableSupplier = new LootTableSupplier("blocks/", blockRegistryName); + this.lootTableSupplier = new LootTableSupplier("trees/leaves/", registryName); } /////////////////////////////////////////// @@ -502,11 +507,14 @@ public void setSeedDropChances(Collection seedDropChances) { } } - private final LazyValue blockDropsPath = LazyValue.supplied(() -> - ResourceLocationUtils.prefix(blockRegistryName, "blocks/")); + private final LootTableSupplier blockLootTableSupplier; - public ResourceLocation getBlockDropsPath() { - return blockDropsPath.get(); + public ResourceLocation getBlockLootTableName() { + return blockLootTableSupplier.getName(); + } + + public LootTable getBlockLootTable(LootTableManager lootTableManager, Species species) { + return blockLootTableSupplier.get(lootTableManager, species); } public boolean shouldGenerateBlockDrops() { @@ -520,11 +528,14 @@ public LootTable.Builder createBlockDrops() { return DTLootTableProvider.createLeavesDrops(seedDropChances, LootParameterSets.BLOCK); } - private final LazyValue dropsPath = LazyValue.supplied(() -> - ResourceLocationUtils.prefix(getRegistryName(), "trees/leaves/")); + private final LootTableSupplier lootTableSupplier; + + public ResourceLocation getLootTableName() { + return lootTableSupplier.getName(); + } - public ResourceLocation getDropsPath() { - return dropsPath.get(); + public LootTable getLootTable(LootTableManager lootTableManager, Species species) { + return lootTableSupplier.get(lootTableManager, species); } public boolean shouldGenerateDrops() { @@ -539,7 +550,7 @@ public List getDrops(World world, BlockPos pos, ItemStack tool, Speci if (world.isClientSide) { return Collections.emptyList(); } - return world.getServer().getLootTables().get(getDropsPath()) + return getLootTable(world.getServer().getLootTables(), species) .getRandomItems(createLootContext(world, pos, tool, species)); } diff --git a/src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java b/src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java index 1b9bfbad3..06e6f5104 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/data/provider/DTLootTableProvider.java @@ -127,7 +127,7 @@ private void addBranchTable(BranchBlock branchBlock) { private void addLeavesBlockTable(LeavesProperties leavesProperties) { if (leavesProperties.shouldGenerateBlockDrops()) { - final ResourceLocation leavesBlockTablePath = getFullDropsPath(leavesProperties.getBlockDropsPath()); + final ResourceLocation leavesBlockTablePath = getFullDropsPath(leavesProperties.getBlockLootTableName()); if (!existingFileHelper.exists(leavesBlockTablePath, ResourcePackType.SERVER_DATA)) { lootTables.put(leavesBlockTablePath, leavesProperties.createBlockDrops()); } @@ -136,7 +136,7 @@ private void addLeavesBlockTable(LeavesProperties leavesProperties) { private void addLeavesTable(LeavesProperties leavesProperties) { if (leavesProperties.shouldGenerateDrops()) { - final ResourceLocation leavesTablePath = getFullDropsPath(leavesProperties.getDropsPath()); + final ResourceLocation leavesTablePath = getFullDropsPath(leavesProperties.getLootTableName()); if (!existingFileHelper.exists(leavesTablePath, ResourcePackType.SERVER_DATA)) { lootTables.put(leavesTablePath, leavesProperties.createDrops()); } diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/VoluntarySeedDropChance.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/VoluntarySeedDropChance.java index 48de53d8f..66e306b9f 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/VoluntarySeedDropChance.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/condition/VoluntarySeedDropChance.java @@ -31,7 +31,7 @@ public LootConditionType getType() { public boolean test(LootContext context) { final Float seasonalSeedDropFactor = context.getParamOrNull(DTLootParameters.SEASONAL_SEED_DROP_FACTOR); assert seasonalSeedDropFactor != null; - return rarity * DTConfigs.SEED_DROP_RATE.get() * seasonalSeedDropFactor > context.getRandom().nextFloat(); + return rarity * DTConfigs.VOLUNTARY_SEED_DROP_RATE.get() * seasonalSeedDropFactor > context.getRandom().nextFloat(); } public static ILootCondition.IBuilder voluntarySeedDropChance() { diff --git a/src/main/java/com/ferreusveritas/dynamictrees/trees/Family.java b/src/main/java/com/ferreusveritas/dynamictrees/trees/Family.java index 830bd9f4b..4b77eaedc 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/trees/Family.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/trees/Family.java @@ -212,11 +212,11 @@ public Family(ResourceLocation name) { } public void setupBlocks() { - this.setBranch(this.createBranch()); - this.setBranchItem(this.createBranchItem(this.getBranchRegName(""), this.branch)); + this.setBranch(this.createBranch(this.getBranchName())); + this.setBranchItem(this.createBranchItem(this.getBranchName(), this.branch)); if (this.hasStrippedBranch()) { - this.setStrippedBranch(this.createBranch(this.getBranchRegName("stripped_"))); + this.setStrippedBranch(this.createBranch(this.getBranchName("stripped_"))); } if (this.hasSurfaceRoot()) { @@ -355,24 +355,12 @@ public boolean isWood() { return true; } - /** - * Creates the branch block. Can be overridden by sub-classes who want full control over registry and instantiation - * of the branch. - * - * @return The instantiated and registered {@link BranchBlock}. - */ - public BranchBlock createBranch() { - return this.createBranch(this.getBranchRegName("")); + protected ResourceLocation getBranchName() { + return getBranchName(""); } - /** - * Gets a branch name with the given prefix and _branch as the suffix. - * - * @param prefix The prefix. - * @return The {@link ResourceLocation} registry name for the branch. - */ - protected ResourceLocation getBranchRegName(final String prefix) { - return suffix(prefix(this.getRegistryName(), prefix), BranchBlock.NAME_SUFFIX); + protected ResourceLocation getBranchName(final String prefix) { + return prefix(this.getRegistryName(), prefix); } /** @@ -381,8 +369,9 @@ protected ResourceLocation getBranchRegName(final String prefix) { * * @return The instantiated {@link BranchBlock}. */ - protected BranchBlock createBranchBlock() { - final BasicBranchBlock branch = this.isThick() ? new ThickBranchBlock(this.getProperties()) : new BasicBranchBlock(this.getProperties()); + protected BranchBlock createBranchBlock(ResourceLocation name) { + final BasicBranchBlock branch = this.isThick() ? new ThickBranchBlock(name, this.getProperties()) : + new BasicBranchBlock(name, this.getProperties()); if (this.isFireProof()) { branch.setFireSpreadSpeed(0).setFlammability(0); } @@ -392,22 +381,26 @@ protected BranchBlock createBranchBlock() { /** * Creates branch block and adds it to the relevant {@link RegistryHandler}. * - * @param registryName The {@link ResourceLocation} registry name. + * @param name The {@link ResourceLocation} registry name. * @return The created {@link BranchBlock}. */ - protected BranchBlock createBranch(final ResourceLocation registryName) { - return RegistryHandler.addBlock(registryName, this.createBranchBlock()); + protected BranchBlock createBranch(final ResourceLocation name) { + return RegistryHandler.addBlock(suffix(name, getBranchNameSuffix()), this.createBranchBlock(name)); + } + + protected String getBranchNameSuffix() { + return BranchBlock.NAME_SUFFIX; } /** * Creates and registers a {@link BlockItem} for the given branch with the given registry name. * - * @param registryName The {@link ResourceLocation} registry name for the item. - * @param branch The {@link BranchBlock} to create the {@link BlockItem} for. + * @param name the name of the branch to create an item for + * @param branch the {@link BranchBlock} to create the {@link BlockItem} for * @return The created and registered {@link BlockItem} object. */ - public BlockItem createBranchItem(final ResourceLocation registryName, final BranchBlock branch) { - return RegistryHandler.addItem(registryName, new BlockItem(branch, new Item.Properties())); + public BlockItem createBranchItem(final ResourceLocation name, final BranchBlock branch) { + return RegistryHandler.addItem(suffix(name, getBranchNameSuffix()), new BlockItem(branch, new Item.Properties())); } protected Family setBranch(final BranchBlock branch) { diff --git a/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java b/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java index e9a5512dc..4540ed6db 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java @@ -815,7 +815,7 @@ public List getBranchesDrops(World world, NetVolumeNode.Volume volume private List getDropsForBranchType(World world, ItemStack tool, @Nullable Float explosionRadius, int branchVolume, BranchBlock branchBlock) { - return world.getServer().getLootTables().get(branchBlock.getLootTableName()) + return branchBlock.getLootTable(world.getServer().getLootTables(), this) .getRandomItems(createBranchesLootContext(world, branchVolume, tool, explosionRadius)); } diff --git a/src/main/java/com/ferreusveritas/dynamictrees/util/LootTableSupplier.java b/src/main/java/com/ferreusveritas/dynamictrees/util/LootTableSupplier.java new file mode 100644 index 000000000..d707ff7f9 --- /dev/null +++ b/src/main/java/com/ferreusveritas/dynamictrees/util/LootTableSupplier.java @@ -0,0 +1,41 @@ +package com.ferreusveritas.dynamictrees.util; + +import com.ferreusveritas.dynamictrees.trees.Species; +import net.minecraft.loot.LootTable; +import net.minecraft.loot.LootTableManager; +import net.minecraft.util.ResourceLocation; + +/** + * @author Harley O'Connor + */ +public final class LootTableSupplier { + + private final String path; + private final ResourceLocation name; + private final ResourceLocation baseName; + + public LootTableSupplier(String basePath, ResourceLocation name) { + this.path = basePath; + this.name = name; + this.baseName = ResourceLocationUtils.prefix(name, path); + } + + public LootTable get(LootTableManager lootTableManager, Species species) { + final LootTable speciesOverrideTable = lootTableManager.get(getName(species)); + if (speciesOverrideTable != LootTable.EMPTY) { + return speciesOverrideTable; + } + return lootTableManager.get(baseName); + } + + public ResourceLocation getName(Species species) { + final ResourceLocation speciesName = species.getRegistryName(); + return ResourceLocationUtils.surround(name, path, "/" + speciesName.getNamespace() + "/" + speciesName.getPath()); + } + + public ResourceLocation getName() { + return baseName; + } + + +} From 81723a8ce23618859ea07b256455dd4f7b7f8068 Mon Sep 17 00:00:00 2001 From: Harleyoc1 Date: Wed, 24 Aug 2022 17:57:25 +0100 Subject: [PATCH 16/17] Add weighted item loot entry --- gradle.properties | 2 +- .../rootyblocks/WaterSoilProperties.java | 4 + .../dynamictrees/init/DTConfigs.java | 4 +- .../loot/entry/DTLootEntries.java | 3 + .../loot/entry/WeightedItemLootEntry.java | 78 +++++++++++++++++++ .../dynamictrees/trees/Species.java | 6 +- .../resources/META-INF/accesstransformer.cfg | 4 +- 7 files changed, 96 insertions(+), 5 deletions(-) create mode 100644 src/main/java/com/ferreusveritas/dynamictrees/loot/entry/WeightedItemLootEntry.java diff --git a/gradle.properties b/gradle.properties index bd9fa5ce1..590d8c79a 100755 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ modName=DynamicTrees modId=dynamictrees -modVersion=0.10.0-Beta-LR10 +modVersion=0.10.0-Beta-LR13 group=com.ferreusveritas.dynamictrees mcVersion=1.16.5 diff --git a/src/main/java/com/ferreusveritas/dynamictrees/blocks/rootyblocks/WaterSoilProperties.java b/src/main/java/com/ferreusveritas/dynamictrees/blocks/rootyblocks/WaterSoilProperties.java index 7d99b3557..7a186a79c 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/blocks/rootyblocks/WaterSoilProperties.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/blocks/rootyblocks/WaterSoilProperties.java @@ -98,21 +98,25 @@ public VoxelShape getShape(BlockState state, IBlockReader world, BlockPos pos, I return VoxelShapes.create(WATER_ROOTS_AABB); } + @SuppressWarnings("deprecation") @Override public VoxelShape getBlockSupportShape(BlockState state, IBlockReader reader, BlockPos pos) { return VoxelShapes.empty(); } + @SuppressWarnings("deprecation") @Override public boolean canBeReplaced(BlockState state, BlockItemUseContext useContext) { return false; } + @SuppressWarnings("deprecation") @Override public FluidState getFluidState(BlockState state) { return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); } + @SuppressWarnings("deprecation") @Override public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn, BlockPos currentPos, BlockPos facingPos) { if (stateIn.getValue(WATERLOGGED)) { diff --git a/src/main/java/com/ferreusveritas/dynamictrees/init/DTConfigs.java b/src/main/java/com/ferreusveritas/dynamictrees/init/DTConfigs.java index d370c4d3b..94fc734d8 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/init/DTConfigs.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/init/DTConfigs.java @@ -88,9 +88,9 @@ public class DTConfigs { SERVER_BUILDER.comment("Seed Settings").push("seeds"); SEED_DROP_RATE = SERVER_BUILDER.comment("The rate at which seeds drop from leaves."). - defineInRange("seedDropRate", 1.0, 0.0, 64.0); + defineInRange("leavesSeedDropRate", 1.0, 0.0, 64.0); VOLUNTARY_SEED_DROP_RATE = SERVER_BUILDER.comment("The rate at which seeds voluntarily drop from branches"). - defineInRange("voluntarySeedDropRate", 0.01, 0.0, 1.0); + defineInRange("seedDropRate", 0.01, 0.0, 1.0); SEED_PLANT_RATE = SERVER_BUILDER.comment("The rate at which seeds voluntarily plant themselves in their ideal biomes"). defineInRange("seedPlantRate", 1f / 6f, 0.0, 1.0); SEED_TIME_TO_LIVE = SERVER_BUILDER.comment("Ticks before a seed in the world attempts to plant itself or despawn. 1200 = 1 minute"). diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/DTLootEntries.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/DTLootEntries.java index cb63bd0a0..9b2139726 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/DTLootEntries.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/DTLootEntries.java @@ -16,6 +16,9 @@ public final class DTLootEntries { public static LootPoolEntryType SEED_ITEM = register("dynamictrees:seed_item", new SeedItemLootEntry.Serializer()); + public static LootPoolEntryType WEIGHTED_ITEM = + register("dynamictrees:weighted_item", new WeightedItemLootEntry.Serializer()); + private static LootPoolEntryType register(String name, ILootSerializer serializer) { return Registry.register(Registry.LOOT_POOL_ENTRY_TYPE, new ResourceLocation(name), new LootPoolEntryType(serializer)); } diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/WeightedItemLootEntry.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/WeightedItemLootEntry.java new file mode 100644 index 000000000..6fe26afcb --- /dev/null +++ b/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/WeightedItemLootEntry.java @@ -0,0 +1,78 @@ +package com.ferreusveritas.dynamictrees.loot.entry; + +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSyntaxException; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.loot.LootContext; +import net.minecraft.loot.LootPoolEntryType; +import net.minecraft.loot.StandaloneLootEntry; +import net.minecraft.loot.conditions.ILootCondition; +import net.minecraft.loot.functions.ILootFunction; +import net.minecraft.util.JSONUtils; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.WeightedList; +import net.minecraftforge.registries.ForgeRegistries; + +import java.util.Map; +import java.util.Optional; +import java.util.function.Consumer; + +/** + * @author Harley O'Connor + */ +public final class WeightedItemLootEntry extends StandaloneLootEntry { + + private final WeightedList items; + + public WeightedItemLootEntry(WeightedList items, int weight, int quality, ILootCondition[] conditions, + ILootFunction[] functions) { + super(weight, quality, conditions, functions); + this.items = items; + } + + @Override + public LootPoolEntryType getType() { + return DTLootEntries.WEIGHTED_ITEM; + } + + @Override + protected void createItemStack(Consumer stackConsumer, LootContext lootContext) { + stackConsumer.accept(new ItemStack(items.getOne(lootContext.getRandom()))); + } + + public static StandaloneLootEntry.Builder weightedLootTableItem(WeightedList items) { + return simpleBuilder((weight, quality, conditions, functions) -> + new WeightedItemLootEntry(items, weight, quality, conditions, functions) + ); + } + + public static class Serializer extends StandaloneLootEntry.Serializer { + public void serializeCustom(JsonObject json, WeightedItemLootEntry value, JsonSerializationContext conditions) { + super.serializeCustom(json, value, conditions); + JsonObject weightedItemsJson = new JsonObject(); + value.items.entries.forEach(entry -> + weightedItemsJson.addProperty(String.valueOf(entry.data.getRegistryName()), entry.weight) + ); + json.add("items", weightedItemsJson); + } + + protected WeightedItemLootEntry deserialize(JsonObject json, JsonDeserializationContext context, int weight, + int quality, ILootCondition[] conditions, ILootFunction[] functions) { + JsonObject weightedItemsJson = JSONUtils.getAsJsonObject(json, "items"); + WeightedList items = new WeightedList<>(); + for (Map.Entry itemEntry : weightedItemsJson.entrySet()) { + String name = itemEntry.getKey(); + Item item = Optional.ofNullable(ForgeRegistries.ITEMS.getValue(new ResourceLocation(name))) + .orElseThrow(() -> new JsonSyntaxException("Expected key to be an item, was unknown string '" + name + "'")); + int itemWeight = JSONUtils.convertToInt(itemEntry.getValue(), name); + items.add(item, itemWeight); + } + return new WeightedItemLootEntry(items, weight, quality, conditions, functions); + } + } + +} diff --git a/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java b/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java index 4540ed6db..a4a848617 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/trees/Species.java @@ -797,7 +797,7 @@ public List getBranchesDrops(World world, NetVolumeNode.Volume volume public List getBranchesDrops(World world, NetVolumeNode.Volume volume, ItemStack tool, @Nullable Float explosionRadius) { - volume.multiplyVolume(DTConfigs.TREE_HARVEST_MULTIPLIER.get()); // For cheaters.. you know who you are. + processVolume(volume); if (world.isClientSide) { return Collections.emptyList(); } @@ -813,6 +813,10 @@ public List getBranchesDrops(World world, NetVolumeNode.Volume volume return drops; } + protected void processVolume(NetVolumeNode.Volume volume) { + volume.multiplyVolume(DTConfigs.TREE_HARVEST_MULTIPLIER.get()); // For cheaters.. you know who you are. + } + private List getDropsForBranchType(World world, ItemStack tool, @Nullable Float explosionRadius, int branchVolume, BranchBlock branchBlock) { return branchBlock.getLootTable(world.getServer().getLootTables(), this) diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index 6380497c0..c6b432ab4 100755 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -35,4 +35,6 @@ public net.minecraft.world.gen.feature.jigsaw.JigsawPattern field_214953_e # tem public net.minecraft.data.loot.BlockLootTables func_218535_c(Lnet/minecraft/block/Block;Lnet/minecraft/loot/LootEntry$Builder;)Lnet/minecraft/loot/LootTable$Builder; # createSilkTouchOrShearsDispatchTable public net.minecraft.data.loot.BlockLootTables func_218560_a(Lnet/minecraft/util/IItemProvider;Lnet/minecraft/loot/ILootConditionConsumer;)Ljava/lang/Object; # applyExplosionCondition -public net.minecraft.data.loot.BlockLootTables func_218552_a(Lnet/minecraft/util/IItemProvider;Lnet/minecraft/loot/ILootFunctionConsumer;)Ljava/lang/Object; # applyExplosionDecay \ No newline at end of file +public net.minecraft.data.loot.BlockLootTables func_218552_a(Lnet/minecraft/util/IItemProvider;Lnet/minecraft/loot/ILootFunctionConsumer;)Ljava/lang/Object; # applyExplosionDecay + +public net.minecraft.util.WeightedList$Entry field_220652_c # weight \ No newline at end of file From ac42921c975b6b173ef387b5149a173a5e6c99d2 Mon Sep 17 00:00:00 2001 From: Harley Date: Sat, 27 Aug 2022 15:45:14 +0100 Subject: [PATCH 17/17] Fix branch harvest tool block property being overriden by Family class --- gradle.properties | 2 +- .../blocks/branches/BasicBranchBlock.java | 26 +++++-------------- .../blocks/branches/BranchBlock.java | 19 +++++--------- .../loot/entry/WeightedItemLootEntry.java | 0 .../dynamictrees/trees/Family.java | 14 ---------- .../dynamictrees/util/LootTableSupplier.java | 0 6 files changed, 15 insertions(+), 46 deletions(-) mode change 100644 => 100755 src/main/java/com/ferreusveritas/dynamictrees/loot/entry/WeightedItemLootEntry.java mode change 100644 => 100755 src/main/java/com/ferreusveritas/dynamictrees/util/LootTableSupplier.java diff --git a/gradle.properties b/gradle.properties index 590d8c79a..3c9d1564c 100755 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ modName=DynamicTrees modId=dynamictrees -modVersion=0.10.0-Beta-LR13 +modVersion=0.10.0-Beta-LR14 group=com.ferreusveritas.dynamictrees mcVersion=1.16.5 diff --git a/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BasicBranchBlock.java b/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BasicBranchBlock.java index 070ea7ccf..8acc7ec3d 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BasicBranchBlock.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BasicBranchBlock.java @@ -2,8 +2,8 @@ import com.ferreusveritas.dynamictrees.DynamicTrees; import com.ferreusveritas.dynamictrees.api.TreeHelper; -import com.ferreusveritas.dynamictrees.api.cells.CellNull; import com.ferreusveritas.dynamictrees.api.cells.Cell; +import com.ferreusveritas.dynamictrees.api.cells.CellNull; import com.ferreusveritas.dynamictrees.api.network.MapSignal; import com.ferreusveritas.dynamictrees.api.treedata.TreePart; import com.ferreusveritas.dynamictrees.blocks.leaves.DynamicLeavesBlock; @@ -15,7 +15,12 @@ import com.ferreusveritas.dynamictrees.trees.Family; import com.ferreusveritas.dynamictrees.trees.Species; import com.ferreusveritas.dynamictrees.util.CoordUtils; -import net.minecraft.block.*; +import net.minecraft.block.AbstractBlock; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.block.IWaterLoggable; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; @@ -39,7 +44,6 @@ import net.minecraft.world.IWorld; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; -import net.minecraftforge.common.ToolType; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -109,22 +113,6 @@ public BlockState[] createBranchStates(final IntegerProperty radiusProperty, fin return branchStates; } - @Override - public SoundType getSoundType(BlockState state, IWorldReader world, BlockPos pos, @Nullable Entity entity) { - return getFamily().getBranchSoundType(state, world, pos, entity); - } - - @Nullable - @Override - public ToolType getHarvestTool(BlockState state) { - return getFamily().getBranchHarvestTool(state); - } - - @Override - public int getHarvestLevel(BlockState state) { - return getFamily().getBranchHarvestLevel(state); - } - /////////////////////////////////////////// // BLOCKSTATES /////////////////////////////////////////// diff --git a/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BranchBlock.java b/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BranchBlock.java index 4bb5998de..8fa57f73b 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BranchBlock.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/blocks/branches/BranchBlock.java @@ -24,7 +24,6 @@ import com.ferreusveritas.dynamictrees.util.BranchDestructionData; import com.ferreusveritas.dynamictrees.util.Connections; import com.ferreusveritas.dynamictrees.util.LootTableSupplier; -import com.ferreusveritas.dynamictrees.util.ResourceLocationUtils; import com.ferreusveritas.dynamictrees.util.SimpleVoxmap; import com.ferreusveritas.dynamictrees.util.SimpleVoxmap.Cell; import net.minecraft.block.Block; @@ -230,7 +229,7 @@ public boolean canBeStripped(BlockState state, World world, BlockPos pos, Player */ public void stripBranch(BlockState state, World world, BlockPos pos, PlayerEntity player, ItemStack heldItem) { final int radius = this.getRadius(state); - this.damageAxe(player, heldItem, radius / 2, new NetVolumeNode.Volume((radius * radius * 64) / 2), false); + this.damageTool(player, heldItem, radius / 2, new NetVolumeNode.Volume((radius * radius * 64) / 2), false); this.stripBranch(state, world, pos, radius); } @@ -561,7 +560,9 @@ public void futureBreak(BlockState state, World world, BlockPos cutPos, LivingEn FallingTreeEntity.dropTree(world, destroyData, woodItems, DestroyType.HARVEST); // Damage the axe by a prescribed amount. - this.damageAxe(entity, heldItem, this.getRadius(state), woodVolume, true); + if (heldItem != ItemStack.EMPTY) { + this.damageTool(entity, heldItem, this.getRadius(state), woodVolume, true); + } } /** @@ -624,18 +625,12 @@ public BlockRayTraceResult playerRayTrace(LivingEntity entity, double blockReach Vector3d vec3d1 = entity.getViewVector(partialTicks); Vector3d vec3d2 = vec3d.add(vec3d1.x * blockReachDistance, vec3d1.y * blockReachDistance, vec3d1.z * blockReachDistance); - return entity.level.clip( - new RayTraceContext(vec3d, vec3d2, RayTraceContext.BlockMode.COLLIDER, RayTraceContext.FluidMode.NONE, - entity)); + return entity.level.clip(new RayTraceContext(vec3d, vec3d2, RayTraceContext.BlockMode.COLLIDER, RayTraceContext.FluidMode.NONE, entity)); } - public void damageAxe(final LivingEntity entity, @Nullable final ItemStack heldItem, final int radius, - final NetVolumeNode.Volume woodVolume, final boolean forBlockBreak) { - if (heldItem == null || !this.isAxe(heldItem)) { - return; - } - + public void damageTool(final LivingEntity entity, @Nullable final ItemStack heldItem, final int radius, + final NetVolumeNode.Volume woodVolume, final boolean forBlockBreak) { int damage; switch (DTConfigs.AXE_DAMAGE_MODE.get()) { diff --git a/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/WeightedItemLootEntry.java b/src/main/java/com/ferreusveritas/dynamictrees/loot/entry/WeightedItemLootEntry.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/ferreusveritas/dynamictrees/trees/Family.java b/src/main/java/com/ferreusveritas/dynamictrees/trees/Family.java index 4b77eaedc..2e5e94362 100755 --- a/src/main/java/com/ferreusveritas/dynamictrees/trees/Family.java +++ b/src/main/java/com/ferreusveritas/dynamictrees/trees/Family.java @@ -36,7 +36,6 @@ import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.material.MaterialColor; -import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; @@ -53,7 +52,6 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorld; -import net.minecraft.world.IWorldReader; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -553,18 +551,6 @@ public void setIsFireProof(boolean isFireProof) { this.isFireProof = isFireProof; } - public SoundType getBranchSoundType(BlockState state, IWorldReader world, BlockPos pos, @Nullable Entity entity) { - return this.getDefaultBranchSoundType(); - } - - public ToolType getBranchHarvestTool(BlockState state) { - return ToolType.AXE; - } - - public int getBranchHarvestLevel(BlockState state) { - return 0; - } - public Material getDefaultBranchMaterial() { return Material.WOOD; } diff --git a/src/main/java/com/ferreusveritas/dynamictrees/util/LootTableSupplier.java b/src/main/java/com/ferreusveritas/dynamictrees/util/LootTableSupplier.java old mode 100644 new mode 100755