Jump to content

maxpowa

Forge Modder
  • Posts

    75
  • Joined

  • Last visited

Everything posted by maxpowa

  1. Hmmm... Try using NBTExplorer and check if the NBT objects are actually created in the level.dat. The Balance key should be in saves/<worldname>/players/<playername> , let me know if it's not there.
  2. Capitalization matters! @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float j, float k, float l) { TileEntity tileEntity = world.getBlockTileEntity(x, y, z); NBTTagCompound nbt = player.getEntityData().getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG); if (player.getHeldItem() != null) { if (player.getHeldItem().getItem() == FlenixCities.debitCard) { player.addChatMessage("Your Balance is: " + nbt.getInteger("Balance")); player.openGui(FlenixCities.instance, 0, world, x, y, z); } } if (player.getHeldItem() != null) { if (player.getHeldItem().getItem() == FlenixCities.note1000) { nbt.setInteger("Balance", (nbt.getInteger("Balance") + ItemNote10.moneyValue)); player.addChatMessage(ItemNote10.moneyValue + " Deposited! Your balance is now " + nbt.getInteger("Balance")); } } return true; }
  3. You should be able to, can I see your code now?
  4. I looked in the vanilla classes which used to use that bindTexture method, then checked what they had changed to when my methods no longer worked. As for saving issues, I think it might have been a fault on my part... Try changing this: NBTTagCompound nbt = player.getEntityData(); to this: NBTTagCompound nbt = player.getEntityData().getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG);
  5. As for the memory heap, just add an argument to the startup parameters of minecraft -Xms=1024m -Xmx=1024m
  6. Yes. I need to see all of your config code. I have my doubts as to whether you're using it right anyway... Besides, you can't ship the config file with your mod. Sorry to revive this old thread a bit, but you actually can. <ClassName>.class.getClassLoader().getResourceAsStream("filename.extension"); You can even extend that to extracting other mod dependencies from your package into the mods folder if you feel so inclined! A nice little method to do so, localName is the name of the file inside the package, filesystemLocation is where you want to put it once it is loaded. (Ensure you include extensions) private static void extractFile(String localName, String filesystemLocation) throws IOException { File target = new File(filesystemLocation); if (target.exists()) return; FileOutputStream out = new FileOutputStream(target); InputStream in = LoadShippedConfig.class.getClassLoader().getResourceAsStream(localName); byte[] buf = new byte[8*1024]; int len; while((len = in.read(buf)) != -1) { out.write(buf,0,len); } out.close(); in.close(); }
  7. Come on guys, someone has to know this!!
  8. It's a really simple fix for that, take your old: mc.renderengine.bindTexture("texloc/wherever/yours/is"); and edit them to be: mc.func_110434_K().func_110577_a(new ResourceLocation("texloc/wherever/yours/is"));
  9. Use a command? An eventlistener for rightclick with a certain item? I don't know, you could use pretty much any event trigger... For current NBT value, it's just Integer currentBalance = nbt.getInteger("Balance");
  10. Whenever you change a value, you have to use nbt.setInteger instead of nbt.getInteger. nbt.setInteger("MiningXp", nbt.getInteger("MiningXp")+1);
  11. Thanks ShetiPhian, but I just ended up doing this: public static ServerData getServerData() { Minecraft mc = Minecraft.getMinecraft(); ServerData serverData = null; for (Field field : Minecraft.class.getDeclaredFields()) { if (field.getType() == ServerData.class) { field.setAccessible(true); try { serverData = (ServerData)field.get(mc); } catch (Exception e) { System.out.println("[TukMC] Unable to find server information (" e.getCause().toString()")"); } } } return serverData; }
  12. I hate bumping, but I really need help with this, I've tried event.message = I18n.func_135053_a(event.message); event.message = EnumChatFormatting.func_110646_a(event.message); event.message = new StringTranslate().translateKey(event.message); And none of them work...
  13. Get the player's NBT object, NBTTagCompound nbt = player.getEntityData(); then nbt.set<OBJECTTYPE>("keyofobject", valueofobject); and replace <OBJECTTYPE> with the type of object you want to store. (ie; Boolean, int, String) So for a number (lets just say that the number is a float) NBTTagCompound nbt = player.getEntityData(); nbt.setFloat("examplefloat", 1.3F); That's all you need to set it. Then to get it, you simply use the player object again. NBTTagCompound nbt = player.getEntityData(); float value = nbt.getFloat("examplefloat");
  14. Well, I can't help you anymore without seeing any code.
  15. particles.png doesn't have anything to do with the hook? Really? Did you look in particles.png? [/img] Looking at that texture file, there is clearly a hook... 2nd from left, 3rd row down.
  16. The strikethrough means that the method is deprecated. All you have to do is add a string to your arguments, ie; GameRegistry.registerBlock(BlockDutarBlock, "blockDutar");
  17. With NBT you can load it from anywhere.... Just make sure you have the player object and bam, ability to load from anywhere.
  18. You don't need the hashmap though, if you're saving and getting from the NBT compound! package mods.cyphereion.cyphscape.levels; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; public final class Levels { /** * The total Mining Experience. */ public static int MiningXp = 0; /** * The total Mining Level. */ public static int MiningLevel = 0; /** * The total smithing xp. */ public static int SmithingXp = 0; /** * The total smithing Level. */ public static int SmithingLevel = 0; public static void saveLevelDataForPlayer(EntityPlayer player){ NBTTagCompound nbt = player.getEntityData(); nbt.setInteger("MiningXp", MiningXp); nbt.setInteger("MiningLevel", MiningLevel); nbt.setInteger("SmithingXp", SmithingXp); nbt.setInteger("SmithingLevel", SmithingLevel); } public static void getLevelDataForPlayer(EntityPlayer player){ NBTTagCompound nbt = player.getEntityData(); MiningXp = nbt.getInteger("MiningXp"); MiningLevel = nbt.getInteger("MiningLevel"); SmithingXp = nbt.getInteger("SmithingXp"); SmithingLevel = nbt.getInteger("SmithingLevel"); } public int getMiningXpForPlayer(EntityPlayer player){ NBTTagCompound nbt = player.getEntityData(); return nbt.getInteger("MiningXp"); } public void saveMiningXpForPlayer(EntityPlayer player){ NBTTagCompound nbt = player.getEntityData(); nbt.setInteger("MiningXp", MiningXp); } public int getSmithingXpForPlayer(EntityPlayer player){ NBTTagCompound nbt = player.getEntityData(); return nbt.getInteger("SmithingXp"); } public void saveSmithingXpForPlayer(EntityPlayer player){ NBTTagCompound nbt = player.getEntityData(); nbt.setInteger("SmithingXp", SmithingXp); } }
  19. Well for the pumpkin type, for one, I'd take a guess and say that you should look at the methods in BlockStem... public void fertilizeStem(World par1World, int par2, int par3, int par4) { int l = par1World.getBlockMetadata(par2, par3, par4) + MathHelper.getRandomIntegerInRange(par1World.rand, 2, 5); if (l > 7) { l = 7; } par1World.setBlockMetadataWithNotify(par2, par3, par4, l, 2); }
  20. It will if you define a proper path to the texture file. Read some of the other threads on 1.6 mob rendering for more information on that.
  21. Well you're kinda missing the entire read/write nbt parts... public static void hashSaving(EntityPlayer player){ NBTTagCompound nbt = player.getEntityData(); nbt.setInteger("MiningXp", MiningXp); nbt.setInteger("MiningLevel", MiningLevel); nbt.setInteger("SmithingXp", SmithingXp); nbt.setInteger("SmithingLevel", SmithingLevel); } public int getMiningXp(EntityPlayer player){ NBTTagCompound nbt = player.getEntityData(); return nbt.getInteger("MiningXp"); } public int getSmithingXp(EntityPlayer player){ NBTTagCompound nbt = player.getEntityData(); return nbt.getInteger("SmithingXp"); } Edit: Tab-space derp
  22. If it can't be resolved to a variable that means you don't declare the object "texture" in the current class (this) String texture = null; Integer texture = null; Object texture = null; Depending on the usage, any of those should fix the type problem, but if you don't set it to anything you will encounter NPEs. Seriously though, if you don't know all of this already, go learn java.
  23. What method do I pass messages through to strip them of their translation/color data and return the proper formatted/translated string? I know I used to have to use StringTranslate.getInstance().translateString(s) but that no longer exists... I've looked in the other chat classes, but they use an obfuscated class (I18n.java) and method that does nothing to the chat strings... Example of what the obfuscated class (I18n.java) and method returns [/img]
  24. I need the serverdata simply to show servername and ip (hidden if hidden in the serverlist) above the playerlist gui. I used reflection, but it causes issues because I'm not sure what the obfuscated name is... And I'm trying to stay away from becoming a coremod...
  25. Honestly, nobody should be deeming it "stable" until it becomes a recommended on files.minecraftforge.net . Until then, it's too unstable for public use.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.