Jump to content

Recommended Posts

Posted

What are your opinions on setting out a separate class file for the detection of when my mod items damage entities they store NBT data.

That way each of my tools doesn't need 20+ lines of code.

It just refers to the separate class file?

Yeah, sorry, as sequituri pointed out, what you stated there is a terrible idea, which I failed to mention in my post. Glad that's all cleared up.

Posted

I actually slept on it and thought maybe 20 lines for each item isnt a big deal.

 

The other thing I was thinking of is potentially storing all the items data within the nbt of that one item.

 

Sooo.

 

Sword kills mob. + 1 Kill onto the sword. -1 Durability to the sword.

 

When sword reaches 100 kills - Do something!

 

When durability reaches 1 - Sword texture changes to (Blah blah:swordtexture2)

                                          - Weapon durability disabled.

                                          - Weapon damage set to 1. ( So it does as much damage as punching)

                                          - If item.texture = swordtexture2 - Don't gain kills when mob killed.

 

This way when the tool reaches 1 durability and then no longer functions as a normal tool, the texture is also switched out and it no longer gains kills etc.

 

Any thoughts on that?

Posted

You may as well just switch to a different item at that point. Is there any reason that you need to keep it the exact same Item or ItemStack? Will you keep the NBT data intact? You can do that by transferring the NBT to a new stack with a different item.

 

You could do it all in one class, but it's cleaner (and easier) to have a separate item if that many traits will be different.

Posted

Ok. My idea is tools that change but keep their data.

 

So a Pick, upgrades with a speed upgrade but then might level up to another pick, so it needs to keep the speed upgrade. And because each tool might have a variety of different upgrades, the only way I can think of it working is if the item stays the same and the same ID but the texture changes and its stats change while other stats remain.

 

Do you understand where I am coming from?

Posted

Gotcha. You can still do it either way, though. For your idea, you will need to override lots of methods, making sure each one has an ItemStack parameter so you can access the NBT and return an appropriate value based on that, rather than the Item's base values. Any method that you need that does not have an ItemStack-parameter version will require a new Item to handle, but you can still copy the NBT over to the new item when you set the player's held item, retaining all the important data.

Posted

I both understand and am completely confused at the same time.

 

Haha!

 

I will just have to get used to all this stuff. But I am enjoying it greatly.

 

I understand doing all this overriding of stats.

 

Also are you saying that storing durability, damage, kills, upgrades, breakable/or not, speed is all stored as NBT data and the weapons damage is derived or extracted from the NBT data? That way as the NBT data changes so does the weapons damage, speed, durability etc?

Posted

Also are you saying that storing durability, damage, kills, upgrades, breakable/or not, speed is all stored as NBT data and the weapons damage is derived or extracted from the NBT data? That way as the NBT data changes so does the weapons damage, speed, durability etc?

Oops, wrong button :P

 

No, I'm saying that YOU will have to make it rely on NBT for that stuff, which is not going to be a walk in the park. Weapon damage is based on the multimap data, which does not have an ItemStack parameter, meaning your best bet for changing that is to create a new Item, though that can be worked around it's a lot easier to do it that way.

Posted

Could I not declare and set up the nbt prior to the weapons damage and other stats then

 

this.setDamage() equals NBTDamage ?

 

I am still learning so trial and error works for me as it always does hehe :P

 

 

 

The other thing is that because I am still learning and new to this I am probably going to make so e messy code for the most part.

 

But if I can get some of the functionality to work as I understand at the moment then I can develop my knowledge of programming with minecraft and make the code more efficient.

 

:D

Posted

Oooh.

 

Herp a derp on my part.

 

 

So I could set base stats for the tools (Like you normally do for a weapon / tool) and from then on i can have their stats change based on if statments, mob damage, block breaking and other things, and have it also save that data as NBT data or change stats by checking the NBT data?

 

But what your saying is you cannot have the damage changed by the nbt data at initialization because the tool really doesn't exist then?

 

 

I appreciate all the fast replies btw. You are really helping me learn more as I make this mod!

Posted

You can't use NBT during initialization because you don't have any NBT and you don't have any way to get valid NBT. The whole point of NBT is that it is attached to a specific ItemStack, it's not magic that stores data anywhere xD

 

At this point you should just start coding and see if you can get it to work. Start with something simple first, and add things one at a time, making sure each one works before moving on to the next. If you try to do it all at once with no prior experience, you're just asking for trouble.

Posted

So you are telling me that Minecraft and java programming is not magic?

 

 

Well I am truly disappointed! My dreams are scattered!

 

:PxD

 

 

 

 

 

Oh wait I forgot to ask.

 

Is there any way of displayed the stored NBT data on the actual tool? You know how you can see this weapon as 6 Damage or what ever on the tool. Can you display as simple text or color text some of the information?

 

Like I could show that the tool has 21 out of 100 kills on it or something like that?

Posted

setMaxDamage(0);

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

Aaaaand. Another questions.

 

How does one change a tools efficiency / speed of harvesting?

 

I see there is the ability to .getDigSpeed() but not a way to set it?

 

override getStrVsBlock(...)

Look at the ItemTool class on how it did it (read the javadoc above the method).

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

I dunno if this is a bug on my part or whether things have changed but with 1.7 all I am seeing in the class file editor for ItemTool.class us Source file not found. Then all the code underneath is hideous to look at. No comments as well. Or Javadocs etc.

Posted

All I get at the end is build failed. Then when I open the class file it still says Source not found.

 

I have had this issue on every computer I have tried. My Java I am sure is set up correctly, but that gradlew setupDecompWorkspace doesn't work.

 

Any thoughts?

Posted

setupDecompWorkspace yields this mess!

 

:/

 

 

 

****************************

Powered By MCP:           

http://mcp.ocean-labs.de/ 

Searge, ProfMobius, Fesh0r,

R4wk, ZeuX, IngisKahn     

MCP Data version : unknown

****************************

:extractUserDev

:getAssetsIndex

:getAssets

:copyAssets

:extractNatives

:genSrgs UP-TO-DATE

:downloadMcpTools UP-TO-DATE

:downloadClient SKIPPED

:downloadServer SKIPPED

:mergeJars SKIPPED

:deobfuscateJar

Applying SpecialSource...

Applying Exceptor...

Injecting source info...

:decompile

:doFmlPatchesPatching failed: net/minecraft/client/gui/GuiIngame.java Cannot find hunk target

  2: Cannot find hunk target @ 0

  1/2 failed

  Rejects written to C:\Users\Studio Apples\Desktop\Minecraft Mod\build\tmp\expandedArchives\fmlpatches.zip_bjh7akumkkh12c91hrqumojdr\net\minecraft\client\gui\GuiIngame.java.patch.rej

Patching failed: net/minecraft/entity/player/EntityPlayer.java Cannot find hunk target

  4: Cannot find hunk target @ 0

  1/4 failed

  Rejects written to C:\Users\Studio Apples\Desktop\Minecraft Mod\build\tmp\expandedArchives\fmlpatches.zip_bjh7akumkkh12c91hrqumojdr\net\minecraft\entity\player\EntityPlayer.java.patch.rej

 

:addFmlSources

:remapJar

:doForgePatchesPatching failed: net/minecraft/client/gui/achievement/GuiAchievements.java Cannot find hunk target

  6: Cannot find hunk target @ 0

  7: Cannot find hunk target @ 0

  2/7 failed

  Rejects written to C:\Users\Studio Apples\Desktop\Minecraft Mod\build\tmp\expandedArchives\forgepatches.zip_6vp0dsutg5p1795v38lpgl539p\net\minecraft\client\gui\achievement\GuiAchievements.java.patch.rej

Patching failed: net/minecraft/client/renderer/ItemRenderer.java Cannot find hunk target

  5: Cannot find hunk target @ 0

  7: Cannot find hunk target @ 0

  2/7 failed

  Rejects written to C:\Users\Studio Apples\Desktop\Minecraft Mod\build\tmp\expandedArchives\forgepatches.zip_6vp0dsutg5p1795v38lpgl539p\net\minecraft\client\renderer\ItemRenderer.java.patch.rej

Patching failed: net/minecraft/client/renderer/RenderBlocks.java Cannot find hunk target

  5: Cannot find hunk target @ 0

  1/11 failed

  Rejects written to C:\Users\Studio Apples\Desktop\Minecraft Mod\build\tmp\expandedArchives\forgepatches.zip_6vp0dsutg5p1795v38lpgl539p\net\minecraft\client\renderer\RenderBlocks.java.patch.rej

Patching failed: net/minecraft/client/renderer/RenderGlobal.java Cannot find hunk target

  4: Cannot find hunk target @ 0

  1/10 failed

  Rejects written to C:\Users\Studio Apples\Desktop\Minecraft Mod\build\tmp\expandedArchives\forgepatches.zip_6vp0dsutg5p1795v38lpgl539p\net\minecraft\client\renderer\RenderGlobal.java.patch.rej

Patching failed: net/minecraft/client/renderer/entity/RenderItem.java Cannot find hunk target

  4: Cannot find hunk target @ 0

  14: Cannot find hunk target @ 0

  2/18 failed

  Rejects written to C:\Users\Studio Apples\Desktop\Minecraft Mod\build\tmp\expandedArchives\forgepatches.zip_6vp0dsutg5p1795v38lpgl539p\net\minecraft\client\renderer\entity\RenderItem.java.patch.rej

Patching failed: net/minecraft/entity/player/EntityPlayer.java Cannot find hunk target

  37: Cannot find hunk target @ 0

  1/37 failed

  Rejects written to C:\Users\Studio Apples\Desktop\Minecraft Mod\build\tmp\expandedArchives\forgepatches.zip_6vp0dsutg5p1795v38lpgl539p\net\minecraft\entity\player\EntityPlayer.java.patch.rej

Patching failed: net/minecraft/inventory/ContainerBrewingStand.java Cannot find hunk target

  3: Cannot find hunk target @ 0

  1/3 failed

  Rejects written to C:\Users\Studio Apples\Desktop\Minecraft Mod\build\tmp\expandedArchives\forgepatches.zip_6vp0dsutg5p1795v38lpgl539p\net\minecraft\inventory\ContainerBrewingStand.java.patch.rej

Patching failed: net/minecraft/world/gen/feature/WorldGenDungeons.java Cannot find hunk target

  2: Cannot find hunk target @ 0

  1/3 failed

  Rejects written to C:\Users\Studio Apples\Desktop\Minecraft Mod\build\tmp\expandedArchives\forgepatches.zip_6vp0dsutg5p1795v38lpgl539p\net\minecraft\world\gen\feature\WorldGenDungeons.java.patch.rej

Patching failed: net/minecraft/world/gen/feature/WorldGenSwamp.java Cannot find hunk target

  3: Cannot find hunk target @ 0

  1/7 failed

  Rejects written to C:\Users\Studio Apples\Desktop\Minecraft Mod\build\tmp\expandedArchives\forgepatches.zip_6vp0dsutg5p1795v38lpgl539p\net\minecraft\world\gen\feature\WorldGenSwamp.java.patch.rej

Patching failed: net/minecraft/world/gen/structure/StructureVillagePieces.java Cannot find hunk target

  7: Cannot find hunk target @ 0

  8: Cannot find hunk target @ 0

  9: Cannot find hunk target @ 0

  3/9 failed

  Rejects written to C:\Users\Studio Apples\Desktop\Minecraft Mod\build\tmp\expandedArchives\forgepatches.zip_6vp0dsutg5p1795v38lpgl539p\net\minecraft\world\gen\structure\StructureVillagePieces.java.patch.rej

 

:addForgeJavadoc

:extractForgeSrc

:recompForgewarning: [options] bootstrap class path not set in conjunction with -source 1.6

C:\Users\Studio Apples\Desktop\Minecraft Mod\build\tmp\recompSrc\net\minecraft\entity\player\EntityPlayer.java:208: error: cannot find symbol

        this.eyeHeight = this.getDefaultEyeHeight();

            ^

  symbol: variable eyeHeight

C:\Users\Studio Apples\Desktop\Minecraft Mod\build\tmp\recompSrc\net\minecraft\entity\player\EntityPlayer.java:208: error: cannot find symbol

        this.eyeHeight = this.getDefaultEyeHeight();

                            ^

  symbol: method getDefaultEyeHeight()

C:\Users\Studio Apples\Desktop\Minecraft Mod\build\tmp\recompSrc\net\minecraft\entity\player\EntityPlayer.java:1116: error: cannot find symbol

        return eyeHeight;

              ^

  symbol:  variable eyeHeight

  location: class EntityPlayer

C:\Users\Studio Apples\Desktop\Minecraft Mod\build\tmp\recompSrc\net\minecraft\entity\player\EntityPlayer.java:1806: error: method getBedLocation in class EntityPlayer cannot be applied to given types;

        return getBedLocation(this.dimension);

              ^

  required: no arguments

  found: int

  reason: actual and formal argument lists differ in length

C:\Users\Studio Apples\Desktop\Minecraft Mod\build\tmp\recompSrc\net\minecraft\entity\player\EntityPlayer.java:1812: error: method isSpawnForced in class EntityPlayer cannot be applied to given types;

        return isSpawnForced(this.dimension);

              ^

  required: no arguments

  found: int

  reason: actual and formal argument lists differ in length

C:\Users\Studio Apples\Desktop\Minecraft Mod\build\tmp\recompSrc\net\minecraft\entity\player\EntityPlayer.java:1822: error: method setSpawnChunk in class EntityPlayer cannot be applied to given types;

            setSpawnChunk(par1ChunkCoordinates, par2, this.dimension);

            ^

  required: ChunkCoordinates,boolean

  found: ChunkCoordinates,boolean,int

  reason: actual and formal argument lists differ in length

C:\Users\Studio Apples\Desktop\Minecraft Mod\build\tmp\recompSrc\net\minecraft\entity\player\EntityPlayer.java:2442: error: cannot find symbol

        ChatComponentText chatcomponenttext = new ChatComponentText(ScorePlayerTeam.formatPlayerName(this.getTeam(), this.getDisplayName()));

                                                                                                                        ^

  symbol: method getDisplayName()

C:\Users\Studio Apples\Desktop\Minecraft Mod\build\tmp\recompSrc\net\minecraft\item\Item.java:790: error: cannot find symbol

        double d1 = par2EntityPlayer.prevPosY + (par2EntityPlayer.posY - par2EntityPlayer.prevPosY) * (double)f + (double)(par1World.isRemote ? par2EntityPlayer.getEyeHeight() - par2EntityPlayer.getDefaultEyeHeight() : par2EntityPlayer.getEyeHeight()); // isRemote check to revert changes to ray trace position due to adding the eye height clientside and player yOffset differences

                                                                                                                                                                                                  ^

  symbol:  method getDefaultEyeHeight()

  location: variable par2EntityPlayer of type EntityPlayer

C:\Users\Studio Apples\Desktop\Minecraft Mod\build\tmp\recompSrc\net\minecraft\world\gen\structure\StructureVillagePieces.java:1942: error: cannot find symbol

                BiomeEvent.GetVillageBlockID event = new BiomeEvent.GetVillageBlockID(startPiece == null ? null : startPiece.biome, p_151558_1_, p_151558_2_);

                                                                                                                            ^

  symbol:  variable biome

  location: variable startPiece of type Start

C:\Users\Studio Apples\Desktop\Minecraft Mod\build\tmp\recompSrc\net\minecraft\world\gen\structure\StructureVillagePieces.java:1983: error: cannot find symbol

                BiomeEvent.GetVillageBlockMeta event = new BiomeEvent.GetVillageBlockMeta(startPiece == null ? null : startPiece.biome, p_151557_1_, p_151557_2_);

                                                                                                                                ^

  symbol:  variable biome

  location: variable startPiece of type Start

C:\Users\Studio Apples\Desktop\Minecraft Mod\build\tmp\recompSrc\net\minecraft\server\management\ServerConfigurationManager.java:435: error: method getBedLocation in class EntityPlayer cannot be applied to given types;

        ChunkCoordinates chunkcoordinates = par1EntityPlayerMP.getBedLocation(par2);

                                                              ^

  required: no arguments

  found: int

  reason: actual and formal argument lists differ in length

C:\Users\Studio Apples\Desktop\Minecraft Mod\build\tmp\recompSrc\net\minecraft\server\management\ServerConfigurationManager.java:436: error: method isSpawnForced in class EntityPlayer cannot be applied to given types;

        boolean flag1 = par1EntityPlayerMP.isSpawnForced(par2);

                                          ^

  required: no arguments

  found: int

  reason: actual and formal argument lists differ in length

C:\Users\Studio Apples\Desktop\Minecraft Mod\build\tmp\recompSrc\net\minecraft\entity\player\EntityPlayerMP.java:1176: error: method does not override or implement a method from a supertype

    @Override

    ^

C:\Users\Studio Apples\Desktop\Minecraft Mod\build\tmp\recompSrc\cpw\mods\fml\common\network\internal\OpenGuiHandler.java:16: error: cannot find symbol

        player.openGui(msg.modId, msg.modGuiId, player.worldObj, msg.x, msg.y, msg.z);

              ^

  symbol:  method openGui(String,int,World,int,int,int)

  location: variable player of type EntityPlayer

C:\Users\Studio Apples\Desktop\Minecraft Mod\build\tmp\recompSrc\net\minecraft\client\entity\EntityOtherPlayerMP.java:174: error: method does not override or implement a method from a supertype

    @Override

    ^

C:\Users\Studio Apples\Desktop\Minecraft Mod\build\tmp\recompSrc\net\minecraftforge\common\util\FakePlayer.java:33: error: method does not override or implement a method from a supertype

    @Override public void openGui(Object mod, int modGuiId, World world, int x, int y, int z){}

    ^

Note: Some input files use or override a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

Note: Some input files use unchecked or unsafe operations.

Note: Recompile with -Xlint:unchecked for details.

16 errors

1 warning

FAILED

 

FAILURE: Build failed with an exception.

 

* What went wrong:

Execution failed for task ':recompForge'.

> Compilation failed; see the compiler error output for details.

 

* Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

 

BUILD FAILED

 

Total time: 2 mins 34.937 secs

 

 

Posted

coolAlias :P

 

I am trying to trigger something

 

 

 

 

if (evometer.getInteger("evolutionMeter") >= 30)

{

this.setTextureName("evolvinggearmod:FleshBoundPick");

this.setUnlocalizedName(toolNameFlesh);

}

 

}

return

 

 

 

When the evolution meter reaches 30 +

 

changed item texture and name but not swap the actual item. Just change the way it looks and its name.

 

But when I do this the texture doesn't change and the name becomes weird. Like name.FleshBoundPickaxe.## etc

 

 

Any thoughts?

 

 

The issue I think I am having is with that current code I am effectivly changing the entire item types name and texture. When what I want to be doing is just changing the texture and name and stats of the currently held item as its own thing. I just don't know how to work that out.

 

Would I be able to do something with NBT data?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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