
Deadlyapples
Members-
Posts
66 -
Joined
-
Last visited
Converted
-
Gender
Undisclosed
-
Personal Text
I am new!
Deadlyapples's Achievements

Stone Miner (3/8)
2
Reputation
-
// when Block Destroyed @Override public boolean onBlockDestroyed(ItemStack stack, World world, Block blockID, int x, int y, int z, EntityLivingBase entity) { // If correct item if (stack.getItem() != null && stack.getItem() == EvolvingGearMod.FusedBonePickaxe) { // Create 2 NBT tags. Evolution Points and Evolution Meter Points System.out.println("Broke A Block with pickaxe"); NBTTagCompound evopoints = stack.getTagCompound(); if (evopoints == null) { evopoints = new NBTTagCompound(); } if (!evopoints.hasKey("evolutionPoints")) { evopoints.setInteger("evolutionPoints", 0); } stack.setTagCompound(evopoints); NBTTagCompound toolDmg = stack.getTagCompound(); if (toolDmg == null) { toolDmg = new NBTTagCompound(); } if (!toolDmg.hasKey("ToolDmg")) { toolDmg.setInteger("ToolDmg", 0); } //stack.setTagCompound(toolDmg); NBTTagCompound toolMaxDura = stack.getTagCompound(); if (toolMaxDura == null) { toolMaxDura = new NBTTagCompound(); } if (!toolMaxDura.hasKey("ToolMaxDura")) { toolMaxDura.setInteger("ToolMaxDura", 0); } //stack.setTagCompound(toolMaxDura); // Increase evo points + 1 evopoints.setInteger("evolutionPoints", evopoints.getInteger("evolutionPoints") + 1); //Damage Item NBT toolDmg.setInteger("ToolDmg", toolDmg.getInteger("ToolDmg") + 1); System.out.println(toolDmg.getInteger("ToolDmg") + " is the tools dmg. "); System.out.println(toolMaxDura.getInteger("ToolMaxDura") + " is the tools max durability."); } return blockDestroyed; } That is getting called 2 times in a row causing me issues. No idea why either
-
Right I have a few ideas I want to pass across people and see what they think. My issue is that I cannot have 1 tool have multiple durability levels which change at specific points related to NBT data on just that one item stack. If I change a tools max durability it changes the entire item class rather than just the stack. My other issue is that I don't know how to have the item also have a different efficiency level which change at specific points related to NBT data without it also effecting the whole item class. etc etc My idea for solutions. 1. I use NBT data to work out tools durability. If the NBT data holding durability info and NBT data holding current durability level are the same then the tool breaks. That's fine I can do that. My only issue is that the item won't have a durability bar that moves across as it takes damage. Is there any way of making a bar which fills out showing the items durability level related to the items NBT data not the vanilla minecraft durability data? 2. I forget the idea of having a tiered tool with multiple durability levels, efficiency levels and just have it all remain the same. The only change is its texture and other stats. (Rather not give in and do this easy option)
-
Can someone confirm something for me? here are two lines of code this.setMaxDamage(toolMaxDurTier2); This line is to set the tools durability to a variable assigned to toolMaxDurTier2; stack.setMaxDamage(toolMaxDurTier2); THis line does the same execept it sets that individual stacks durability to toolMaxDurTier2; I know that stack.setMaxDamage doesn't work but is there a way to get the same results because at the moment my code is setting all my items to the same durability rather than it setting just the one item / stack to a different durability. ? OR Do I handle it a different way? Because of the way my tools work I cannot set up multiple tools. Each tool has several states, like leveling up tiers in minecraft. Think wood to stone to iron to diamond. Except this is all contained within 1 tool. As the tool is used to grows and changes into a better form, more powerful. I wanted to have it so the durability changes as the tool grows too however I noticed that this current setup causes all of the one type of tool to change durability atleast I think it does. Will do more testing but advice would be appreciated
-
To me it sounded like he means he has an item that he likes and now wants it to function like a pickaxe etc. Not make a new itemTool from scratch. Is that possible ?
-
@Override public void onUpdate(ItemStack stack, World world, Entity par3Entity, int par4, boolean par5) { NBTTagCompound evopoints = stack.getTagCompound(); int ToolTier = evopoints.getInteger("ToolTier"); <---- LINE 171 int currentDamage = stack.getItemDamage(); if (currentDamage >=50 ) { if (damage <= 349) { damage++; } System.out.println(damage); if (damage == 350) { if (ToolTier == 0) { stack.damageItem(-1, (EntityPlayer) par3Entity); damage = 0; } else if (ToolTier == 1) { stack.damageItem(-2, (EntityPlayer) par3Entity); damage = 0; } else if (ToolTier == 2) { stack.damageItem(-3, (EntityPlayer) par3Entity); damage = 0; } else if (ToolTier == 3) { stack.damageItem(-4, (EntityPlayer) par3Entity); damage = 0; } else { System.out.println("damage is now 1000"); } } } else {System.out.println("No Damage yet"); } } } This works making the tools repair but now when I try and craft them in a crafting bench and pick up the item it causes this crash, then it crashes every time I log in again.
-
BOLLOCKS! ---- Minecraft Crash Report ---- // Daisy, daisy... Time: 28/03/14 21:07 Description: Ticking player java.lang.NullPointerException: Ticking player at com.aappleyard.evolvinggearmod.tools.FusedBonePickaxe.onUpdate(FusedBonePickaxe.java:171) at net.minecraft.item.ItemStack.updateAnimation(ItemStack.java:468) at net.minecraft.entity.player.InventoryPlayer.decrementAnimations(InventoryPlayer.java:357) at net.minecraft.entity.player.EntityPlayer.onLivingUpdate(EntityPlayer.java:643) at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:1856) at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:360) at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:363) at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:334) at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:37) at net.minecraft.network.play.client.C03PacketPlayer$C06PacketPlayerPosLook.processPacket(C03PacketPlayer.java:218) at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:242) at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:190) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:763) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:651) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:120) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:530) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:788) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at com.aappleyard.evolvinggearmod.tools.FusedBonePickaxe.onUpdate(FusedBonePickaxe.java:171) at net.minecraft.item.ItemStack.updateAnimation(ItemStack.java:468) at net.minecraft.entity.player.InventoryPlayer.decrementAnimations(InventoryPlayer.java:357) at net.minecraft.entity.player.EntityPlayer.onLivingUpdate(EntityPlayer.java:643) at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:1856) at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:360) -- Player being ticked -- Details: Entity Type: null (net.minecraft.entity.player.EntityPlayerMP) Entity ID: 265 Entity Name: Aappleyard Entity's Exact location: 200.70, 70.00, 142.88 Entity's Block location: World: (200,70,142), Chunk: (at 8,4,14 in 12,8; contains blocks 192,0,128 to 207,255,143), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Entity's Momentum: 0.00, -0.08, 0.00 Stacktrace: at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:363) at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:334) at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:37) at net.minecraft.network.play.client.C03PacketPlayer$C06PacketPlayerPosLook.processPacket(C03PacketPlayer.java:218) at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:242) -- Ticking connection -- Details: Connection: net.minecraft.network.NetworkManager@57ad78bb Stacktrace: at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:190) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:763) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:651) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:120) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:530) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:788) -- System Details -- Details: Minecraft Version: 1.7.2 Operating System: Windows 8 (amd64) version 6.2 Java Version: 1.7.0_51, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 909130352 bytes (867 MB) / 1038024704 bytes (989 MB) up to 3113877504 bytes (2969 MB) JVM Flags: 3 total; -Xincgc -Xmx3G -Xms1024M AABB Pool Size: 2942 (164752 bytes; 0 MB) allocated, 2798 (156688 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95 FML: MCP v9.01-pre FML v7.2.129.1047 Minecraft Forge 10.12.0.1047 4 mods loaded, 4 mods active mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available FML{7.2.129.1047} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.0.1047.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Forge{10.12.0.1047} [Minecraft Forge] (forgeSrc-1.7.2-10.12.0.1047.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available evolvinggearmod{1.0} [evolvinggearmod] (Evolving Gear Mod Wth IntelliJ) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Profiler Position: N/A (disabled) Vec3 Pool Size: 1366 (76496 bytes; 0 MB) allocated, 1351 (75656 bytes; 0 MB) used Player Count: 1 / 8; [EntityPlayerMP['Aappleyard'/265, l='New World', x=200.70, y=70.00, z=142.88]] Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'fml,forge' Can't work out what its trying to tell me.
-
@Override public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { int del = 5000; while (del > 0) { --del;} if (par1ItemStack.getItemDamage() > 0 && del == 0) { System.out.println("Repairing"); par1ItemStack.setItemDamage(par1ItemStack.getItemDamage() - 1); del = 5000; } Like this I can mine but the tool repairs instantly. Arghhgh
-
Right. Im gunna post my code up for the 1 tool. The Pickaxe. REDACTED! REDACTED! That is just 1 one too. Beware! My code will burn your eyes and cause you to become enraged. I tried this code out atm and the onUpdate causes my tool to not work at all. Untill the delay caused by the onUpdate is finished. But the tools doo repair now. They just dont work
-
Where can I set the NBT data changes then? Because I can't work out a good spot to have the durability and efficiency change then. @Override public IIcon getIcon(ItemStack thisItem, int pass) { NBTTagCompound evopoints = thisItem.getTagCompound(); if (evopoints == null) { evopoints = new NBTTagCompound(); } if (!evopoints.hasKey("evolutionPoints")) { evopoints.setInteger("evolutionPoints", 0); } thisItem.setTagCompound(evopoints); if (evopoints.getInteger("evolutionPoints") >= tier2Level && (evopoints.getInteger("evolutionPoints") < tier3Level)) { return itemIconFleshBound; } else if (evopoints.getInteger("evolutionPoints") >= tier3Level && (evopoints.getInteger("evolutionPoints") < tier4Level)) { return itemIconHideCoated; } else if (evopoints.getInteger("evolutionPoints") >= tier4Level) { return itemIconScaleArmored; } else { this.efficiencyOnProperMaterial = toolEfficiency; return itemIconFusedBone; } } @Override public IIcon getIconIndex(ItemStack thisItem) { NBTTagCompound evopoints = thisItem.getTagCompound(); if (evopoints == null) { evopoints = new NBTTagCompound(); } if (!evopoints.hasKey("evolutionPoints")) { evopoints.setInteger("evolutionPoints", 0); } thisItem.setTagCompound(evopoints); thisItem.setTagCompound(evopoints); if (evopoints.getInteger("evolutionPoints") >= tier2Level && (evopoints.getInteger("evolutionPoints") < tier3Level)) { this.efficiencyOnProperMaterial = toolEffTier2; this.setMaxDamage(toolMaxDurTier2); return itemIconFleshBound; } else if (evopoints.getInteger("evolutionPoints") >= tier3Level && (evopoints.getInteger("evolutionPoints") < tier4Level)) { this.efficiencyOnProperMaterial = toolEffTier3; this.setMaxDamage(toolMaxDurTier3); return itemIconHideCoated; } else if (evopoints.getInteger("evolutionPoints") >= tier4Level) { this.efficiencyOnProperMaterial = toolEffTier4; this.setMaxDamage(toolMaxDurTier4); return itemIconScaleArmored; } else { this.efficiencyOnProperMaterial = toolEfficiency; this.setMaxDamage(toolMaxDurability); return itemIconFusedBone; } So is all of that read only / client side? If so I need a good suggestion as to where I can place my updates of this.setMaxDamage and this.efficiencyOnProperMaterial because I am a bit stuck hehe. Atm it all works fine, no issues, Untill it comes to the repairing stuff.