mirror of
https://github.com/GTNewHorizons/ModTweaker.git
synced 2026-11-20 04:19:44 +00:00
ModTweaker2 Rework
- Revised base classes for IUndoableAction - Reordered lots of code, so stuck actions should be less frequent - Added wildcard support to many "remove" methods - Started working on exist & duplicate checks
This commit is contained in:
1 parent
f5034b04d8
commit
da33cc6fab
112 files changed
+4596
-3522
No files matched your search
@@ -3,10 +3,14 @@ package modtweaker2.mods.exnihilo.handlers;
|
||||
import static modtweaker2.helpers.InputHelper.isABlock;
|
||||
import static modtweaker2.helpers.InputHelper.toFluid;
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
import modtweaker2.helpers.InputHelper;
|
||||
import modtweaker2.utils.BaseMapAddition;
|
||||
import modtweaker2.utils.BaseMapRemoval;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -20,6 +24,7 @@ import exnihilo.registries.helpers.Meltable;
|
||||
@ZenClass("mods.exnihilo.Crucible")
|
||||
public class Crucible {
|
||||
|
||||
|
||||
/************************************************ Crucible Melting ************************************************/
|
||||
//Adding a Ex Nihilo Crucible recipe
|
||||
@ZenMethod
|
||||
@@ -32,14 +37,15 @@ public class Crucible {
|
||||
}
|
||||
|
||||
//Passes the list to the map list implementation, and adds the recipe
|
||||
private static class AddRecipe extends BaseMapAddition {
|
||||
private static class AddRecipe extends BaseMapAddition<String, Meltable> {
|
||||
public AddRecipe(Meltable recipe) {
|
||||
super("ExNihilo Crucible", CrucibleRegistry.entries, recipe.block + ":" + recipe.meta, recipe);
|
||||
super("ExNihilo Crucible", CrucibleRegistry.entries);
|
||||
recipes.put(recipe.block + ":" + recipe.meta, recipe);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return new ItemStack(((Meltable) recipe).block, 1, ((Meltable) recipe).meta).getDisplayName();
|
||||
protected String getRecipeInfo(Entry<String, Meltable> recipe) {
|
||||
return InputHelper.getStackDescription(new ItemStack(recipe.getValue().block, 1, recipe.getValue().meta));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,14 +60,21 @@ public class Crucible {
|
||||
}
|
||||
|
||||
//Removes a recipe, will always remove the key, so all should be good
|
||||
private static class RemoveRecipe extends BaseMapRemoval {
|
||||
private static class RemoveRecipe extends BaseMapRemoval<String, Meltable> {
|
||||
public RemoveRecipe(ItemStack stack) {
|
||||
super("ExNihilo Crucible", CrucibleRegistry.entries, Block.getBlockFromItem(stack.getItem()) + ":" + stack.getItemDamage(), stack);
|
||||
super("ExNihilo Crucible", CrucibleRegistry.entries);
|
||||
|
||||
String key = Block.getBlockFromItem(stack.getItem()) + ":" + stack.getItemDamage();
|
||||
|
||||
for(Entry<String, Meltable> entry : map.entrySet()) {
|
||||
if(entry.getKey().equals(key))
|
||||
recipes.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return ((ItemStack) stack).getDisplayName();
|
||||
protected String getRecipeInfo(Entry<String, Meltable> recipe) {
|
||||
return InputHelper.getStackDescription(new ItemStack(recipe.getValue().block, 1, recipe.getValue().meta));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,20 +2,14 @@ package modtweaker2.mods.exnihilo.handlers;
|
||||
|
||||
import static modtweaker2.helpers.InputHelper.isABlock;
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import exnihilo.registries.HammerRegistry;
|
||||
import exnihilo.registries.helpers.Smashable;
|
||||
import exnihilo.utils.ItemInfo;
|
||||
|
||||
@ZenClass("mods.exnihilo.Hammer")
|
||||
public class Hammer {
|
||||
|
||||
Reference in new issue
Block a user