Added /mt AspectList which lists items/entities and their aspects. I also moved the thaumcraft research command to .command for standardization.
This commit is contained in:
parent
f17f6f35bf
commit
c50f58b481
|
@ -33,7 +33,8 @@ import modtweaker.mods.railcraft.Railcraft;
|
|||
import modtweaker.mods.tconstruct.MaterialLogger;
|
||||
import modtweaker.mods.tconstruct.TConstruct;
|
||||
import modtweaker.mods.thaumcraft.Thaumcraft;
|
||||
import modtweaker.mods.thaumcraft.research.ResearchLogger;
|
||||
import modtweaker.mods.thaumcraft.commands.AspectLogger;
|
||||
import modtweaker.mods.thaumcraft.research.commands.ResearchLogger;
|
||||
import modtweaker.mods.thermalexpansion.ThermalExpansion;
|
||||
import modtweaker.util.TweakerPlugin;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
@ -101,6 +102,7 @@ public class ModTweaker {
|
|||
|
||||
if (TweakerPlugin.isLoaded("Thaumcraft")) {
|
||||
MineTweakerAPI.server.addMineTweakerCommand("research", new String[] { "/minetweaker research", "/minetweaker research [CATEGORY]", " Outputs a list of all category names in the game to the minetweaker log," + " or outputs a list of all research keys in a category to the log." }, new ResearchLogger());
|
||||
MineTweakerAPI.server.addMineTweakerCommand("aspectList", new String[] { "/minetweaker aspectList", " Outputs a list of all aspects registered to entities and items"}, new AspectLogger());
|
||||
}
|
||||
|
||||
if (TweakerPlugin.isLoaded("TConstruct")) {
|
||||
|
|
|
@ -85,5 +85,16 @@ public class ThaumcraftHelper {
|
|||
ThaumcraftApi.scanEntities.remove(tag);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String aspectsToString(AspectList aspects)
|
||||
{
|
||||
System.out.println(aspects);
|
||||
String output="";
|
||||
for(Aspect aspect : aspects.getAspectsSortedAmount())
|
||||
{
|
||||
if(aspect!=null)
|
||||
output+=aspect.getName()+" "+aspects.getAmount(aspect)+",";
|
||||
}
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
package modtweaker.mods.thaumcraft.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import thaumcraft.api.ThaumcraftApi;
|
||||
import thaumcraft.api.ThaumcraftApi.EntityTags;
|
||||
import thaumcraft.api.ThaumcraftApi.EntityTagsNBT;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.item.Item;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.MineTweakerImplementationAPI;
|
||||
import minetweaker.api.player.IPlayer;
|
||||
import minetweaker.api.server.ICommandFunction;
|
||||
import modtweaker.mods.thaumcraft.ThaumcraftHelper;
|
||||
|
||||
public class AspectLogger implements ICommandFunction{
|
||||
|
||||
@Override
|
||||
public void execute(String[] arguments, IPlayer player) {
|
||||
List<String> lines=new ArrayList();
|
||||
for(Entry<List, AspectList> entry : ThaumcraftApi.objectTags.entrySet())
|
||||
{
|
||||
List<String> itemList=new ArrayList<String>();
|
||||
for(int i=0;i<entry.getKey().size();i+=2)
|
||||
{
|
||||
Item item=(Item)entry.getKey().get(i);
|
||||
|
||||
itemList.add("<"+item.itemRegistry.getNameForObject(item)+":"+entry.getKey().get(i+1)+">");
|
||||
}
|
||||
lines.add(itemList.toString()+": "+ThaumcraftHelper.aspectsToString(entry.getValue()));
|
||||
}
|
||||
for (EntityTags tags : ThaumcraftApi.scanEntities)
|
||||
{
|
||||
List<String> tagsList=new ArrayList<String>();
|
||||
for(EntityTagsNBT tag : tags.nbts)
|
||||
{
|
||||
tagsList.add(tag.name+":"+tag.value);
|
||||
}
|
||||
String stringTags="";
|
||||
if(tags.nbts.length!=0)
|
||||
stringTags=":"+tagsList.toString();
|
||||
lines.add("<"+tags.entityName+stringTags+">"+": "+ThaumcraftHelper.aspectsToString(tags.aspects));
|
||||
}
|
||||
System.out.println("Aspects: " + lines.size());
|
||||
for (String line : lines) {
|
||||
System.out.println("Aspect " + line);
|
||||
MineTweakerAPI.logCommand(line);
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
player.sendChat(MineTweakerImplementationAPI.platform.getMessage("List generated; see minetweaker.log in your minecraft dir"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package modtweaker.mods.thaumcraft.research;
|
||||
package modtweaker.mods.thaumcraft.research.commands;
|
||||
|
||||
import static modtweaker.helpers.LogHelper.log;
|
||||
import static modtweaker.helpers.LogHelper.logPrinted;
|
Loading…
Reference in a new issue