Jump to content

TLHPoE

Members
  • Posts

    638
  • Joined

  • Last visited

Everything posted by TLHPoE

  1. I added null checks, and if it was null, I created the NBT. It crashes on Right Click (I craft it and then right click it, still not information) http://pastebin.com/j9dXXEC3 2013-09-21 19:20:44 [iNFO] [sTDERR] net.minecraft.util.ReportedException: Reading NBT data 2013-09-21 19:20:44 [iNFO] [sTDERR] at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:63) 2013-09-21 19:20:44 [iNFO] [sTDERR] at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109) 2013-09-21 19:20:44 [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691) 2013-09-21 19:20:44 [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587) 2013-09-21 19:20:44 [iNFO] [sTDERR] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129) 2013-09-21 19:20:44 [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484) 2013-09-21 19:20:44 [iNFO] [sTDERR] at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16) 2013-09-21 19:20:44 [iNFO] [sTDERR] Caused by: java.lang.ClassCastException: net.minecraft.nbt.NBTTagFloat cannot be cast to net.minecraft.nbt.NBTTagInt 2013-09-21 19:20:44 [iNFO] [sTDERR] at net.minecraft.nbt.NBTTagCompound.getInteger(NBTTagCompound.java:233) 2013-09-21 19:20:44 [iNFO] [sTDERR] at tlhpoe.darkorigins.item.ItemExpContainer.onItemRightClick(ItemExpContainer.java:101) 2013-09-21 19:20:44 [iNFO] [sTDERR] at net.minecraft.item.ItemStack.useItemRightClick(ItemStack.java:176) 2013-09-21 19:20:44 [iNFO] [sTDERR] at net.minecraft.item.ItemInWorldManager.tryUseItem(ItemInWorldManager.java:353) 2013-09-21 19:20:44 [iNFO] [sTDERR] at net.minecraft.network.NetServerHandler.handlePlace(NetServerHandler.java:542) 2013-09-21 19:20:44 [iNFO] [sTDERR] at net.minecraft.network.packet.Packet15Place.processPacket(Packet15Place.java:79) 2013-09-21 19:20:44 [iNFO] [sTDERR] at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89) 2013-09-21 19:20:44 [iNFO] [sTDERR] at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141) 2013-09-21 19:20:44 [iNFO] [sTDERR] at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54) 2013-09-21 19:20:44 [iNFO] [sTDERR] ... 6 more 2013-09-21 19:20:44 [sEVERE] [Minecraft-Server] Encountered an unexpected exception ReportedException net.minecraft.util.ReportedException: Reading NBT data at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:63) at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484) at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16) Caused by: java.lang.ClassCastException: net.minecraft.nbt.NBTTagFloat cannot be cast to net.minecraft.nbt.NBTTagInt at net.minecraft.nbt.NBTTagCompound.getInteger(NBTTagCompound.java:233) at tlhpoe.darkorigins.item.ItemExpContainer.onItemRightClick(ItemExpContainer.java:101) at net.minecraft.item.ItemStack.useItemRightClick(ItemStack.java:176) at net.minecraft.item.ItemInWorldManager.tryUseItem(ItemInWorldManager.java:353) at net.minecraft.network.NetServerHandler.handlePlace(NetServerHandler.java:542) at net.minecraft.network.packet.Packet15Place.processPacket(Packet15Place.java:79) at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89) at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141) at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54) ... 6 more 2013-09-21 19:20:44 [sEVERE] [Minecraft-Server] This crash report has been saved to: C:\Users\Kavin\Desktop\Programming\Java\Modding\RPG Additions\forge\mcp\jars\.\crash-reports\crash-2013-09-21_19.20.44-server.txt 2013-09-21 19:20:44 [iNFO] [Minecraft-Server] Stopping server 2013-09-21 19:20:44 [iNFO] [Minecraft-Server] Saving players 2013-09-21 19:20:44 [iNFO] [Minecraft-Server] Player193 left the game 2013-09-21 19:20:44 [iNFO] [Minecraft-Server] Saving worlds 2013-09-21 19:20:44 [iNFO] [Minecraft-Server] Saving chunks for level 'New World'/Overworld 2013-09-21 19:20:44 [iNFO] [Minecraft-Server] Saving chunks for level 'New World'/Nether 2013-09-21 19:20:44 [iNFO] [Minecraft-Server] Saving chunks for level 'New World'/The End 2013-09-21 19:20:45 [iNFO] [ForgeModLoader] Unloading dimension 0 2013-09-21 19:20:45 [iNFO] [ForgeModLoader] Unloading dimension -1 2013-09-21 19:20:45 [iNFO] [ForgeModLoader] Unloading dimension 1 2013-09-21 19:20:45 [iNFO] [ForgeModLoader] The state engine was in incorrect state SERVER_STOPPING and forced into state SERVER_STOPPED. Errors may have been discarded. 2013-09-21 19:20:45 [iNFO] [sTDERR] net.minecraft.util.ReportedException: Reading NBT data 2013-09-21 19:20:45 [iNFO] [sTDERR] at net.minecraft.nbt.NBTTagCompound.getInteger(NBTTagCompound.java:237) 2013-09-21 19:20:45 [iNFO] [sTDERR] at tlhpoe.darkorigins.item.ItemExpContainer.onItemRightClick(ItemExpContainer.java:101) 2013-09-21 19:20:45 [iNFO] [sTDERR] at net.minecraft.item.ItemStack.useItemRightClick(ItemStack.java:176) 2013-09-21 19:20:45 [iNFO] [sTDERR] at net.minecraft.client.multiplayer.PlayerControllerMP.sendUseItem(PlayerControllerMP.java:428) 2013-09-21 19:20:45 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.clickMouse(Minecraft.java:1415) 2013-09-21 19:20:45 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.runTick(Minecraft.java:1866) 2013-09-21 19:20:45 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:908) 2013-09-21 19:20:45 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.run(Minecraft.java:836) 2013-09-21 19:20:45 [iNFO] [sTDERR] at net.minecraft.client.main.Main.main(Main.java:93) 2013-09-21 19:20:45 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2013-09-21 19:20:45 [iNFO] [sTDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 2013-09-21 19:20:45 [iNFO] [sTDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 2013-09-21 19:20:45 [iNFO] [sTDERR] at java.lang.reflect.Method.invoke(Unknown Source) 2013-09-21 19:20:45 [iNFO] [sTDERR] at net.minecraft.launchwrapper.Launch.launch(Launch.java:131) 2013-09-21 19:20:45 [iNFO] [sTDERR] at net.minecraft.launchwrapper.Launch.main(Launch.java:27) 2013-09-21 19:20:45 [iNFO] [sTDERR] Caused by: java.lang.ClassCastException: net.minecraft.nbt.NBTTagFloat cannot be cast to net.minecraft.nbt.NBTTagInt 2013-09-21 19:20:45 [iNFO] [sTDERR] at net.minecraft.nbt.NBTTagCompound.getInteger(NBTTagCompound.java:233) 2013-09-21 19:20:45 [iNFO] [sTDERR] ... 14 more 2013-09-21 19:20:45 [iNFO] [sTDOUT] ---- Minecraft Crash Report ---- 2013-09-21 19:20:45 [iNFO] [sTDOUT] // I bet Cylons wouldn't have this problem. 2013-09-21 19:20:45 [iNFO] [sTDOUT] 2013-09-21 19:20:45 [iNFO] [sTDOUT] Time: 9/21/13 7:20 PM 2013-09-21 19:20:45 [iNFO] [sTDOUT] Description: Reading NBT data 2013-09-21 19:20:45 [iNFO] [sTDOUT] 2013-09-21 19:20:45 [iNFO] [sTDOUT] java.lang.ClassCastException: net.minecraft.nbt.NBTTagFloat cannot be cast to net.minecraft.nbt.NBTTagInt 2013-09-21 19:20:45 [iNFO] [sTDOUT] at net.minecraft.nbt.NBTTagCompound.getInteger(NBTTagCompound.java:233) 2013-09-21 19:20:45 [iNFO] [sTDOUT] at tlhpoe.darkorigins.item.ItemExpContainer.onItemRightClick(ItemExpContainer.java:101) 2013-09-21 19:20:45 [iNFO] [sTDOUT] at net.minecraft.item.ItemStack.useItemRightClick(ItemStack.java:176) 2013-09-21 19:20:45 [iNFO] [sTDOUT] at net.minecraft.client.multiplayer.PlayerControllerMP.sendUseItem(PlayerControllerMP.java:428) 2013-09-21 19:20:45 [iNFO] [sTDOUT] at net.minecraft.client.Minecraft.clickMouse(Minecraft.java:1415) 2013-09-21 19:20:45 [iNFO] [sTDOUT] at net.minecraft.client.Minecraft.runTick(Minecraft.java:1866) 2013-09-21 19:20:45 [iNFO] [sTDOUT] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:908) 2013-09-21 19:20:45 [iNFO] [sTDOUT] at net.minecraft.client.Minecraft.run(Minecraft.java:836) 2013-09-21 19:20:45 [iNFO] [sTDOUT] at net.minecraft.client.main.Main.main(Main.java:93) 2013-09-21 19:20:45 [iNFO] [sTDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2013-09-21 19:20:45 [iNFO] [sTDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 2013-09-21 19:20:45 [iNFO] [sTDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 2013-09-21 19:20:45 [iNFO] [sTDOUT] at java.lang.reflect.Method.invoke(Unknown Source) 2013-09-21 19:20:45 [iNFO] [sTDOUT] at net.minecraft.launchwrapper.Launch.launch(Launch.java:131) 2013-09-21 19:20:45 [iNFO] [sTDOUT] at net.minecraft.launchwrapper.Launch.main(Launch.java:27) 2013-09-21 19:20:45 [iNFO] [sTDOUT] 2013-09-21 19:20:45 [iNFO] [sTDOUT] 2013-09-21 19:20:45 [iNFO] [sTDOUT] A detailed walkthrough of the error, its code path and all known details is as follows: 2013-09-21 19:20:45 [iNFO] [sTDOUT] --------------------------------------------------------------------------------------- 2013-09-21 19:20:45 [iNFO] [sTDOUT] 2013-09-21 19:20:45 [iNFO] [sTDOUT] -- Corrupt NBT tag -- 2013-09-21 19:20:45 [iNFO] [sTDOUT] Details: 2013-09-21 19:20:45 [iNFO] [sTDOUT] Tag type found: FLOAT 2013-09-21 19:20:45 [iNFO] [sTDOUT] Tag type expected: INT 2013-09-21 19:20:45 [iNFO] [sTDOUT] Tag name: stored 2013-09-21 19:20:45 [iNFO] [sTDOUT] Stacktrace: 2013-09-21 19:20:45 [iNFO] [sTDOUT] at net.minecraft.nbt.NBTTagCompound.getInteger(NBTTagCompound.java:233) 2013-09-21 19:20:45 [iNFO] [sTDOUT] at tlhpoe.darkorigins.item.ItemExpContainer.onItemRightClick(ItemExpContainer.java:101) 2013-09-21 19:20:45 [iNFO] [sTDOUT] at net.minecraft.item.ItemStack.useItemRightClick(ItemStack.java:176) 2013-09-21 19:20:45 [iNFO] [sTDOUT] at net.minecraft.client.multiplayer.PlayerControllerMP.sendUseItem(PlayerControllerMP.java:428) 2013-09-21 19:20:45 [iNFO] [sTDOUT] at net.minecraft.client.Minecraft.clickMouse(Minecraft.java:1415)
  2. I'm currently trying to add NBT tags to my item when it's created, but it never adds the tags nor the information. package tlhpoe.darkorigins.item; import java.awt.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.World; import tlhpoe.darkorigins.helper.CreativeTabHelper; import tlhpoe.darkorigins.util.InfoUtil; public class ItemExpContainer extends ItemBase { public ItemExpContainer(int id, String name) { super(id, name); setMaxStackSize(1); setUnlocalizedName(name); setCreativeTab(CreativeTabHelper.items); } @Override public void onCreated(ItemStack itemstack, World world, EntityPlayer player) { itemstack.stackTagCompound = new NBTTagCompound(); itemstack.stackTagCompound.setFloat("stored", 0.0F); itemstack.stackTagCompound.setInteger("mode", 0); } public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean par4) { if (itemStack.stackTagCompound != null) { float amount = itemStack.stackTagCompound.getFloat("stored"); int mode = itemStack.stackTagCompound.getInteger("mode"); String modeD = ""; switch(mode) { case(0):{modeD = "Deposit";} case(1):{modeD = "Withdraw";} } list.add("Exp Stored: " + amount); list.add("Mode: " + modeD); } } @Override public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) { if(player.isSneaking()) { int mode = itemstack.stackTagCompound.getInteger("mode"); switch(mode) { case(0):{itemstack.stackTagCompound.setInteger("mode", 1);} case(1):{itemstack.stackTagCompound.setInteger("mode", 0);} } } if(!player.isSneaking()) { int mode = itemstack.stackTagCompound.getInteger("mode"); float xp = itemstack.stackTagCompound.getInteger("stored"); switch(mode) { case(0): { if(player.experienceLevel >= 1) { player.experienceLevel--; itemstack.stackTagCompound.setFloat("stored", xp++); } } case(1): { if(xp >= 1) { player.experienceLevel++; itemstack.stackTagCompound.setFloat("stored", xp--); } } } } return itemstack; } }
  3. Umm, not really. Check out this link to see how to use NBT Tags: http://www.minecraftforge.net/wiki/Item_nbt
  4. The best way, in my opinion, is to: 1. Make an NBT tag for the kills to be stored in 2. Detect when the tool successfully kills the mob and add to the NBT tag 3. Use the addInformation method to display the kills
  5. I'm trying to make a staff kind of weapon. My plan is for it to cast lightning where ever the player is looking, but how would I get the block that the player is looking at?
  6. Thanks.
  7. Do you want to write to it's NBT? You could easily use an event or write to the world's NBT.
  8. How would I check if the entity got killed by a player?
  9. Finally fixed my problem, I forgot that I needed to use a class that implements IWorldGenerator and use another class that extended WorldGenerator.
  10. Ok, they actually spawned. But they spawned in a large group of 1 big thick pool. Most of the flowers were on top of tall grass blocks though.
  11. Aghh, won't generate anything or print anything. package tlhpoe.rpgadditions.worldgen; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import tlhpoe.rpgadditions.helper.BlockHelper; import tlhpoe.rpgadditions.util.InfoUtil; import cpw.mods.fml.common.IWorldGenerator; public class WorldGenEverything implements IWorldGenerator { @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { for(int l = 0; l < 64; ++l) { int x = chunkX + random.nextInt(16); int y = 128; int z = chunkZ + random.nextInt(16); while(!(world.getBlockId(x, y, z) == Block.grass.blockID || world.getBlockId(x, y, z) == Block.sand.blockID) && y > 64) {--y;} if(world.getBlockId(x, y, z) == Block.grass.blockID || world.getBlockId(x, y, z) == Block.sand.blockID) {continue;} world.setBlock(x, y+1, z, BlockHelper.heartFlower.blockID, 0, 2); } } }
  12. I've been tinkering with it, and I came up with this: http://pastebin.com/4cUHcM23 It just pauses at the Building terrain. Nothing else in console. Did I jack up a while loop?
  13. How do I trace through with the debugger? Not so great with Eclipse.
  14. I'm currently trying to make my GUI open when the player opens their inventory. I crash when I open my inventory, and throws a NPE on line 23 (the line where I use the openGUI method). The part that seems very sketchy to me, is the last 3 ints in the method. I have no clue what they're for. package tlhpoe.rpgadditions.handlers; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiInventory; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.client.event.GuiOpenEvent; import net.minecraftforge.event.EventPriority; import net.minecraftforge.event.ForgeSubscribe; import tlhpoe.rpgadditions.RPGAdditions; public class GuiEventHandler { @ForgeSubscribe(priority = EventPriority.NORMAL) public void onRenderInventory(GuiOpenEvent event) { if(event.gui instanceof GuiInventory) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; player.openGui(RPGAdditions.instance, 0, player.worldObj, (int)player.posX, (int)player.posY, (int)player.posZ); } } }
  15. Never mind, found the GuiOpenEvent
  16. Is there anyway to detect this? Like an event or do I have to detect when the player hits the inventory bind key.
  17. Thanks, it worked.
  18. I edited my code a little, and it only printed 0 (which I'm guessing is the air block ID). Here's my canBlockStay method: WorldGenEverything:
  19. Everything prints except for HI3 :I
  20. I registered it, and did all the changes. Still not generating. package tlhpoe.worldgen; import java.util.Random; import tlhpoe.helper.BlockHelper; import net.minecraft.block.Block; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import cpw.mods.fml.common.IWorldGenerator; public class WorldGenEverything implements IWorldGenerator { @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { for(int l = 0; l < 64; ++l) { int x = chunkX; int y = 128; int z = chunkZ; while(!world.doesBlockHaveSolidTopSurface(x, y, z) && y > 128) { --y; } if(!world.doesBlockHaveSolidTopSurface(x, y, z)) { continue; } int i1 = chunkX + random.nextInt(16); int j1 = y + random.nextInt(4) - random.nextInt(4); int k1 = chunkZ + random.nextInt(16); if (world.isAirBlock(i1, j1, k1) && (!world.provider.hasNoSky || j1 < 127) && Block.blocksList[blockHelper.heartFlower.blockID].canBlockStay(world, i1, j1, k1)) { world.setBlock(i1, j1, k1, BlockHelper.heartFlower.blockID, 0, 2); } } } }
  21. Here's what I have: http://pastebin.com/YZQQkm1R I'm kind of confused on where to place the while loops. Inside the for or outside the for.
  22. I'm trying to add my own flowers and generating them, but the base class extends WorldGenerator but I'm implementing IWorldGenerator. The generate method in IWorldGenerator doesn't have 3 integer parameters. I'm assuming that from 21 to 23, its goes from x, y, and then z. http://pastebin.com/5SEmAUSb My problem is on line 22.
  23. I looked into the command and implemented it into my item. It doesn't seem to work though.
  24. Look into the ItemEnderPearl class for the right click part. Look into the Enchantment Table classes for the enchantment part.
  25. I just want to make a fancy particle effect: public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) { World world = entityLiving.worldObj; for(int x = 0; x < 10;x++) { world.spawnParticle("smoke", entityLiving.posX, entityLiving.posY + x, (entityLiving.posZ), 0.0D, 0.0D, 0.0D); } return false; } Trying to add a delay after the spawnParticle() method so that it gradually spawns the particles.
×
×
  • Create New...

Important Information

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