mirror of
https://github.com/GTNewHorizons/ModTweaker.git
synced 2026-11-18 03:35:03 +00:00
Made some changes, should help mod authors direct bugs to me
This commit is contained in:
1 parent
daddadf7e7
commit
c500a5a580
12 files changed
+35
-11
No files matched your search
@@ -1,22 +1,24 @@
|
||||
package modtweaker2;
|
||||
|
||||
import static modtweaker2.helpers.LogHelper.print;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.minecraft.MineTweakerMC;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import modtweaker2.utils.TweakerPlugin;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import static modtweaker2.helpers.LogHelper.*;
|
||||
|
||||
public class ClientEvents {
|
||||
public static int cooldown;
|
||||
public static boolean active;
|
||||
|
||||
|
||||
public static String notice = EnumChatFormatting.DARK_RED + "This item's recipe has been changed by ModTweaker.";
|
||||
@SubscribeEvent
|
||||
public void onDrawTooltip(ItemTooltipEvent event) {
|
||||
|
||||
IPlayer player = MineTweakerMC.getIPlayer(event.entityPlayer);
|
||||
if (player != null) {
|
||||
IItemStack hand = MineTweakerMC.getIItemStack(event.itemStack);
|
||||
@@ -36,8 +38,13 @@ public class ClientEvents {
|
||||
cooldown--;
|
||||
}
|
||||
|
||||
for (ItemStack stack : TweakerPlugin.changed) {
|
||||
if (stack.isItemEqual(event.itemStack) && event.toolTip.contains(notice)) {
|
||||
event.toolTip.add(notice);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -2,6 +2,8 @@ package modtweaker2.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class ArrayUtils {
|
||||
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ public abstract class BaseCraftingAddition extends BaseDescriptionAddition {
|
||||
this.output = output;
|
||||
this.recipe = recipe;
|
||||
this.list = list;
|
||||
TweakerPlugin.changed.add(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,6 +10,7 @@ import static modtweaker2.helpers.StackHelper.areEqual;
|
||||
public class BaseCraftingRemoval extends BaseListRemoval {
|
||||
public BaseCraftingRemoval(String name, List list, ItemStack stack) {
|
||||
super(name, list, stack);
|
||||
TweakerPlugin.changed.add(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package modtweaker2.utils;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import minetweaker.IUndoableAction;
|
||||
|
||||
public abstract class BaseDescriptionAddition implements IUndoableAction {
|
||||
|
||||
@@ -19,6 +19,7 @@ public abstract class BaseListAddition implements IUndoableAction {
|
||||
public BaseListAddition(List list, Object recipe) {
|
||||
this.list = list;
|
||||
this.recipe = recipe;
|
||||
TweakerPlugin.changed.add(((ItemStack) recipe));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,6 +22,7 @@ public abstract class BaseListRemoval implements IUndoableAction {
|
||||
this.stack = stack;
|
||||
this.description = description;
|
||||
this.fluid = fluid;
|
||||
TweakerPlugin.changed.add(stack);
|
||||
}
|
||||
|
||||
public BaseListRemoval(String description, List list, ItemStack stack) {
|
||||
|
||||
@@ -21,6 +21,8 @@ public abstract class BaseMapAddition implements IUndoableAction {
|
||||
this.key = key;
|
||||
this.recipe = recipe;
|
||||
this.description = description;
|
||||
if (recipe instanceof ItemStack)
|
||||
TweakerPlugin.changed.add(((ItemStack) recipe));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -48,7 +50,8 @@ public abstract class BaseMapAddition implements IUndoableAction {
|
||||
return "Adding " + description + " Recipe for :" + ((ItemStack) recipe).getDisplayName();
|
||||
else if (recipe instanceof FluidStack)
|
||||
return "Adding " + description + " Recipe for :" + ((FluidStack) recipe).getFluid().getLocalizedName();
|
||||
else return "Adding " + description + " Recipe for :" + getRecipeInfo();
|
||||
else
|
||||
return "Adding " + description + " Recipe for :" + getRecipeInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -57,7 +60,8 @@ public abstract class BaseMapAddition implements IUndoableAction {
|
||||
return "Removing " + description + " Recipe for :" + ((ItemStack) recipe).getDisplayName();
|
||||
else if (recipe instanceof FluidStack)
|
||||
return "Removing " + description + " Recipe for :" + ((FluidStack) recipe).getFluid().getLocalizedName();
|
||||
else return "Removing " + description + " Recipe for :" + getRecipeInfo();
|
||||
else
|
||||
return "Removing " + description + " Recipe for :" + getRecipeInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package modtweaker2.utils;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import minetweaker.IUndoableAction;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class BaseMapRemoval implements IUndoableAction {
|
||||
protected final Map map;
|
||||
protected Object stack;
|
||||
@@ -26,6 +26,9 @@ public abstract class BaseMapRemoval implements IUndoableAction {
|
||||
this.map = map;
|
||||
this.key = key;
|
||||
this.description = description;
|
||||
if(map.get(key) instanceof ItemStack){
|
||||
TweakerPlugin.changed.add(((ItemStack) map.get(key)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -34,7 +34,7 @@ public abstract class BaseMultipleListRemoval implements IUndoableAction {
|
||||
}
|
||||
|
||||
recipes.add(o);
|
||||
|
||||
|
||||
//If we want the first position, exit the loop
|
||||
if (pos == Position.FIRST) {
|
||||
break;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package modtweaker2.utils;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import minetweaker.IUndoableAction;
|
||||
import modtweaker2.helpers.ReflectionHelper;
|
||||
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
package modtweaker2.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
||||
public class TweakerPlugin {
|
||||
private static ArrayList<String> isLoaded = new ArrayList();
|
||||
|
||||
public static List<ItemStack> changed = new ArrayList<ItemStack>();
|
||||
|
||||
public static void register(String mod, Class clazz) {
|
||||
if (Loader.isModLoaded(mod)) {
|
||||
|
||||
Reference in new issue
Block a user