Jump to content

maxpowa

Forge Modder
  • Posts

    75
  • Joined

  • Last visited

Everything posted by maxpowa

  1. So I've managed to find this method ChatMessageComponent.func_111078_c(serializedMessage).func_111068_a(true) but when I try to use it, it crashes with the stacktrace
  2. I don't think that would be possible without changing the way fontrenderer works, though you could use a UTF-8 non-standard currency symbol -- there's a list of them here http://www.fileformat.info/info/unicode/block/currency_symbols/images.htm
  3. Lex, the problem lies in the command line arguments you're sending to the scala compiler, they changed their syntax in 2.9.0 so you probably have to change the syntax in which they are sent from the python files. '"scalac.bat" -encoding UTF-8 -deprecation -target:jvm-1.6 -classpath "jars\vers ions\1.6.2\1.6.2.jar;...' failed : 255 The syntax of the command is incorrect.
  4. Mew is actually right, if you look in the Levels class in the github, it uses that player.username a ton.
  5. I've never personally used Scala, but looking at the changelog, it looks like some command line arguments changed in 2.9.0, you might want to use the compiler version 2.8.x or below.
  6. You're trying to call Minecraft.getMinecraft() before the minecraft instance is made, try running the initConfigs() in the postinit event.
  7. Uhhh.. stack.getTagCompound().setInteger("Length", intValue);
  8. Exactly as Mew said, change player.sendChatToPlayer(String message); to player.addChatMessage(String message);
  9. Levels class is uploaded to the GitHub repo, check it out, I think it matches your per world on singleplayer and global on servers idea, as you wanted.
  10. Every bit of code I've used to help him can just as easily be adapted to yours. If you feel that I'm not helping you in particular, it's because I'm not. Frankly, Flenix has been much easier to work with, and his case can easily be modified to fit your needs. Have you even looked at the source of the TestMod I posted on my GitHub? I'll add an equivalent of your class to prove how easily the system can be adapted if you just tried.
  11. Do you have your event method set up in a different class from your main mod and like so? @ForgeSubscribe public void renderGui(RenderGameOverlayEvent event) { if (!Minecraft.isGuiEnabled()) return; // draw stuff here } and your init method @EventHandler public void initMod(FMLInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new EventHandler()); }
  12. Listen for RenderGameOverlayEvent, draw your HUD in there.
  13. Awesome You'll probably have to create if statements for each different currency item, unless you have them all using one superclass with the currency value in that, then you could iterate through each currency object and get the value simply like that and.. This is getting to be confusing in this sentence. for (CurrencyObject currency : BaseMod.currencysAddedByMod) { if (item.id == currency.id) { addMoney(currency.value); } }
  14. Woohoo! BTW, those are super-sexy ATM models, are they going to be a part of your city mod or a separate mod? I'd love to see that as a standalone currency mod
  15. NBTTagList enchlist = itemHeld.getEnchantmentTagList(); for(int i = 0; i < enchlist.tagCount(); i++) { System.out.println(enchlist.tagAt(i)); } In this, you just have to add a check if enchlist.tagAt(I) is equal to your custom enchant NBTTagList enchlist = itemHeld.getEnchantmentTagList(); for(int i = 0; i < enchlist.tagCount(); i++) { if (enchlist.tagAt(i).getInteger("id") == MainModFile.enchantShocking.enchID) { //Do what you want your enchant to do, probably shock someone. } System.out.println(enchlist.tagAt(i)); }
  16. Lawl, I ended up creating my own micromod to test this stuff, and it seems to be working -- I changed a bit of the NBT magic around, set up custom saves. https://github.com/maxpowa/TestMod
  17. Question: Would you rather have it save on a per-world basis, or per-server basis?
  18. Try using a 1.6.1 version of the source, 1.6.2 isn't officially released by Mojang yet and I've been having success with 1.6.1 builds.
  19. In fact, it won't. As long as you check to confirm that BuildCraft exists before calling any of their methods, you'll have absolutely no problems. Proof: Check out my mod's (TukMC) source. I have references to classes in the ThirstMod and IC2, and not once have I ever experienced any issues.
  20. Easiest way to modify forge files I'd say would be to download the forge src package from files.minecraftforge.net and run the install file. Open the generated eclipse environment and edit away! Once you're ready to make the pull request, push all of your changes to your forked repository.
  21. Import the API into your environment, then configure ant builds to exclude BuildCraft API packages and files. For a peek at ant build configuration, look at pretty much any popular mod. A good mod to look at is EE-3, Pahimar has quite wonderfully documented how to use Ant. Start here, and follow the instructions.
  22. If it's drastically different, you must have messed something up... Try re-setting up your environment by downloading a fresh version of the forge source package, and running the install.cmd (on windows).
  23. https://github.com/BuildCraft/BuildCraft/tree/master/common/buildcraft/api/power Maybe you should start by taking a look at the BuildCraft API. Hint: implement IPowerProvider
  24. Lets try storing the integers in variables before we try to add them. 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) { int balance = 0; if (nbt.hasKey("Balance")) balance = nbt.getInteger("Balance"); player.addChatMessage("Your Balance is: " + balance); player.openGui(FlenixCities.instance, 0, world, x, y, z); } } if (player.getHeldItem() != null) { if (player.getHeldItem().getItem() == FlenixCities.note1000) { int currentBalance = 0; if (nbt.hasKey("Balance")) currentBalance = nbt.getInteger("Balance"); int modifiedBalance = currentBalance + ItemNote10.moneyValue; nbt.setInteger("Balance", modifiedBalance); player.addChatMessage(ItemNote10.moneyValue + " Deposited! Your balance is now " + nbt.getInteger("Balance")); } } return true; }
  25. Lets try some console output debugging. @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) { System.out.println("Old balance is: "+nbt.getInteger("Balance")); System.out.println("Adding "+ItemNote10.moneyValue+" to total balance."); int newBalance = (nbt.getInteger("Balance") + ItemNote10.moneyValue); System.out.println("New balance is: "+newBalance); nbt.setInteger("Balance", newBalance); System.out.println("Balance confirm:"+nbt.getInteger("Balance")); player.addChatMessage(ItemNote10.moneyValue + " Deposited! Your balance is now " + nbt.getInteger("Balance")); } } return true; } Try that a few times and check if the output is what it should be.
×
×
  • Create New...

Important Information

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