Ex Deorum 1.7

This commit is contained in:
thedarkcolour 2023-10-22 01:53:17 -07:00
parent 31a3c287f1
commit 62dec82d02
22 changed files with 331 additions and 61 deletions

View File

@ -5,7 +5,7 @@ plugins {
id 'org.spongepowered.mixin' version '0.7.+'
}
version = '1.6'
version = '1.7'
group = 'thedarkcolour.exdeorum'
base {
archivesName = 'exdeorum'

View File

@ -1,3 +1,8 @@
## Ex Deorum 1.7
- Actually added way to obtain Sky Stone Dust from AE2.
- Added compatibility with Factorium's ores, which can now be crafted with Ex Deorum's ore chunks.
- Hammer now has slight benefits for using Fortune. For blocks with multiple drops, slightly increases the number of drops, and for blocks which have a chance to not drop anything, decreases the chance that nothing is dropped.
## Ex Deorum 1.6
- Added way to obtain sky stone dust from AE2.
- Fixed End Portal not generating properly.

View File

@ -1,4 +1,4 @@
// 1.20.1 2023-10-10T10:32:34.2619562 Recipes
// 1.20.1 2023-10-18T23:12:25.9553204 Recipes
5ad481a0c376c1a1785a5d3b992064d0ec0bf3b0 data/exdeorum/advancements/recipes/food/end_cake.json
25dd027e844a72b03c95dbe5e3c3dd8c738ceb00 data/exdeorum/advancements/recipes/misc/acacia_barrel.json
376be94a64c9ca97a9ea2346547b6e617f13a815 data/exdeorum/advancements/recipes/misc/acacia_crucible.json
@ -589,6 +589,7 @@ da3556d43a22a00cfba29419879f8bb1c24f76e0 data/exdeorum/recipes/sieve/dust/diamon
0087b10cc106dc6cb22a9574567faf8096fa797e data/exdeorum/recipes/sieve/dust/diamond/grains_of_infinity.json
aacdbedc91e09191a6fc335ed82ca481d934ebc3 data/exdeorum/recipes/sieve/dust/diamond/gunpowder.json
00907e701451521c3ca793ec337b0b2f0166e895 data/exdeorum/recipes/sieve/dust/diamond/redstone.json
2c09ba69a51a5a700fd07ed1ed209be54d8cbff3 data/exdeorum/recipes/sieve/dust/diamond/sky_dust.json
e071b7083dd1f122a6008d773d80e29b0939dce7 data/exdeorum/recipes/sieve/dust/diamond/yellorium_dust.json
7eba59b03b5affdc11c937060e99949db301086a data/exdeorum/recipes/sieve/dust/flint/blaze_powder.json
7af226b5661b96e0b8ddcb8ec902d37f429b0b48 data/exdeorum/recipes/sieve/dust/flint/bone_meal.json
@ -596,6 +597,7 @@ e071b7083dd1f122a6008d773d80e29b0939dce7 data/exdeorum/recipes/sieve/dust/diamon
c418797b65a0c67841c5e99d8fec95d1ee780065 data/exdeorum/recipes/sieve/dust/flint/grains_of_infinity.json
52c65219279d46fe5474a8a01d69a1362cb3a2ea data/exdeorum/recipes/sieve/dust/flint/gunpowder.json
7ecd5ae5d7f6783ff7535978352190a9af1b0ab4 data/exdeorum/recipes/sieve/dust/flint/redstone.json
17c71d15a28be77366da40ad3461b0ded7369e97 data/exdeorum/recipes/sieve/dust/flint/sky_dust.json
b9f030c35edfd7cf832cd2d026eb7526681d8ebf data/exdeorum/recipes/sieve/dust/flint/yellorium_dust.json
bdbe4b3434ff67299b47d65eab0c442b235dc654 data/exdeorum/recipes/sieve/dust/golden/blaze_powder.json
fab2426618c3f527ed401f1ef2cee3fa81de1969 data/exdeorum/recipes/sieve/dust/golden/bone_meal.json
@ -605,6 +607,7 @@ c087c3ba3bd7bda74aac13435f61a998060d4872 data/exdeorum/recipes/sieve/dust/golden
4d28a3acd946fd55c3982e5ff9bb8876b8b0baef data/exdeorum/recipes/sieve/dust/golden/gunpowder.json
a9c9258b74162f5132b8b47f3981b071ec6b60bf data/exdeorum/recipes/sieve/dust/golden/raw_gold.json
65c99881294536c0f59d66d0e7429d85bbec0b9b data/exdeorum/recipes/sieve/dust/golden/redstone.json
d5a4a64774eca713f8242423d10d89f8bb79a19b data/exdeorum/recipes/sieve/dust/golden/sky_dust.json
45bf0f375561c5d4ede6e90611c4cc60ac704705 data/exdeorum/recipes/sieve/dust/golden/yellorium_dust.json
4b304a265794186e3c1fbd23acfcfde57322d615 data/exdeorum/recipes/sieve/dust/iron/blaze_powder.json
758573f460a7f2ff2104a1bbfde2fa8392d002a4 data/exdeorum/recipes/sieve/dust/iron/bone_meal.json
@ -613,6 +616,7 @@ f5c25b6ee05890bdc41ddc45a14b2015665388fe data/exdeorum/recipes/sieve/dust/iron/g
5ffc2f95fc5a52aad02e7b063ba64c4cd41836f3 data/exdeorum/recipes/sieve/dust/iron/gunpowder.json
eeb2ec19599044971eeff5929e7238fa398f1f08 data/exdeorum/recipes/sieve/dust/iron/iron_nugget.json
9dc82b4a79edf9561566137af39399b1621b89a0 data/exdeorum/recipes/sieve/dust/iron/redstone.json
b051722d781020d01924077074da364f6099570e data/exdeorum/recipes/sieve/dust/iron/sky_dust.json
e059dbdb19633d8c07823d472fe4109fe5f482b8 data/exdeorum/recipes/sieve/dust/iron/yellorium_dust.json
55bf627cf6c3a8eca57328cb482a6f86326a8e68 data/exdeorum/recipes/sieve/dust/netherite/blaze_powder.json
33e35a1af71274a675498234b8dcd9834368c717 data/exdeorum/recipes/sieve/dust/netherite/bone_meal.json
@ -622,6 +626,7 @@ a776c6d6946a02fea8bb346860f525bde2c835de data/exdeorum/recipes/sieve/dust/nether
2fb062f8d8be004bd5e54a43a089c579a374abb1 data/exdeorum/recipes/sieve/dust/netherite/gunpowder.json
c6a8996009ae3e712a2895001e96c74bb35b224c data/exdeorum/recipes/sieve/dust/netherite/iron_nugget.json
44e98c8ce40d6f72596b009398943cb3ac6ef1b5 data/exdeorum/recipes/sieve/dust/netherite/redstone.json
451f4b0384aea8cc590b50aadf2719dad1681744 data/exdeorum/recipes/sieve/dust/netherite/sky_dust.json
74dc5a0f222df29970a3d70a1cb89f3525044568 data/exdeorum/recipes/sieve/dust/netherite/yellorium_dust.json
7bed9653a0d40436bd15531ffb15eb84563cfc4d data/exdeorum/recipes/sieve/dust/string/blaze_powder.json
74dc1675b4dc9c0d1d96bc22db0b844f322082b8 data/exdeorum/recipes/sieve/dust/string/bone_meal.json
@ -629,6 +634,7 @@ e4ead3b21ece1d4470c2000017586c1730acd1bb data/exdeorum/recipes/sieve/dust/string
91428deb05889718e458b8cd9f6d610f1e652330 data/exdeorum/recipes/sieve/dust/string/grains_of_infinity.json
3272a1f8b4534dd8800b07b7ec826d8f7a4fae65 data/exdeorum/recipes/sieve/dust/string/gunpowder.json
e1a8558df8270d57cbcdf7255b93b40d0c05d33b data/exdeorum/recipes/sieve/dust/string/redstone.json
f4dd212eb788b5e16f13aefca723231e1e52d2ab data/exdeorum/recipes/sieve/dust/string/sky_dust.json
bde922cc7bd1eec8a2479169dcfa9b5c5d69a27e data/exdeorum/recipes/sieve/dust/string/yellorium_dust.json
9df7ca0a604ab01b33dfe0b342441b9705c9ac9e data/exdeorum/recipes/sieve/gravel/diamond/aluminum_ore_chunk.json
b1b1c231670f2622dc2227fac65aff0ebbd2ea19 data/exdeorum/recipes/sieve/gravel/diamond/amethyst_shard.json

View File

@ -0,0 +1,26 @@
{
"type": "forge:conditional",
"recipes": [
{
"conditions": [
{
"type": "forge:mod_loaded",
"modid": "ae2"
}
],
"recipe": {
"type": "exdeorum:sieve",
"ingredient": {
"item": "exdeorum:dust"
},
"mesh": "exdeorum:diamond_mesh",
"result": "ae2:sky_dust",
"result_amount": {
"type": "minecraft:binomial",
"n": 1.0,
"p": 0.1
}
}
}
]
}

View File

@ -0,0 +1,26 @@
{
"type": "forge:conditional",
"recipes": [
{
"conditions": [
{
"type": "forge:mod_loaded",
"modid": "ae2"
}
],
"recipe": {
"type": "exdeorum:sieve",
"ingredient": {
"item": "exdeorum:dust"
},
"mesh": "exdeorum:flint_mesh",
"result": "ae2:sky_dust",
"result_amount": {
"type": "minecraft:binomial",
"n": 1.0,
"p": 0.07
}
}
}
]
}

View File

@ -0,0 +1,26 @@
{
"type": "forge:conditional",
"recipes": [
{
"conditions": [
{
"type": "forge:mod_loaded",
"modid": "ae2"
}
],
"recipe": {
"type": "exdeorum:sieve",
"ingredient": {
"item": "exdeorum:dust"
},
"mesh": "exdeorum:golden_mesh",
"result": "ae2:sky_dust",
"result_amount": {
"type": "minecraft:binomial",
"n": 1.0,
"p": 0.08
}
}
}
]
}

View File

@ -0,0 +1,26 @@
{
"type": "forge:conditional",
"recipes": [
{
"conditions": [
{
"type": "forge:mod_loaded",
"modid": "ae2"
}
],
"recipe": {
"type": "exdeorum:sieve",
"ingredient": {
"item": "exdeorum:dust"
},
"mesh": "exdeorum:iron_mesh",
"result": "ae2:sky_dust",
"result_amount": {
"type": "minecraft:binomial",
"n": 1.0,
"p": 0.075
}
}
}
]
}

View File

@ -0,0 +1,26 @@
{
"type": "forge:conditional",
"recipes": [
{
"conditions": [
{
"type": "forge:mod_loaded",
"modid": "ae2"
}
],
"recipe": {
"type": "exdeorum:sieve",
"ingredient": {
"item": "exdeorum:dust"
},
"mesh": "exdeorum:netherite_mesh",
"result": "ae2:sky_dust",
"result_amount": {
"type": "minecraft:binomial",
"n": 1.0,
"p": 0.11
}
}
}
]
}

View File

@ -0,0 +1,26 @@
{
"type": "forge:conditional",
"recipes": [
{
"conditions": [
{
"type": "forge:mod_loaded",
"modid": "ae2"
}
],
"recipe": {
"type": "exdeorum:sieve",
"ingredient": {
"item": "exdeorum:dust"
},
"mesh": "exdeorum:string_mesh",
"result": "ae2:sky_dust",
"result_amount": {
"type": "minecraft:binomial",
"n": 1.0,
"p": 0.06
}
}
}
]
}

View File

@ -271,7 +271,7 @@ public class BarrelBlockEntity extends EBlockEntity {
if (simulate) {
return RecipeUtil.isCompostable(stack);
} else {
var recipe = RecipeUtil.getBarrelCompostRecipe(stack);
var recipe = RecipeUtil.getBarrelCompostRecipe(stack.getItem());
if (recipe != null) {
addCompost(stack, recipe.getVolume());
return true;

View File

@ -35,4 +35,6 @@ public class ModIds {
public static final String ENDERIO = "enderio";
public static final String BIOMES_O_PLENTY = "biomesoplenty";
public static final String APPLIED_ENERGISTICS_2 = "ae2";
public static final String MODEST_FLINT_OVERHAUL = "modestflintoverhaul";
public static final String FACTORIUM = "factorium";
}

View File

@ -38,7 +38,7 @@ import java.util.Arrays;
import java.util.Comparator;
import java.util.Map;
public class ModdedTags {
public class PreferredOres {
private static final Map<TagKey<Item>, Item> PREFERRED_ORE_ITEMS = new Object2ObjectOpenHashMap<>(11, Hash.DEFAULT_LOAD_FACTOR);
static {
@ -100,19 +100,19 @@ public class ModdedTags {
}
public static Item getDefaultSilverOre() {
return defaultItem("silver_ore", ModIds.ALL_THE_ORES, ModIds.OCCULTISM, ModIds.RAILCRAFT);
return defaultItem("silver_ore", ModIds.ALL_THE_ORES, ModIds.OCCULTISM, ModIds.RAILCRAFT, ModIds.FACTORIUM);
}
public static Item getDefaultLeadOre() {
return defaultItem("lead_ore", ModIds.ALL_THE_ORES, ModIds.GREG, ModIds.MEKANISM, ModIds.RAILCRAFT);
return defaultItem("lead_ore", ModIds.ALL_THE_ORES, ModIds.GREG, ModIds.MEKANISM, ModIds.RAILCRAFT, ModIds.FACTORIUM);
}
public static Item getDefaultPlatinumOre() {
return defaultItem("platinum_ore", ModIds.ALL_THE_ORES, ModIds.GREG);
return defaultItem("platinum_ore", ModIds.ALL_THE_ORES, ModIds.GREG, ModIds.FACTORIUM);
}
public static Item getDefaultNickelOre() {
return defaultItem("nickel_ore", ModIds.ALL_THE_ORES, ModIds.GREG, ModIds.THERMAL, ModIds.RAILCRAFT);
return defaultItem("nickel_ore", ModIds.ALL_THE_ORES, ModIds.GREG, ModIds.THERMAL, ModIds.RAILCRAFT, ModIds.FACTORIUM);
}
public static Item getDefaultUraniumOre() {
@ -130,11 +130,11 @@ public class ModdedTags {
}
public static Item getDefaultTinOre() {
return defaultItem("tin_ore", ModIds.ALL_THE_ORES, ModIds.GREG, ModIds.THERMAL, ModIds.RAILCRAFT, "orestestmod");
return defaultItem("tin_ore", ModIds.ALL_THE_ORES, ModIds.GREG, ModIds.THERMAL, ModIds.RAILCRAFT, ModIds.FACTORIUM);
}
public static Item getDefaultZincOre() {
return defaultItem("zinc_ore", ModIds.ALL_THE_ORES, ModIds.GREG, ModIds.CREATE, ModIds.RAILCRAFT);
return defaultItem("zinc_ore", ModIds.ALL_THE_ORES, ModIds.GREG, ModIds.CREATE, ModIds.RAILCRAFT, ModIds.FACTORIUM);
}
public static Item getDefaultIridiumOre() {
@ -145,7 +145,11 @@ public class ModdedTags {
var modId = getFirstAvailableModId(modIds);
if (modId != null) {
return ForgeRegistries.ITEMS.getValue(new ResourceLocation(modId, path));
if (modId.equals(ModIds.FACTORIUM)) {
return ForgeRegistries.ITEMS.getValue(new ResourceLocation(modId, "mat_" + path));
} else {
return ForgeRegistries.ITEMS.getValue(new ResourceLocation(modId, path));
}
} else {
return Items.AIR;
}

View File

@ -188,7 +188,7 @@ public class ModCompatData {
CERTUS_QUARTZ_CRYSTAL = addItem.apply("certus_quartz_crystal");
CHARGED_CERTUS_QUARTZ_CRYSTAL = addItem.apply("charged_certus_quartz_crystal");
CERTUS_QUARTZ_DUST = addItem.apply("certus_quartz_dust");
SKY_STONE_DUST = addItem.apply("sky_stone_dust");
SKY_STONE_DUST = addItem.apply("sky_dust");
});
}

View File

@ -244,6 +244,7 @@ public class Recipes {
});
}
// todo wtf does this do? why is it using a MutableObject
private static void grid2x2TagResult(Consumer<FinishedRecipe> writer, MKRecipeProvider recipes, TagKey<Item> resultTag, Ingredient ingredient) {
var ref = new MutableObject<FinishedRecipe>();
recipes.pushWriter(ref::setValue, newWriter -> {
@ -514,4 +515,8 @@ public class Recipes {
static ICondition modInstalled(String modid) {
return new ModLoadedCondition(modid);
}
static final ICondition AE2 = modInstalled(ModIds.APPLIED_ENERGISTICS_2);
static final ICondition ENDERIO = modInstalled(ModIds.ENDERIO);
static final ICondition EXTREME_REACTORS = modInstalled(ModIds.EXTREME_REACTORS);
}

View File

@ -47,7 +47,6 @@ import static net.minecraft.world.level.storage.loot.providers.number.BinomialDi
import static thedarkcolour.modkit.data.MKRecipeProvider.ingredient;
import static thedarkcolour.modkit.data.MKRecipeProvider.path;
// todo sky stone dust from Dust block
class SieveRecipes {
static void sieveRecipes(Consumer<FinishedRecipe> writer) {
var allMeshes = List.of(EItems.STRING_MESH, EItems.FLINT_MESH, EItems.IRON_MESH, EItems.GOLDEN_MESH, EItems.DIAMOND_MESH, EItems.NETHERITE_MESH);
@ -421,9 +420,9 @@ class SieveRecipes {
addDrop.accept(Items.GLOWSTONE_DUST, chance(0.04f));
addDrop.accept(Items.BLAZE_POWDER, chance(0.03f));
addConditionalDrop.accept(ModCompatData.GRAINS_OF_INFINITY.get(), chance(0.06f), Recipes.modInstalled(ModIds.ENDERIO));
addConditionalDrop.accept(ModCompatData.YELLORIUM_DUST.get(), chance(0.05f), Recipes.modInstalled(ModIds.EXTREME_REACTORS));
addConditionalDrop.accept(ModCompatData.GRAINS_OF_INFINITY.get(), chance(0.06f), Recipes.ENDERIO);
addConditionalDrop.accept(ModCompatData.YELLORIUM_DUST.get(), chance(0.05f), Recipes.EXTREME_REACTORS);
addConditionalDrop.accept(ModCompatData.SKY_STONE_DUST.get(), chance(0.06f), Recipes.AE2);
});
forMesh(writer, ingredient(EItems.DUST.get()), EItems.FLINT_MESH, (addDrop, addTagDrop, addConditionalDrop) -> {
addDrop.accept(Items.GUNPOWDER, chance(0.11f));
@ -432,8 +431,9 @@ class SieveRecipes {
addDrop.accept(Items.GLOWSTONE_DUST, chance(0.07f));
addDrop.accept(Items.BLAZE_POWDER, chance(0.04f));
addConditionalDrop.accept(ModCompatData.GRAINS_OF_INFINITY.get(), chance(0.07f), Recipes.modInstalled(ModIds.ENDERIO));
addConditionalDrop.accept(ModCompatData.YELLORIUM_DUST.get(), chance(0.055f), Recipes.modInstalled(ModIds.EXTREME_REACTORS));
addConditionalDrop.accept(ModCompatData.GRAINS_OF_INFINITY.get(), chance(0.07f), Recipes.ENDERIO);
addConditionalDrop.accept(ModCompatData.YELLORIUM_DUST.get(), chance(0.055f), Recipes.EXTREME_REACTORS);
addConditionalDrop.accept(ModCompatData.SKY_STONE_DUST.get(), chance(0.07f), Recipes.AE2);
});
forMesh(writer, ingredient(EItems.DUST.get()), EItems.IRON_MESH, (addDrop, addTagDrop, addConditionalDrop) -> {
addDrop.accept(Items.GUNPOWDER, chance(0.13f));
@ -443,8 +443,9 @@ class SieveRecipes {
addDrop.accept(Items.BLAZE_POWDER, chance(0.05f));
addDrop.accept(Items.IRON_NUGGET, chance(0.06f));
addConditionalDrop.accept(ModCompatData.GRAINS_OF_INFINITY.get(), chance(0.09f), Recipes.modInstalled(ModIds.ENDERIO));
addConditionalDrop.accept(ModCompatData.YELLORIUM_DUST.get(), chance(0.08f), Recipes.modInstalled(ModIds.EXTREME_REACTORS));
addConditionalDrop.accept(ModCompatData.GRAINS_OF_INFINITY.get(), chance(0.09f), Recipes.ENDERIO);
addConditionalDrop.accept(ModCompatData.YELLORIUM_DUST.get(), chance(0.08f), Recipes.EXTREME_REACTORS);
addConditionalDrop.accept(ModCompatData.SKY_STONE_DUST.get(), chance(0.075f), Recipes.AE2);
});
forMesh(writer, ingredient(EItems.DUST.get()), EItems.GOLDEN_MESH, (addDrop, addTagDrop, addConditionalDrop) -> {
addDrop.accept(Items.GUNPOWDER, chance(0.13f));
@ -455,8 +456,9 @@ class SieveRecipes {
addDrop.accept(Items.GOLD_NUGGET, binomial(2, 0.18f));
addDrop.accept(Items.RAW_GOLD, chance(0.02f));
addConditionalDrop.accept(ModCompatData.GRAINS_OF_INFINITY.get(), chance(0.11f), Recipes.modInstalled(ModIds.ENDERIO));
addConditionalDrop.accept(ModCompatData.YELLORIUM_DUST.get(), chance(0.10f), Recipes.modInstalled(ModIds.EXTREME_REACTORS));
addConditionalDrop.accept(ModCompatData.GRAINS_OF_INFINITY.get(), chance(0.11f), Recipes.ENDERIO);
addConditionalDrop.accept(ModCompatData.YELLORIUM_DUST.get(), chance(0.10f), Recipes.EXTREME_REACTORS);
addConditionalDrop.accept(ModCompatData.SKY_STONE_DUST.get(), chance(0.08f), Recipes.AE2);
});
forMesh(writer, ingredient(EItems.DUST.get()), EItems.DIAMOND_MESH, (addDrop, addTagDrop, addConditionalDrop) -> {
addDrop.accept(Items.GUNPOWDER, chance(0.14f));
@ -466,8 +468,9 @@ class SieveRecipes {
addDrop.accept(Items.BLAZE_POWDER, chance(0.06f));
addDrop.accept(Items.GOLD_NUGGET, chance(0.08f));
addConditionalDrop.accept(ModCompatData.GRAINS_OF_INFINITY.get(), chance(0.12f), Recipes.modInstalled(ModIds.ENDERIO));
addConditionalDrop.accept(ModCompatData.YELLORIUM_DUST.get(), chance(0.12f), Recipes.modInstalled(ModIds.EXTREME_REACTORS));
addConditionalDrop.accept(ModCompatData.GRAINS_OF_INFINITY.get(), chance(0.12f), Recipes.ENDERIO);
addConditionalDrop.accept(ModCompatData.YELLORIUM_DUST.get(), chance(0.12f), Recipes.EXTREME_REACTORS);
addConditionalDrop.accept(ModCompatData.SKY_STONE_DUST.get(), chance(0.10f), Recipes.AE2);
});
forMesh(writer, ingredient(EItems.DUST.get()), EItems.NETHERITE_MESH, (addDrop, addTagDrop, addConditionalDrop) -> {
addDrop.accept(Items.GUNPOWDER, chance(0.14f));
@ -478,8 +481,9 @@ class SieveRecipes {
addDrop.accept(Items.GOLD_NUGGET, chance(0.08f));
addDrop.accept(Items.IRON_NUGGET, chance(0.08f));
addConditionalDrop.accept(ModCompatData.GRAINS_OF_INFINITY.get(), chance(0.135f), Recipes.modInstalled(ModIds.ENDERIO));
addConditionalDrop.accept(ModCompatData.YELLORIUM_DUST.get(), chance(0.14f), Recipes.modInstalled(ModIds.EXTREME_REACTORS));
addConditionalDrop.accept(ModCompatData.GRAINS_OF_INFINITY.get(), chance(0.135f), Recipes.ENDERIO);
addConditionalDrop.accept(ModCompatData.YELLORIUM_DUST.get(), chance(0.14f), Recipes.EXTREME_REACTORS);
addConditionalDrop.accept(ModCompatData.SKY_STONE_DUST.get(), chance(0.11f), Recipes.AE2);
});
// Crushed Deepslate -> String mesh

View File

@ -21,15 +21,15 @@ package thedarkcolour.exdeorum.loot;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import net.minecraft.world.SimpleContainer;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition;
import net.minecraftforge.common.loot.IGlobalLootModifier;
import net.minecraftforge.common.loot.LootModifier;
import thedarkcolour.exdeorum.registry.ERecipeTypes;
import thedarkcolour.exdeorum.recipe.RecipeUtil;
import javax.annotation.Nonnull;
@ -43,22 +43,42 @@ public class HammerLootModifier extends LootModifier {
@Nonnull
@Override
protected ObjectArrayList<ItemStack> doApply(ObjectArrayList<ItemStack> generatedLoot, LootContext context) {
var level = context.getLevel();
var state = context.getParamOrNull(LootContextParams.BLOCK_STATE);
// todo incorporate Fortune
if (state != null && state.getBlock().asItem() != Items.AIR) {
var temporaryItem = new SimpleContainer(new ItemStack(state.getBlock().asItem()));
var recipe = level.getRecipeManager().getRecipeFor(ERecipeTypes.HAMMER.get(), temporaryItem, level);
if (state != null) {
var itemForm = state.getBlock().asItem();
if (itemForm != Items.AIR) {
var recipe = RecipeUtil.getHammerRecipe(itemForm);
if (recipe.isPresent()) {
ObjectArrayList<ItemStack> newLoot = new ObjectArrayList<>();
var resultAmount = recipe.get().resultAmount.getInt(context);
if (recipe != null) {
ObjectArrayList<ItemStack> newLoot = new ObjectArrayList<>();
var resultAmount = recipe.resultAmount.getInt(context);
if (resultAmount > 0) {
newLoot.add(new ItemStack(recipe.get().result, resultAmount));
// fortune handling; more likely to boost drops if there are none to begin with
if (context.hasParam(LootContextParams.TOOL)) {
var stack = context.getParam(LootContextParams.TOOL);
var fortune = stack.getEnchantmentLevel(Enchantments.BLOCK_FORTUNE);
if (fortune != 0) {
var chance = context.getRandom().nextFloat();
if (resultAmount == 0) {
if (chance < 0.06 * fortune) {
resultAmount++;
}
} else {
if (chance < 0.03 * fortune) {
resultAmount++;
}
}
}
}
if (resultAmount > 0) {
newLoot.add(new ItemStack(recipe.result, resultAmount));
}
return newLoot;
}
return newLoot;
}
}

View File

@ -26,7 +26,6 @@ import com.google.gson.JsonObject;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.util.GsonHelper;
import net.minecraft.world.Container;
@ -43,14 +42,15 @@ import net.minecraft.world.level.storage.loot.providers.number.ConstantValue;
import net.minecraft.world.level.storage.loot.providers.number.NumberProvider;
import net.minecraft.world.level.storage.loot.providers.number.NumberProviders;
import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator;
import net.minecraftforge.common.crafting.CraftingHelper;
import net.minecraftforge.common.util.Lazy;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.registries.ForgeRegistries;
import org.jetbrains.annotations.Nullable;
import thedarkcolour.exdeorum.compat.ModdedTags;
import thedarkcolour.exdeorum.compat.PreferredOres;
import thedarkcolour.exdeorum.recipe.barrel.BarrelCompostRecipe;
import thedarkcolour.exdeorum.recipe.barrel.BarrelMixingRecipe;
import thedarkcolour.exdeorum.recipe.crucible.CrucibleRecipe;
import thedarkcolour.exdeorum.recipe.hammer.HammerRecipe;
import thedarkcolour.exdeorum.recipe.sieve.SieveRecipe;
import thedarkcolour.exdeorum.registry.ERecipeTypes;
@ -68,24 +68,28 @@ public final class RecipeUtil {
private static Lazy<Map<Item, BarrelCompostRecipe>> barrelCompostRecipeCache;
private static Lazy<Map<Item, CrucibleRecipe>> lavaCrucibleRecipeCache;
private static Lazy<Map<Item, CrucibleRecipe>> waterCrucibleRecipeCache;
private static Lazy<Map<Item, HammerRecipe>> hammerRecipeCache;
public static void reload(RecipeManager recipes) {
SIEVE_RECIPE_CACHE.invalidateAll();
barrelCompostRecipeCache = Lazy.of(() -> loadSimpleRecipeCache(recipes, ERecipeTypes.BARREL_COMPOST));
lavaCrucibleRecipeCache = Lazy.of(() -> loadSimpleRecipeCache(recipes, ERecipeTypes.LAVA_CRUCIBLE));
waterCrucibleRecipeCache = Lazy.of(() -> loadSimpleRecipeCache(recipes, ERecipeTypes.WATER_CRUCIBLE));
barrelCompostRecipeCache = loadSimpleRecipeCache(recipes, ERecipeTypes.BARREL_COMPOST);
lavaCrucibleRecipeCache = loadSimpleRecipeCache(recipes, ERecipeTypes.LAVA_CRUCIBLE);
waterCrucibleRecipeCache = loadSimpleRecipeCache(recipes, ERecipeTypes.WATER_CRUCIBLE);
hammerRecipeCache = loadSimpleRecipeCache(recipes, ERecipeTypes.HAMMER);
}
private static <T extends SingleIngredientRecipe> ImmutableMap<Item, T> loadSimpleRecipeCache(RecipeManager recipes, Supplier<RecipeType<T>> recipeType) {
var builder = new ImmutableMap.Builder<Item, T>();
for (var recipe : recipes.byType(recipeType.get()).values()) {
for (var item : recipe.getIngredient().getItems()) {
builder.put(item.getItem(), recipe);
private static <T extends SingleIngredientRecipe> Lazy<Map<Item, T>> loadSimpleRecipeCache(RecipeManager recipes, Supplier<RecipeType<T>> recipeType) {
return Lazy.of(() -> {
var builder = new ImmutableMap.Builder<Item, T>();
for (var recipe : recipes.byType(recipeType.get()).values()) {
for (var item : recipe.getIngredient().getItems()) {
builder.put(item.getItem(), recipe);
}
}
}
return builder.buildKeepingLast();
return builder.buildKeepingLast();
});
}
public static List<SieveRecipe> getSieveRecipes(RecipeManager manager, Item mesh, ItemStack item) {
@ -114,16 +118,24 @@ public final class RecipeUtil {
return recipes;
}
@Nullable
public static CrucibleRecipe getLavaCrucibleRecipe(ItemStack item) {
return lavaCrucibleRecipeCache.get().get(item.getItem());
}
@Nullable
public static CrucibleRecipe getWaterCrucibleRecipe(ItemStack item) {
return waterCrucibleRecipeCache.get().get(item.getItem());
}
public static BarrelCompostRecipe getBarrelCompostRecipe(ItemStack playerItem) {
return barrelCompostRecipeCache.get().get(playerItem.getItem());
@Nullable
public static BarrelCompostRecipe getBarrelCompostRecipe(Item playerItem) {
return barrelCompostRecipeCache.get().get(playerItem);
}
@Nullable
public static HammerRecipe getHammerRecipe(Item playerItem) {
return hammerRecipeCache.get().get(playerItem);
}
public static <C extends Container, T extends Recipe<C>> Collection<T> byType(RecipeManager manager, RecipeType<T> type) {
@ -139,7 +151,7 @@ public final class RecipeUtil {
}
public static Item readItem(JsonObject json, String key) {
return ForgeRegistries.ITEMS.getValue(new ResourceLocation(GsonHelper.getAsString(json, key)));
return CraftingHelper.getItem(GsonHelper.getAsString(json, key), true);
}
public static NumberProvider readNumberProvider(JsonObject json, String key) {
@ -293,7 +305,7 @@ public final class RecipeUtil {
}
public static boolean isTagEmpty(TagKey<Item> tag) {
return BuiltInRegistries.ITEM.getTag(tag).map(set -> !set.iterator().hasNext()).orElse(ModdedTags.getPreferredOre(tag) == Items.AIR);
return BuiltInRegistries.ITEM.getTag(tag).map(set -> !set.iterator().hasNext()).orElse(PreferredOres.getPreferredOre(tag) == Items.AIR);
}
private record SieveCacheKey(Item mesh, Item ingredient) {

View File

@ -33,7 +33,7 @@ import net.minecraft.world.item.crafting.RecipeManager;
import net.minecraft.world.item.crafting.RecipeSerializer;
import org.jetbrains.annotations.Nullable;
import thedarkcolour.exdeorum.ExDeorum;
import thedarkcolour.exdeorum.compat.ModdedTags;
import thedarkcolour.exdeorum.compat.PreferredOres;
import thedarkcolour.exdeorum.registry.ERecipeSerializers;
public class TagResultRecipe {
@ -44,7 +44,7 @@ public class TagResultRecipe {
var resultTag = GsonHelper.getAsString(json, "result_tag");
if (ResourceLocation.isValidResourceLocation(resultTag)) {
var tag = TagKey.create(Registries.ITEM, new ResourceLocation(resultTag));
var preferredItem = ModdedTags.getPreferredOre(tag);
var preferredItem = PreferredOres.getPreferredOre(tag);
if (preferredItem != Items.AIR) {
var recipeJson = GsonHelper.getAsJsonObject(json, "recipe");

View File

@ -0,0 +1,27 @@
/*
* Ex Deorum
* Copyright (c) 2023 thedarkcolour
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* This package contains all data generation for Ex Deorum. It is not to be used outside of data generation.
* <p>
* Ex Deorum uses the ModKit library, which adds several utilities primarily for data generation
* without needing to be shaded or depended upon outside a development environment.
*/
@net.minecraft.MethodsReturnNonnullByDefault
@javax.annotation.ParametersAreNonnullByDefault
package thedarkcolour.exdeorum.recipe.hammer;

View File

@ -0,0 +1,27 @@
/*
* Ex Deorum
* Copyright (c) 2023 thedarkcolour
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* This package contains all data generation for Ex Deorum. It is not to be used outside of data generation.
* <p>
* Ex Deorum uses the ModKit library, which adds several utilities primarily for data generation
* without needing to be shaded or depended upon outside a development environment.
*/
@net.minecraft.MethodsReturnNonnullByDefault
@javax.annotation.ParametersAreNonnullByDefault
package thedarkcolour.exdeorum.recipe;

View File

@ -19,6 +19,7 @@
package thedarkcolour.exdeorum.recipe.sieve;
import com.google.gson.JsonObject;
import com.google.gson.JsonSyntaxException;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.FriendlyByteBuf;
@ -34,7 +35,7 @@ import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.world.level.storage.loot.providers.number.NumberProvider;
import org.jetbrains.annotations.Nullable;
import thedarkcolour.exdeorum.ExDeorum;
import thedarkcolour.exdeorum.compat.ModdedTags;
import thedarkcolour.exdeorum.compat.PreferredOres;
import thedarkcolour.exdeorum.recipe.ProbabilityRecipe;
import thedarkcolour.exdeorum.recipe.RecipeUtil;
import thedarkcolour.exdeorum.registry.ERecipeSerializers;
@ -74,7 +75,7 @@ public class SieveRecipe extends ProbabilityRecipe {
result = RecipeUtil.readItem(json, "result");
} else if (json.has("result_tag")) {
TagKey<Item> tag = TagKey.create(Registries.ITEM, new ResourceLocation(GsonHelper.getAsString(json, "result_tag")));
result = ModdedTags.getPreferredOre(tag);
result = PreferredOres.getPreferredOre(tag);
if (result == Items.AIR) {
ExDeorum.LOGGER.info("Skipped loading recipe {} as result_tag {} was empty", id, tag);

View File

@ -28,7 +28,7 @@ function initializeCoreMod() {
var insn = insnList.get(i);
// patch before ASTORE 3
if (insn.getOpcode() == Opcodes.ASTORE && insn.var == 3) {
if (insn.getOpcode() === Opcodes.ASTORE && insn.var === 3) {
insnList.insertBefore(insn, ASMAPI.listOf(
new VarInsnNode(Opcodes.ALOAD, 1),
new MethodInsnNode(Opcodes.INVOKESTATIC, 'thedarkcolour/exdeorum/asm/ASMHooks', 'adjustPos', '(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/levelgen/structure/Structure$GenerationContext;)Lnet/minecraft/core/BlockPos;', false)
@ -70,6 +70,7 @@ function initializeCoreMod() {
}
},
// Fixes heightmap issues when placing the end portal podium that would only spawn half of the portal
// What this patch looks like in code: EndIslandPodium.place(..., this.portalLocation = ASMHooks.prePlaceEndPodium(this.portalLocation))
'EndPortalPatch': {
'target': {
'type': 'METHOD',