mirror of
https://github.com/GTNewHorizons/Electro-Magic-Tools.git
synced 2026-11-20 03:59:36 +00:00
fixed a few bugs, removed unused variables & imports
+added a ingame book containing the fuelmap
This commit is contained in:
1 parent
805553e04e
commit
028f5ef031
25 files changed
+92
-77
No files matched your search
@@ -1,5 +1,7 @@
|
||||
package emt.command;
|
||||
|
||||
import emt.util.EMTEssentiasOutputs;
|
||||
import emt.util.EMTTextHelper;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
@@ -10,16 +12,11 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import emt.util.EMTEssentiasOutputs;
|
||||
import emt.util.EMTTextHelper;
|
||||
|
||||
public class CommandOutputs extends CommandBase {
|
||||
|
||||
public String text;
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return "emt_outputs";
|
||||
@@ -51,37 +48,70 @@ public class CommandOutputs extends CommandBase {
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender command, String[] astring) {
|
||||
text = EMTTextHelper.localize("gui.EMT.book.aspect.output.essentia.eu") + ": ";
|
||||
Collection<Aspect> aspectCollection = Aspect.aspects.values();
|
||||
for (Aspect aspect : aspectCollection) {
|
||||
String text2 = addStrings(text, (aspect.getTag() + ": " + String.valueOf(EMTEssentiasOutputs.outputs.get(aspect.getTag())) + "\n"));
|
||||
text = text2;
|
||||
}
|
||||
addOutputsBook(EMTTextHelper.localize("gui.EMT.book.aspect.output.eu.title"), text, command, astring);
|
||||
}
|
||||
|
||||
public void addOutputsBook(String title, String text, ICommandSender command, String[] astring) {
|
||||
ItemStack book = new ItemStack(Items.written_book);
|
||||
book.setTagInfo("author", new NBTTagString("Tombenpotter"));
|
||||
book.setTagInfo("title", new NBTTagString(title));
|
||||
NBTTagCompound nbttagcompound = book.getTagCompound();
|
||||
NBTTagList bookPages = new NBTTagList();
|
||||
|
||||
bookPages.appendTag(new NBTTagString(text.substring(0, 237)));
|
||||
bookPages.appendTag(new NBTTagString(text.substring(237, 476)));
|
||||
bookPages.appendTag(new NBTTagString(text.substring(476, 709)));
|
||||
bookPages.appendTag(new NBTTagString(text.substring(709)));
|
||||
|
||||
nbttagcompound.setTag("pages", bookPages);
|
||||
|
||||
System.out.println(text.length());
|
||||
ItemStack book = mkbook();
|
||||
|
||||
if (!command.getEntityWorld().getPlayerEntityByName(command.getCommandSenderName()).inventory.addItemStackToInventory(book))
|
||||
command.getEntityWorld().getPlayerEntityByName(command.getCommandSenderName()).entityDropItem(book, 0);
|
||||
|
||||
}
|
||||
|
||||
public String addStrings(String string1, String string2) {
|
||||
String result = string1 + string2;
|
||||
return result;
|
||||
public static ItemStack mkbook(){
|
||||
String text = EMTTextHelper.localize("gui.EMT.book.aspect.output.essentia.eu") + ": \n";
|
||||
String text2 = EMTTextHelper.localize("gui.EMT.book.aspect.output.essentia.eu") + " /t: \n";
|
||||
String text3 = EMTTextHelper.localize("gui.EMT.book.aspect.output.essentia.eu") + " /t singleblock: \n";
|
||||
|
||||
final String title = EMTTextHelper.localize("gui.EMT.book.aspect.output.eu.title");
|
||||
|
||||
final ArrayList<String> singleblock = new ArrayList<String>();
|
||||
final ArrayList<String> bookL = new ArrayList<String>();
|
||||
final ArrayList<String> bookL2 = new ArrayList<String>();
|
||||
|
||||
byte counter = 0;
|
||||
|
||||
for (final Aspect aspect : Aspect.aspects.values()) {
|
||||
++counter;
|
||||
|
||||
if (aspect.equals(Aspect.ENERGY)||aspect.equals(Aspect.TREE)||aspect.equals(Aspect.FIRE)||aspect.equals(Aspect.AURA)||aspect.equals(Aspect.GREED)||aspect.equals(Aspect.AIR))
|
||||
text3 = text3 + aspect.getTag() + ": " + String.valueOf(EMTEssentiasOutputs.outputs.get(aspect.getTag())/20D/20D) + "EU\n";
|
||||
|
||||
if (counter < 12){
|
||||
text2 = text2 + aspect.getTag() + ": " + String.valueOf(EMTEssentiasOutputs.outputs.get(aspect.getTag())/20D) + "EU/t\n";
|
||||
text = text + aspect.getTag() + ": " + String.valueOf(EMTEssentiasOutputs.outputs.get(aspect.getTag())) + "EU\n";
|
||||
}
|
||||
else {
|
||||
text2 = text2+ aspect.getTag() + ": " + String.valueOf(EMTEssentiasOutputs.outputs.get(aspect.getTag())/20D) + "EU\n";
|
||||
text = text + aspect.getTag() + ": " + String.valueOf(EMTEssentiasOutputs.outputs.get(aspect.getTag())) + "EU\n";
|
||||
bookL.add(text);
|
||||
bookL2.add(text2);
|
||||
text2 = new String("");
|
||||
text = new String("");
|
||||
counter = 0;
|
||||
}
|
||||
}
|
||||
|
||||
singleblock.add(text3);
|
||||
|
||||
if (counter != 0){
|
||||
bookL.add(text);
|
||||
bookL2.add(text2);
|
||||
}
|
||||
|
||||
final ItemStack book = new ItemStack(Items.written_book);
|
||||
book.setTagInfo("author", new NBTTagString("Tombenpotter, bartimaeusnek"));
|
||||
book.setTagInfo("title", new NBTTagString(title));
|
||||
final NBTTagCompound nbttagcompound = book.getTagCompound();
|
||||
final NBTTagList bookPages = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < singleblock.size(); i++) {
|
||||
bookPages.appendTag(new NBTTagString(singleblock.get(i)));
|
||||
}
|
||||
for (int i = 0; i < bookL.size(); i++) {
|
||||
bookPages.appendTag(new NBTTagString(bookL.get(i)));
|
||||
}
|
||||
for (int i = 0; i < bookL2.size(); i++) {
|
||||
bookPages.appendTag(new NBTTagString(bookL2.get(i)));
|
||||
}
|
||||
nbttagcompound.setTag("pages", bookPages);
|
||||
return book;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user