From f39e8134fcef5da8bd04503c5233b2b6de249b3a Mon Sep 17 00:00:00 2001 From: Alkalus Date: Sat, 28 Mar 2020 02:09:24 +0000 Subject: + Added more 'Special Behaviour' items for my multiblocks as Examples. + Added '/gtpp hand' command. + Added TungstenSteel & Neutronium tool variants to NEI while in dev. + Added Large Semifluid Generator and a crafting recipe for it. + Added Placeholder for Adv. Assembly Line. + Added Distillus Upgrade Chip and a crafting recipe for it. % Updated build.gradle. % Reworked a few recipes. $ Fixed ULV Overflow Covers using 0L Water in assembler. (https://github.com/GTNewHorizons/NewHorizons/issues/5700) $ Fixed Integral Encasement I using 0L Steel in assembler. (https://github.com/GTNewHorizons/NewHorizons/issues/5617) $ Fixed Thaumcraft based FakePlayer's triggering Fluorite drops. (https://github.com/GTNewHorizons/NewHorizons/issues/5744) $ Fixed bad handling of hatch textures on a few multiblocks. $ Semi-Fixed Distillus. $ Fixed Semifluid Generator recipes. $ Fixed Semifluid Generators crashing the game when mined. $ Fixed bad handling of calls to ItemList.java. $ Began work fixing all ASM to be more compatible with ProGuard. $ Fixed compiler complaining about varargs. ^ Bumped version to 1.7.05.x. --- .../commands/CommandEnableDebugWhileRunning.java | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) (limited to 'src/Java/gtPlusPlus/core/commands') diff --git a/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java b/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java index 06b6f14822..adcaa1db70 100644 --- a/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java +++ b/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java @@ -2,15 +2,22 @@ package gtPlusPlus.core.commands; import java.util.ArrayList; import java.util.List; +import java.util.Map; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.NBTUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.preloader.asm.AsmConfig; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; @@ -84,6 +91,27 @@ public class CommandEnableDebugWhileRunning implements ICommand AsmConfig.disableAllLogging = Utils.invertBoolean(AsmConfig.disableAllLogging); PlayerUtils.messagePlayer(P, "Toggled GT++ Logging - Enabled: "+(!AsmConfig.disableAllLogging)); } + /* else if (argString[0].toLowerCase().equals("test")) { + ItemStack mSemiFluidgen = ItemUtils.simpleMetaStack("IC2:blockGenerator", 7, 1); + final EntityPlayer P = CommandUtils.getPlayer(S); + if(mSemiFluidgen != null) { + PlayerUtils.messagePlayer(P, ItemUtils.getItemName(mSemiFluidgen)); + } + }*/ + else if (argString[0].toLowerCase().equals("hand")) { + final EntityPlayer P = CommandUtils.getPlayer(S); + if (P != null) { + ItemStack aHeldItem = PlayerUtils.getItemStackInPlayersHand(P); + if (aHeldItem != null) { + String aItemDisplayName = ItemUtils.getItemName(aHeldItem); + String aNbtString = tryIterateNBTData(aHeldItem); + PlayerUtils.messagePlayer(P, "["+aItemDisplayName+"] "+aNbtString); + } + else { + PlayerUtils.messagePlayer(P, "No item held."); + } + } + } else { final EntityPlayer P = CommandUtils.getPlayer(S); PlayerUtils.messagePlayer(P, "Invalid command, use '?' as an argument for help.'"); @@ -117,5 +145,35 @@ public class CommandEnableDebugWhileRunning implements ICommand public boolean playerUsesCommand(final World W, final EntityPlayer P, final int cost){ return true; } + + public static String tryIterateNBTData(ItemStack aStack) { + try { + AutoMap aItemDataTags = new AutoMap(); + NBTTagCompound aNBT = NBTUtils.getNBT(aStack); + if (aNBT != null) { + if (!aNBT.hasNoTags()) { + Map mInternalMap = ReflectionUtils.getField(aNBT, "tagMap"); + if (mInternalMap != null) { + for (Map.Entry e : mInternalMap.entrySet()) { + aItemDataTags.add(e.getKey().toString()+":"+e.getValue()); + } + int a = 0; + String data = ""; + for (String tag : aItemDataTags) { + data += (tag+","); + } + if (data.endsWith(",")) { + data = data.substring(0, data.length()-2); + } + return data; + } else { + Logger.INFO("Data map reflected from NBTTagCompound was not valid."); + return "Bad NBT"; + } + } + } + } catch (Throwable t) {} + return ""; + } } \ No newline at end of file -- cgit