Jump to content

deadrecon98

Forge Modder
  • Posts

    316
  • Joined

Everything posted by deadrecon98

  1. RE: I do not understand that post, I really just do not get what he is saying to do.
  2. And it might help, ill keep you posted.
  3. For the last time dude, I know the basics.
  4. then i suggest learning "advanced" java... or rethinking your definition of "basic". i remember your old thread and all you needed to know was already posted in it multiple times. people even posted code for you. the only thing stopping you from making your stuff work was.. well, not having a firm grasp of basic java.. Enough of this. If anyone can help me then reply, if not then do not even bother. I'm not trying to be rude but this is ridiculous.
  5. I understand this but it still doesn't change the fact that it does not work.
  6. Dude I know basic java, Im here for help on something that has nothing to do with learning basic java.
  7. Still wont work...
  8. Nope, did not fix it.
  9. Because the code I need cannot be used. Let me explain.. try{ compound = whatever; }catch{ //Exception Here } I cannot use compound anywhere else except for the try/catch statement. Initiliaze the variable outside of the try catch like this NBT compound = null; try{ compound = CompressedStreamTools.read(stream); }catch(Exception e){//handle} now you can access the compound variable anywhere. compound.whatEverTheHellYouNeed(); ******* If it helps toss me a thank you. Umm dude, it doesn't work... Error: 2013-10-31 18:28:38 [iNFO] [sTDERR] java.lang.NullPointerException 2013-10-31 18:28:38 [iNFO] [ForgeModLoader] The state engine was in incorrect state SERVER_STOPPING and forced into state SERVER_STOPPED. Errors may have been discarded. 2013-10-31 18:28:38 [iNFO] [sTDERR] at bossesPlus.item.nether.ItemNetherSpellBook.onItemRightClick(ItemNetherSpellBook.java:55) 2013-10-31 18:28:38 [iNFO] [sTDERR] at net.minecraft.item.ItemStack.useItemRightClick(ItemStack.java:173) 2013-10-31 18:28:38 [iNFO] [sTDERR] at net.minecraft.client.multiplayer.PlayerControllerMP.sendUseItem(PlayerControllerMP.java:423) 2013-10-31 18:28:38 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.clickMouse(Minecraft.java:1343) 2013-10-31 18:28:38 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.runTick(Minecraft.java:1800) 2013-10-31 18:28:38 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:835) 2013-10-31 18:28:38 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.run(Minecraft.java:760) 2013-10-31 18:28:38 [iNFO] [sTDERR] at java.lang.Thread.run(Unknown Source) My class: package bossesPlus.item.nether; import ibxm.Player; import java.io.DataInputStream; import java.util.List; import bossesPlus.biomeGenBase.MobPackage.Telluris.EntityTellurose; import bossesPlus.core.Core; import net.minecraft.client.texturepacks.GuiTexturePacks; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.item.EntityTNTPrimed; import net.minecraft.entity.passive.EntityWolf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.src.ModLoader; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumMovingObjectType; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class ItemNetherSpellBook extends Item{ private int index; public ItemNetherSpellBook(int par1) { super(par1); this.setMaxStackSize(1); } public EnumAction getItemUseAction(ItemStack itemstack) { return EnumAction.none; } public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) { boolean ActivateSpell = false; NBTTagCompound nbt = null; DataInputStream stream = new DataInputStream(this.getClass().getResourceAsStream("NetherSpellBook.dat")); try{ nbt = CompressedStreamTools.read(stream); }catch(Exception e){ e.printStackTrace(); } nbt.setInteger("Test", nbt.getInteger("Test") + 1); entityplayer.sendChatToPlayer("" + nbt.getInteger("Test")); return itemstack; } public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add("A Spellbook."); } }
  10. Because the code I need cannot be used. Let me explain.. try{ compound = whatever; }catch{ //Exception Here } I cannot use compound anywhere else except for the try/catch statement. Initiliaze the variable outside of the try catch like this NBT compound = null; try{ compound = CompressedStreamTools.read(stream); }catch(Exception e){//handle} now you can access the compound variable anywhere. compound.whatEverTheHellYouNeed(); ******* If it helps toss me a thank you. Yes! Thank you! I can now access it from outside of the try/catch.
  11. Because the code I need cannot be used. Let me explain.. try{ NBT compound = whatever; }catch{ //Exception Here } I cannot use compound anywhere else except for the try/catch statement.
  12. *Cough* I have to call it outside of the try/catch. I can use it inside but it will not work for what I need.
  13. ...Handle the IOException. [spoiler=Hint] try/catch The code still does not work, it is not able to be used outside of the try/catch method.
  14. Default constructor cannot handle exception type IOException thrown by implicit super constructor. Must define an explicit constructor on NBTTagCompound compound = CompressedStreamTools.read(stream); Does the same on every class.
  15. Yes, but how would I get the server to save it?
  16. I am sorry but I do not see how that would work seeing that I need the server to be able to read and write to the same file. You only need to read at one point: When the server starts You only need to write at one point: When the server stops (There's one additional write operation: if the file to read doesn't exist, initialize it). There's no reason to be reading and writing to the same file at the same time (although you can). That said: Take a look at this post. It will allow you to create and read an arbitrary NBT data file. Well the thing is that it will be constantly be edited.
  17. I could try but I have never gotten that to work quiet right.
  18. I am sorry but I do not see how that would work seeing that I need the server to be able to read and write to the same file.
  19. I mean like an nbt save or something so that it will always be there even if you close the game.
  20. I am going to try this again(even though last time it just ended up in a fit of frustration) to get something to save server-side. I have tried many many times to get this to work but no matter how hard I try I cannot get it to work properly. But as the title says, is all I need is to save an integer to the server(and for the client to get). I am going to say however that if you had helped me before on this and I was being mean to you I want to say sorry. Like I said I was just very frustrated that I could not get it to work and I am sorry for that. But other than that please feel free to post your solution!
  21. It doesn't matter how you do it because I know for a fact my way works. It may just take a little tweaking but it is working fine for me.
  22. Ok look here buddy. I'm going to rock your world just use this. The code is a bit outdated but it should work mostly. Hope it works! Crafting Handler: package cyphereion.mods.patches.yogpack; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import cpw.mods.fml.common.ICraftingHandler; public class CraftingHandler implements ICraftingHandler { @Override public void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix) { for (int i = 0; i < craftMatrix.getSizeInventory(); i++) { if (craftMatrix.getStackInSlot(i) != null) { ItemStack j = craftMatrix.getStackInSlot(i); if (j.getItem() != null && j.getItem() == ITEM) { ItemStack k = new ItemStack(ITEM, 2, (j.getItemDamage() + 1)); if (k.getItemDamage() >= k.getMaxDamage()) { k.stackSize--; } craftMatrix.setInventorySlotContents(i, k); } } } } @Override public void onSmelting(EntityPlayer player, ItemStack item) { } } Item Class (Just for reference): package cyphereion.mods.patches.yogpack; import java.util.List; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class ItemTransmorgrificationCrystal extends Item { private int index; public ItemTransmorgrificationCrystal(int par1, int index) { super(par1); this.index = index; this.setMaxStackSize(1); this.setMaxDamage(150); this.setCreativeTab(CreativeTabs.tabMaterials); } @SideOnly(Side.CLIENT) public String getTextureFile(){ return "/cyphereion/mods/patches/yogpack/Cyphereion.png"; } public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { par3List.add("Stone brick to hold it together."); par3List.add("Obsidian to make it tough to break"); par3List.add("Diamond for good looks."); } @SideOnly(Side.CLIENT) public int getIconFromDamage(int i){ return index; } } Recipes: GameRegistry.addShapelessRecipe(new ItemStack(TransmorgrificationCrystal, 1, 0), Block.stoneBrick, Block.stoneBrick, Block.stoneBrick, Block.stoneBrick, Block.obsidian, Block.obsidian, Block.obsidian, Block.obsidian, Item.diamond); GameRegistry.addRecipe(new ItemStack(Item.blazeRod, 7),new Object[] { "OTG",'O', Block.obsidian, 'G', Block.blockGold, 'T', (new ItemStack(TransmorgrificationCrystal,1,-1))});
  23. Animated Png? Or you could look at the mc renderer.
  24. Just overall lol they keep changing stuff.
×
×
  • Create New...

Important Information

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