Added first trial of chisel support
This commit is contained in:
parent
5c3a12cb92
commit
cf32ed48a9
BIN
libs/Chisel2_DEV-2.3.3.e446d54-deobf.jar
Normal file
BIN
libs/Chisel2_DEV-2.3.3.e446d54-deobf.jar
Normal file
Binary file not shown.
|
@ -14,6 +14,9 @@ import modtweaker.mods.botania.lexicon.commands.LexiconCategoryLogger;
|
|||
import modtweaker.mods.botania.lexicon.commands.LexiconEntryLogger;
|
||||
import modtweaker.mods.botania.lexicon.commands.LexiconKnowledgeTypesLogger;
|
||||
import modtweaker.mods.botania.lexicon.commands.LexiconPageLogger;
|
||||
import modtweaker.mods.chisel.Chisel;
|
||||
import modtweaker.mods.chisel.commands.ChiselGroupLogger;
|
||||
import modtweaker.mods.chisel.commands.ChiselVariationLogger;
|
||||
import modtweaker.mods.exnihilo.ExNihilo;
|
||||
import modtweaker.mods.extendedworkbench.ExtendedWorkbench;
|
||||
import modtweaker.mods.factorization.Factorization;
|
||||
|
@ -74,6 +77,7 @@ public class ModTweaker {
|
|||
TweakerPlugin.register("Thaumcraft", Thaumcraft.class);
|
||||
TweakerPlugin.register("ThermalExpansion", ThermalExpansion.class);
|
||||
TweakerPlugin.register("Forestry", Forestry.class);
|
||||
TweakerPlugin.register("chisel", Chisel.class);
|
||||
|
||||
if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
|
||||
MinecraftForge.EVENT_BUS.register(new ClientEvents());
|
||||
|
@ -111,5 +115,11 @@ public class ModTweaker {
|
|||
MineTweakerAPI.server.addMineTweakerCommand("lexiconKnowledgeTypes", new String[] { "/minetweaker lexiconKnowledgeTypes", " Outputs a list of keys for lexicon knowledge types" }, new LexiconKnowledgeTypesLogger());
|
||||
}
|
||||
|
||||
|
||||
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", "/minetweaker chiselVariations [GROUP]", " Outputs a list of chisel variations" }, new ChiselVariationLogger());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
11
src/main/java/modtweaker/mods/chisel/Chisel.java
Normal file
11
src/main/java/modtweaker/mods/chisel/Chisel.java
Normal file
|
@ -0,0 +1,11 @@
|
|||
package modtweaker.mods.chisel;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import modtweaker.mods.chisel.handlers.Groups;
|
||||
|
||||
public class Chisel {
|
||||
public Chisel() {
|
||||
MineTweakerAPI.registerClass(Groups.class);
|
||||
}
|
||||
|
||||
}
|
28
src/main/java/modtweaker/mods/chisel/ChiselHelper.java
Normal file
28
src/main/java/modtweaker/mods/chisel/ChiselHelper.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
package modtweaker.mods.chisel;
|
||||
|
||||
import static modtweaker.helpers.InputHelper.toStack;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.CarvingUtils;
|
||||
import com.cricketcraft.chisel.api.carving.ICarvingGroup;
|
||||
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
|
||||
import com.cricketcraft.chisel.carving.Carving;
|
||||
|
||||
public class ChiselHelper {
|
||||
|
||||
public static ICarvingGroup getGroup(String name)
|
||||
{
|
||||
return CarvingUtils.getChiselRegistry().getGroup(name);
|
||||
}
|
||||
public static ICarvingGroup getGroup(IItemStack stack)
|
||||
{
|
||||
return CarvingUtils.getChiselRegistry().getGroup(Block.getBlockFromItem(toStack(stack).getItem()), stack.getDamage());
|
||||
}
|
||||
public static ICarvingVariation getVariation(IItemStack stack)
|
||||
{
|
||||
return Carving.chisel.getVariation(Block.getBlockFromItem(toStack(stack).getItem()), stack.getDamage());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package modtweaker.mods.chisel.commands;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.CarvingUtils;
|
||||
|
||||
import net.minecraft.entity.EntityList;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.MineTweakerImplementationAPI;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.server.ICommandFunction;
|
||||
|
||||
public class ChiselGroupLogger implements ICommandFunction{
|
||||
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
List<String> keys=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) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package modtweaker.mods.chisel.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.CarvingUtils;
|
||||
import com.cricketcraft.chisel.api.carving.ICarvingGroup;
|
||||
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
|
||||
|
||||
import net.minecraft.entity.EntityList;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.MineTweakerImplementationAPI;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.server.ICommandFunction;
|
||||
import modtweaker.mods.chisel.ChiselHelper;
|
||||
|
||||
public class ChiselVariationLogger implements ICommandFunction{
|
||||
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
Map<ICarvingVariation, ICarvingGroup> variations=new HashMap<ICarvingVariation, ICarvingGroup>();
|
||||
List<String> keys=CarvingUtils.getChiselRegistry().getSortedGroupNames();
|
||||
if(arguments.length>0)
|
||||
{
|
||||
ICarvingGroup group=ChiselHelper.getGroup(arguments[0]);
|
||||
if(group==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Group not found (" + arguments[0]+")");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
keys.clear();
|
||||
keys.add(arguments[0]);
|
||||
}
|
||||
}
|
||||
for (String key : keys) {
|
||||
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=entry.getKey().getBlock().getUnlocalizedName()+" "+entry.getKey().getBlockMeta();
|
||||
if(arguments.length==0)
|
||||
stringedVariation+=" "+entry.getValue().getName();
|
||||
System.out.println("Chisel Variation " + variations);
|
||||
MineTweakerAPI.logCommand(stringedVariation.toString());
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
60
src/main/java/modtweaker/mods/chisel/handlers/Groups.java
Normal file
60
src/main/java/modtweaker/mods/chisel/handlers/Groups.java
Normal file
|
@ -0,0 +1,60 @@
|
|||
package modtweaker.mods.chisel.handlers;
|
||||
|
||||
import static modtweaker.helpers.InputHelper.toObjects;
|
||||
import static modtweaker.helpers.InputHelper.toStack;
|
||||
import static modtweaker.helpers.StackHelper.areEqual;
|
||||
|
||||
import com.cricketcraft.chisel.api.carving.ICarvingGroup;
|
||||
import com.cricketcraft.chisel.api.carving.ICarvingVariation;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import modtweaker.mods.chisel.ChiselHelper;
|
||||
import modtweaker.util.BaseListAddition;
|
||||
import modtweaker.util.BaseListRemoval;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
@ZenClass("mods.chisel.Groups")
|
||||
public class Groups {
|
||||
@ZenMethod
|
||||
public static void addTransformation(String groupName, IItemStack stack) {
|
||||
ICarvingGroup group=ChiselHelper.getGroup(groupName);
|
||||
ICarvingVariation variation=ChiselHelper.getVariation(stack);
|
||||
if(group==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find group " + groupName);
|
||||
return;
|
||||
}
|
||||
if(variation==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Can create variation from " + stack);
|
||||
return;
|
||||
}
|
||||
group.addVariation(variation);
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeTransformation(String groupName, IItemStack stack) {
|
||||
ICarvingGroup group=ChiselHelper.getGroup(groupName);
|
||||
ICarvingVariation variation=ChiselHelper.getVariation(stack);
|
||||
if(group==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Cannot find group " + groupName);
|
||||
return;
|
||||
}
|
||||
if(variation==null)
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Can create variation from " + stack);
|
||||
return;
|
||||
}
|
||||
if(!group.getVariations().contains(variation))
|
||||
{
|
||||
MineTweakerAPI.getLogger().logError("Variation doesn't exist in group " + groupName);
|
||||
return;
|
||||
}
|
||||
group.removeVariation(variation.getBlock(),variation.getBlockMeta());
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue