mirror of
https://github.com/GTNewHorizons/Eternal-Singularity.git
synced 2026-11-21 20:42:21 +00:00
new: minetweaker support
This commit is contained in:
1 parent
c01103aecc
commit
f1f2c17427
9 files changed
+158
-5
No files matched your search
@@ -0,0 +1,151 @@
|
||||
package wanion.biggercraftingtables.minetweaker;
|
||||
|
||||
/*
|
||||
* Created by WanionCane(https://github.com/WanionCane).
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import singulariteam.eternalsingularity.proxy.CommonProxy;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import wanion.lib.common.MineTweakerHelper;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@ZenClass("mods.eternalsingularity")
|
||||
public final class EternalRecipeTweaker
|
||||
{
|
||||
private static final List<Object> eternalSingularityRecipe = CommonProxy.eternalSingularityRecipe.getInput();
|
||||
|
||||
private EternalRecipeTweaker()
|
||||
{
|
||||
}
|
||||
|
||||
public static void init()
|
||||
{
|
||||
MineTweakerAPI.registerClass(EternalRecipeTweaker.class);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void add(@Nonnull final IItemStack input)
|
||||
{
|
||||
final ItemStack itemStack = MineTweakerHelper.toStack(input);
|
||||
if (itemStack != null && itemStack.getItem() != null)
|
||||
MineTweakerAPI.apply(new Add(itemStack));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void remove(final IItemStack input)
|
||||
{
|
||||
final ItemStack itemStack = MineTweakerHelper.toStack(input);
|
||||
if (itemStack != null && itemStack.getItem() != null)
|
||||
MineTweakerAPI.apply(new Remove(itemStack));
|
||||
}
|
||||
|
||||
private static class Add implements IUndoableAction
|
||||
{
|
||||
private final ItemStack itemStack;
|
||||
|
||||
public Add(@Nonnull final ItemStack itemStack)
|
||||
{
|
||||
this.itemStack = itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply()
|
||||
{
|
||||
eternalSingularityRecipe.add(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo()
|
||||
{
|
||||
eternalSingularityRecipe.remove(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe()
|
||||
{
|
||||
return "Adding " + itemStack.getDisplayName() + " into Eternal Singularity Recipe.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo()
|
||||
{
|
||||
return "Removing " + itemStack.getDisplayName() + " from Eternal Singularity Recipe.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static class Remove implements IUndoableAction
|
||||
{
|
||||
private final ItemStack itemStack;
|
||||
|
||||
private Remove(@Nonnull final ItemStack itemStackToRemove)
|
||||
{
|
||||
ItemStack itemStack = null;
|
||||
for (final Iterator<Object> eternalSingularityRecipeIterator = eternalSingularityRecipe.iterator(); eternalSingularityRecipeIterator.hasNext() && itemStack == null; ) {
|
||||
final Object input = eternalSingularityRecipeIterator.next();
|
||||
if (input instanceof ItemStack && ((ItemStack) input).isItemEqual(itemStackToRemove))
|
||||
itemStack = (ItemStack) input;
|
||||
}
|
||||
this.itemStack = itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply()
|
||||
{
|
||||
eternalSingularityRecipe.remove(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUndo()
|
||||
{
|
||||
return itemStack != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo()
|
||||
{
|
||||
eternalSingularityRecipe.add(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describe()
|
||||
{
|
||||
return "Removing " + itemStack.getDisplayName() + " from Eternal Singularity Recipe.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeUndo()
|
||||
{
|
||||
return "Adding " + itemStack.getDisplayName() + " into Eternal Singularity Recipe.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOverrideKey()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import singulariteam.eternalsingularity.proxy.CommonProxy;
|
||||
|
||||
import static singulariteam.eternalsingularity.Reference.*;
|
||||
|
||||
@Mod(modid = MOD_ID, name = MOD_NAME, version = MOD_VERSION, acceptedMinecraftVersions = MC_VERSION, dependencies = "required-after:Avaritia;after:thermsingul;after:universalsingularities;after:aobdsingularities")
|
||||
@Mod(modid = MOD_ID, name = MOD_NAME, version = MOD_VERSION, acceptedMinecraftVersions = MC_VERSION, dependencies = "required-after:Avaritia;required-after:wanionlib[after:thermsingul;after:universalsingularities;after:aobdsingularities")
|
||||
public class EternalSingularityMod
|
||||
{
|
||||
@Mod.Instance(MOD_ID)
|
||||
|
||||
@@ -25,12 +25,14 @@ public class CommonProxy
|
||||
public final void preInit(final File file)
|
||||
{
|
||||
final Configuration config = new Configuration(file);
|
||||
final List<String> classNameList = Arrays.asList(config.getStringList("classNameList", Configuration.CATEGORY_GENERAL, new String[]{
|
||||
final String[] classNameList = config.getStringList("classNameList", Configuration.CATEGORY_GENERAL, new String[]{
|
||||
"com.rcx.aobdsingularities.item.AOBDItemSingularity",
|
||||
"fox.spiteful.avaritia.items.ItemSingularity",
|
||||
"wanion.thermsingul.ThermalSingularityItem",
|
||||
"wealthyturtle.uiesingularities.UniversalSingularityItem"
|
||||
}, "here is the absolute class name of the Item Classes that must be removed from Infinity Catalyst recipe and inserted into Eternal Singularity."));
|
||||
}, "here is the absolute class name of the Item Classes that must be removed from Infinity Catalyst recipe and inserted into Eternal Singularity.");
|
||||
if (config.hasChanged())
|
||||
config.save();
|
||||
for (final String className : classNameList) {
|
||||
try {
|
||||
classSet.add(Class.forName(className));
|
||||
@@ -46,7 +48,7 @@ public class CommonProxy
|
||||
@SuppressWarnings("unchecked")
|
||||
public final void postInit()
|
||||
{
|
||||
if (craftingOnly)
|
||||
if (classSet.isEmpty() || craftingOnly)
|
||||
return;
|
||||
ExtremeCraftingManager.getInstance().getRecipeList().add(eternalSingularityRecipe);
|
||||
for (final Iterator<Object> catalystRecipeIterator = Grinder.catalyst.getInput().iterator(); catalystRecipeIterator.hasNext();) {
|
||||
|
||||
Reference in new issue
Block a user