Skip to content

Commit

Permalink
1.21: Move domum crafting to its own tab (#10109)
Browse files Browse the repository at this point in the history
Move domum crafting to its own tab
  • Loading branch information
uecasm authored Aug 24, 2024
1 parent 94d9479 commit b9c155b
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ public final class BuildingConstants
*/
public static final String MODULE_BREWING = "brewing";

/**
* Domum Ornamentum module type.
*/
public static final String MODULE_DOMUM = "domum";

/**
* Custom crafting module type.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import com.minecolonies.core.colony.requestsystem.resolvers.PublicWorkerCraftingProductionResolver;
import com.minecolonies.core.colony.requestsystem.resolvers.PublicWorkerCraftingRequestResolver;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.Tag;
Expand Down Expand Up @@ -1086,6 +1087,57 @@ public String getId()
}
}

/** this module is for Domum Ornamentum cutter recipes */
public abstract static class Domum extends AbstractCraftingBuildingModule
{
/**
* Create a new module.
*
* @param jobEntry the entry of the job.
*/
public Domum(@NotNull final JobEntry jobEntry)
{
super(jobEntry);
}

@Override
public Set<CraftingType> getSupportedCraftingTypes()
{
return Set.of(ModCraftingTypes.ARCHITECTS_CUTTER.get());
}

@Override
public boolean isRecipeCompatible(final @NotNull IGenericRecipe recipe)
{
final OptionalPredicate<ItemStack> validator = getIngredientValidator();
final ItemStack stack = recipe.getPrimaryOutput();
if (BuiltInRegistries.ITEM.getKey(stack.getItem()).getNamespace().equals("domum_ornamentum"))
{
for (final List<ItemStack> slot : recipe.getInputs())
{
// when teaching there should only be one stack in each slot; for JEI there may be more.
// any one compatible ingredient in any slot makes the whole recipe acceptable.
for (final ItemStack ingredientStack : slot)
{
if (!ItemStackUtils.isEmpty(stack) && validator.test(ingredientStack).orElse(false))
{
return true;
}
}
}
}
return false;
}

// override getIngredientValidator() to limit compatible ingredients

@NotNull
public String getId()
{
return MODULE_DOMUM;
}
}

/** this module is for those who can't be taught recipes but can still use custom recipes */
public abstract static class Custom extends AbstractCraftingBuildingModule
{
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
import com.minecolonies.api.util.OptionalPredicate;
import com.minecolonies.core.colony.buildings.AbstractBuilding;
import com.minecolonies.core.colony.buildings.modules.AbstractCraftingBuildingModule;
import com.minecolonies.core.colony.buildings.modules.AbstractDOCraftingBuildingModule;
import net.minecraft.core.BlockPos;
import net.minecraft.core.component.DataComponents;
import net.minecraft.world.item.*;
import net.neoforged.neoforge.registries.DeferredRegister;
import org.jetbrains.annotations.NotNull;

import java.util.Optional;
Expand Down Expand Up @@ -87,7 +85,7 @@ public boolean isRecipeCompatible(@NotNull final IGenericRecipe recipe)
}
}

public static class DOCraftingModule extends AbstractDOCraftingBuildingModule
public static class DOCraftingModule extends AbstractCraftingBuildingModule.Domum
{
/**
* Create a new module.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.minecolonies.api.util.OptionalPredicate;
import com.minecolonies.core.colony.buildings.AbstractBuilding;
import com.minecolonies.core.colony.buildings.modules.AbstractCraftingBuildingModule;
import com.minecolonies.core.colony.buildings.modules.AbstractDOCraftingBuildingModule;
import net.minecraft.core.BlockPos;
import net.minecraft.world.item.ItemStack;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -113,7 +112,7 @@ public boolean isRecipeCompatible(@NotNull final IGenericRecipe recipe)
}
}

public static class DOCraftingModule extends AbstractDOCraftingBuildingModule
public static class DOCraftingModule extends AbstractCraftingBuildingModule.Domum
{
/**
* Create a new module.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.minecolonies.api.util.OptionalPredicate;
import com.minecolonies.core.colony.buildings.AbstractBuilding;
import com.minecolonies.core.colony.buildings.modules.AbstractCraftingBuildingModule;
import com.minecolonies.core.colony.buildings.modules.AbstractDOCraftingBuildingModule;
import net.minecraft.core.BlockPos;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.item.BlockItem;
Expand Down Expand Up @@ -101,7 +100,7 @@ protected int getMaxRecipes()
}
}

public static class DOCraftingModule extends AbstractDOCraftingBuildingModule
public static class DOCraftingModule extends AbstractCraftingBuildingModule.Domum
{
/**
* Create a new module.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import com.minecolonies.api.util.OptionalPredicate;
import com.minecolonies.core.colony.buildings.AbstractBuilding;
import com.minecolonies.core.colony.buildings.modules.AbstractCraftingBuildingModule;
import com.minecolonies.core.colony.buildings.modules.AbstractDOCraftingBuildingModule;
import net.minecraft.core.BlockPos;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
Expand Down Expand Up @@ -120,7 +119,7 @@ public boolean isRecipeCompatible(@NotNull final IGenericRecipe recipe)
}
}

public static class DOCraftingModule extends AbstractDOCraftingBuildingModule
public static class DOCraftingModule extends AbstractCraftingBuildingModule.Domum
{
/**
* Create a new module.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.minecolonies.api.util.OptionalPredicate;
import com.minecolonies.core.colony.buildings.AbstractBuilding;
import com.minecolonies.core.colony.buildings.modules.AbstractCraftingBuildingModule;
import com.minecolonies.core.colony.buildings.modules.AbstractDOCraftingBuildingModule;
import net.minecraft.core.BlockPos;
import net.minecraft.world.item.ItemStack;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -78,7 +77,7 @@ public boolean isRecipeCompatible(@NotNull final IGenericRecipe recipe)
}
}

public static class DOCraftingModule extends AbstractDOCraftingBuildingModule
public static class DOCraftingModule extends AbstractCraftingBuildingModule.Domum
{
/**
* Create a new module.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,7 @@
"com.minecolonies.coremod.gui.workerhuts.recipe.crafting": "Crafting Recipes",
"com.minecolonies.coremod.gui.workerhuts.recipe.smelting": "Smelting Recipes",
"com.minecolonies.coremod.gui.workerhuts.recipe.custom": "Custom Recipes",
"com.minecolonies.coremod.gui.workerhuts.recipe.domum": "Cutter Recipes",
"com.minecolonies.coremod.gui.workerhuts.recipe.brewing": "Brewing Recipes",

"item.minecolonies.scan_analyzer": "Schematic Analyzer",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b9c155b

Please sign in to comment.