Added chisel commands back. Close #370
This commit is contained in:
parent
5dbff3f794
commit
bb53897d1a
7 changed files with 53 additions and 81 deletions
|
@ -44,7 +44,7 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
deobfCompile "com.blamejared:MTLib:1.0.0.5"
|
deobfCompile "com.blamejared:MTLib:1.0.0.6"
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources
|
processResources
|
||||||
|
|
|
@ -4,6 +4,8 @@ import minetweaker.MineTweakerAPI;
|
||||||
import minetweaker.api.player.IPlayer;
|
import minetweaker.api.player.IPlayer;
|
||||||
import minetweaker.api.server.ICommandFunction;
|
import minetweaker.api.server.ICommandFunction;
|
||||||
import modtweaker.commands.EntityMappingLogger;
|
import modtweaker.commands.EntityMappingLogger;
|
||||||
|
import modtweaker.mods.chisel.commands.ChiselGroupLogger;
|
||||||
|
import modtweaker.mods.chisel.commands.ChiselVariationLogger;
|
||||||
import modtweaker.mods.randomthings.commands.RandomThingsLogger;
|
import modtweaker.mods.randomthings.commands.RandomThingsLogger;
|
||||||
import modtweaker.mods.tconstruct.commands.MaterialLogger;
|
import modtweaker.mods.tconstruct.commands.MaterialLogger;
|
||||||
import modtweaker.mods.tconstruct.commands.ModifierLogger;
|
import modtweaker.mods.tconstruct.commands.ModifierLogger;
|
||||||
|
@ -12,7 +14,7 @@ import modtweaker.mods.tconstruct.commands.TConstructLogger;
|
||||||
public class Commands {
|
public class Commands {
|
||||||
|
|
||||||
public static void registerCommands() {
|
public static void registerCommands() {
|
||||||
if (MineTweakerAPI.server != null) {
|
if(MineTweakerAPI.server != null) {
|
||||||
|
|
||||||
MineTweakerAPI.server.addMineTweakerCommand("tooltips", new String[]{"/minetweaker tooltips", " Adds tooltips to all items ingame with their mt script name, press ctrl on an item to print to the log"}, new ICommandFunction() {
|
MineTweakerAPI.server.addMineTweakerCommand("tooltips", new String[]{"/minetweaker tooltips", " Adds tooltips to all items ingame with their mt script name, press ctrl on an item to print to the log"}, new ICommandFunction() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -23,13 +25,17 @@ public class Commands {
|
||||||
|
|
||||||
MineTweakerAPI.server.addMineTweakerCommand("entities", new String[]{"/minetweaker entities", " Outputs a list of entities class mapping keys and the entity IDs"}, new EntityMappingLogger());
|
MineTweakerAPI.server.addMineTweakerCommand("entities", new String[]{"/minetweaker entities", " Outputs a list of entities class mapping keys and the entity IDs"}, new EntityMappingLogger());
|
||||||
|
|
||||||
if (TweakerPlugin.isLoaded("randomthings")) {
|
if(TweakerPlugin.isLoaded("randomthings")) {
|
||||||
MineTweakerAPI.server.addMineTweakerCommand("randomthings", new String[]{"/minetweaker randomthings [HANDLER]", " Outputs a list of all Random Things recipes."}, new RandomThingsLogger());
|
MineTweakerAPI.server.addMineTweakerCommand("randomthings", new String[]{"/minetweaker randomthings [HANDLER]", " Outputs a list of all Random Things recipes."}, new RandomThingsLogger());
|
||||||
}
|
}
|
||||||
if (TweakerPlugin.isLoaded("tconstruct")) {
|
if(TweakerPlugin.isLoaded("tconstruct")) {
|
||||||
MineTweakerAPI.server.addMineTweakerCommand("materials", new String[] { "/minetweaker materials", " Outputs a list of all Tinker's Construct material names in the game to the minetweaker log" }, new MaterialLogger());
|
MineTweakerAPI.server.addMineTweakerCommand("materials", new String[]{"/minetweaker materials", " Outputs a list of all Tinker's Construct material names in the game to the minetweaker log"}, new MaterialLogger());
|
||||||
MineTweakerAPI.server.addMineTweakerCommand("modifiers", new String[] { "/minetweaker modifiers", " Outputs a list of all Tinker's Construct modifier names in the game to the minetweaker log" }, new ModifierLogger());
|
MineTweakerAPI.server.addMineTweakerCommand("modifiers", new String[]{"/minetweaker modifiers", " Outputs a list of all Tinker's Construct modifier names in the game to the minetweaker log"}, new ModifierLogger());
|
||||||
MineTweakerAPI.server.addMineTweakerCommand("tconstruct", new String[]{ "/minetweaker tconstruct [HANDLER]", " Outputs a list of all Tinkers Construct recipes."}, new TConstructLogger());
|
MineTweakerAPI.server.addMineTweakerCommand("tconstruct", new String[]{"/minetweaker tconstruct [HANDLER]", " Outputs a list of all Tinkers Construct recipes."}, new TConstructLogger());
|
||||||
|
}
|
||||||
|
if(TweakerPlugin.isLoaded("chisel")) {
|
||||||
|
MineTweakerAPI.server.addMineTweakerCommand("chiselGroups", new String[]{"/minetweaker chiselGroups", " Outputs a list of chisel groups"}, new ChiselGroupLogger());
|
||||||
|
MineTweakerAPI.server.addMineTweakerCommand("chiselVariations", new String[]{"/minetweaker chiselVariations", " Outputs a list of chisel variations"}, new ChiselVariationLogger());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,5 @@ public class ModProps {
|
||||||
public static final String NAME = "Mod Tweaker", name = NAME;
|
public static final String NAME = "Mod Tweaker", name = NAME;
|
||||||
public static final String MODID = "modtweaker", modid = MODID;
|
public static final String MODID = "modtweaker", modid = MODID;
|
||||||
public static final String VERSION = "@modVersion@", version = VERSION;
|
public static final String VERSION = "@modVersion@", version = VERSION;
|
||||||
public static final String DEPENDENCIES = "required-after:MineTweaker3;", dependencies = DEPENDENCIES;
|
public static final String DEPENDENCIES = "required-after:MineTweaker3;required-after:mtlib;", dependencies = DEPENDENCIES;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,7 @@ package modtweaker;
|
||||||
|
|
||||||
import com.blamejared.ctgui.api.GuiRegistry;
|
import com.blamejared.ctgui.api.GuiRegistry;
|
||||||
import minetweaker.MineTweakerImplementationAPI;
|
import minetweaker.MineTweakerImplementationAPI;
|
||||||
import minetweaker.MineTweakerImplementationAPI.ReloadEvent;
|
|
||||||
import minetweaker.runtime.providers.ScriptProviderDirectory;
|
import minetweaker.runtime.providers.ScriptProviderDirectory;
|
||||||
import minetweaker.util.IEventHandler;
|
|
||||||
import modtweaker.mods.actuallyadditions.ActuallyAdditions;
|
import modtweaker.mods.actuallyadditions.ActuallyAdditions;
|
||||||
import modtweaker.mods.bloodmagic.BloodMagic;
|
import modtweaker.mods.bloodmagic.BloodMagic;
|
||||||
import modtweaker.mods.botania.Botania;
|
import modtweaker.mods.botania.Botania;
|
||||||
|
@ -19,7 +17,10 @@ import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||||
import net.minecraftforge.fml.common.Mod.Instance;
|
import net.minecraftforge.fml.common.Mod.Instance;
|
||||||
import net.minecraftforge.fml.common.SidedProxy;
|
import net.minecraftforge.fml.common.SidedProxy;
|
||||||
import net.minecraftforge.fml.common.event.*;
|
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||||
|
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||||
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
@ -53,22 +54,15 @@ public class ModTweaker {
|
||||||
TweakerPlugin.register("Botania", Botania.class);
|
TweakerPlugin.register("Botania", Botania.class);
|
||||||
TweakerPlugin.register("chisel", Chisel.class);
|
TweakerPlugin.register("chisel", Chisel.class);
|
||||||
TweakerPlugin.register("BloodMagic", BloodMagic.class);
|
TweakerPlugin.register("BloodMagic", BloodMagic.class);
|
||||||
TweakerPlugin.register("actuallyadditions",ActuallyAdditions.class);
|
TweakerPlugin.register("actuallyadditions", ActuallyAdditions.class);
|
||||||
|
if(FMLCommonHandler.instance().getSide() == Side.CLIENT) {
|
||||||
if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
|
|
||||||
MinecraftForge.EVENT_BUS.register(new ClientEvents());
|
MinecraftForge.EVENT_BUS.register(new ClientEvents());
|
||||||
}
|
}
|
||||||
|
|
||||||
MineTweakerImplementationAPI.onReloadEvent(new IEventHandler<MineTweakerImplementationAPI.ReloadEvent>() {
|
MineTweakerImplementationAPI.onReloadEvent(event1 -> proxy.registerCommands());
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handle(ReloadEvent event) {
|
|
||||||
proxy.registerCommands();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
File scripts = new File("scripts");
|
File scripts = new File("scripts");
|
||||||
if (!scripts.exists()) {
|
if(!scripts.exists()) {
|
||||||
scripts.mkdir();
|
scripts.mkdir();
|
||||||
}
|
}
|
||||||
MineTweakerImplementationAPI.setScriptProvider(new ScriptProviderDirectory(scripts));
|
MineTweakerImplementationAPI.setScriptProvider(new ScriptProviderDirectory(scripts));
|
||||||
|
|
|
@ -22,9 +22,9 @@ import static com.blamejared.mtlib.helpers.StackHelper.matches;
|
||||||
|
|
||||||
@ZenClass("mods.botania.Apothecary")
|
@ZenClass("mods.botania.Apothecary")
|
||||||
public class Apothecary {
|
public class Apothecary {
|
||||||
|
|
||||||
protected static final String name = "Botania Petal";
|
protected static final String name = "Botania Petal";
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@ZenMethod
|
@ZenMethod
|
||||||
|
@ -54,14 +54,14 @@ public class Apothecary {
|
||||||
@ZenMethod
|
@ZenMethod
|
||||||
public static void removeRecipe(IIngredient output) {
|
public static void removeRecipe(IIngredient output) {
|
||||||
// Get list of existing recipes, matching with parameter
|
// Get list of existing recipes, matching with parameter
|
||||||
LinkedList<RecipePetals> result = new LinkedList<RecipePetals>();
|
LinkedList<RecipePetals> result = new LinkedList<>();
|
||||||
|
|
||||||
for(RecipePetals entry : BotaniaAPI.petalRecipes) {
|
for(RecipePetals entry : BotaniaAPI.petalRecipes) {
|
||||||
if(entry != null && entry.getOutput() != null && matches(output, toIItemStack(entry.getOutput()))) {
|
if(entry != null && entry.getOutput() != null && matches(output, toIItemStack(entry.getOutput()))) {
|
||||||
result.add(entry);
|
result.add(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we found the recipes and apply the action
|
// Check if we found the recipes and apply the action
|
||||||
if(!result.isEmpty()) {
|
if(!result.isEmpty()) {
|
||||||
MineTweakerAPI.apply(new Remove(result));
|
MineTweakerAPI.apply(new Remove(result));
|
||||||
|
|
|
@ -1,27 +1,20 @@
|
||||||
package modtweaker.mods.chisel.commands;
|
package modtweaker.mods.chisel.commands;
|
||||||
|
|
||||||
import minetweaker.MineTweakerAPI;
|
import com.blamejared.mtlib.commands.CommandLogger;
|
||||||
import minetweaker.MineTweakerImplementationAPI;
|
|
||||||
import minetweaker.api.player.IPlayer;
|
|
||||||
import minetweaker.api.server.ICommandFunction;
|
|
||||||
import team.chisel.api.carving.CarvingUtils;
|
import team.chisel.api.carving.CarvingUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
|
|
||||||
|
|
||||||
public class ChiselGroupLogger implements ICommandFunction {
|
public class ChiselGroupLogger extends CommandLogger {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] arguments, IPlayer player) {
|
public Collection<? extends String> getList() {
|
||||||
List<String> keys = CarvingUtils.getChiselRegistry().getSortedGroupNames();
|
return CarvingUtils.getChiselRegistry().getSortedGroupNames();
|
||||||
System.out.println("Chisel Groups: " + keys.size());
|
}
|
||||||
for (String key : keys) {
|
|
||||||
System.out.println("Chisel Group " + key);
|
|
||||||
MineTweakerAPI.logCommand(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player != null) {
|
@Override
|
||||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
public String getName() {
|
||||||
}
|
return "Chisel Groups";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,52 +1,32 @@
|
||||||
package modtweaker.mods.chisel.commands;
|
package modtweaker.mods.chisel.commands;
|
||||||
|
|
||||||
import minetweaker.MineTweakerAPI;
|
import com.blamejared.mtlib.commands.CommandLogger;
|
||||||
import minetweaker.MineTweakerImplementationAPI;
|
|
||||||
import minetweaker.api.player.IPlayer;
|
|
||||||
import minetweaker.api.server.ICommandFunction;
|
|
||||||
import modtweaker.mods.chisel.ChiselHelper;
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import team.chisel.api.carving.CarvingUtils;
|
import team.chisel.api.carving.CarvingUtils;
|
||||||
import team.chisel.api.carving.ICarvingGroup;
|
|
||||||
import team.chisel.api.carving.ICarvingVariation;
|
import team.chisel.api.carving.ICarvingVariation;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.Collection;
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
public class ChiselVariationLogger implements ICommandFunction {
|
public class ChiselVariationLogger extends CommandLogger {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] arguments, IPlayer player) {
|
public Collection<? extends String> getList() {
|
||||||
Map<ICarvingVariation, ICarvingGroup> variations = new HashMap<ICarvingVariation, ICarvingGroup>();
|
List<String> var = new LinkedList<>();
|
||||||
List<String> keys = CarvingUtils.getChiselRegistry().getSortedGroupNames();
|
for(String s : CarvingUtils.getChiselRegistry().getSortedGroupNames()) {
|
||||||
if (arguments.length > 0) {
|
for(ICarvingVariation variation : CarvingUtils.getChiselRegistry().getGroup(s).getVariations()) {
|
||||||
ICarvingGroup group = ChiselHelper.getGroup(arguments[0]);
|
String stringedVariation = "<" + Item.REGISTRY.getNameForObject(Item.getItemFromBlock(variation.getBlock())) + ":" + variation.getStack().getItemDamage() + ">";
|
||||||
if (group == null) {
|
stringedVariation += " " + s;
|
||||||
MineTweakerAPI.getLogger().logError("Group not found (" + arguments[0] + ")");
|
System.out.println("Chisel Variation " + stringedVariation);
|
||||||
return;
|
var.add(stringedVariation);
|
||||||
} else {
|
|
||||||
keys.clear();
|
|
||||||
keys.add(arguments[0]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (String key : keys) {
|
return var;
|
||||||
ICarvingGroup group = CarvingUtils.getChiselRegistry().getGroup(key);
|
}
|
||||||
for (ICarvingVariation variation : group.getVariations())
|
|
||||||
variations.put(variation, group);
|
|
||||||
}
|
|
||||||
System.out.println("Chisel Variations: " + variations.size());
|
|
||||||
for (Entry<ICarvingVariation, ICarvingGroup> entry : variations.entrySet()) {
|
|
||||||
String stringedVariation = "<" + Item.REGISTRY.getNameForObject(Item.getItemFromBlock(entry.getKey().getBlock())) + ":" + entry.getKey().getStack().getItemDamage() + ">";
|
|
||||||
if (arguments.length == 0)
|
|
||||||
stringedVariation += " " + entry.getValue().getName();
|
|
||||||
System.out.println("Chisel Variation " + stringedVariation);
|
|
||||||
MineTweakerAPI.logCommand(stringedVariation);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player != null) {
|
@Override
|
||||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
public String getName() {
|
||||||
}
|
return "Chisel Variations";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue