Jump to content

Recommended Posts

Posted

So basically i made a Gun mod, but through A series of crashes i Lost the work thank god i had a compiled version on my drop box and have managed to decompile it.

So now i need help to finish it off so basically the problems when i try to reload i crash and on the screen says lost connection fatal error has occurred and when i shoot the gun takes bullets but does not damage the mob.

and here is all my code on github

https://github.com/britishcoding/gun-mod/tree/master/gun

Posted

Where are you setting the damage? Damage the entity in onImpact. For example, look at the EntitySnowball class. That should give you a rough idea.

If you read this, I'm hot.

Posted

okay so i have narrowed it down to this being wrong

  if (player.inventory.func_146028_b(gun.getMagazineItem()))

        {

          nbt.setInteger("remainingAmmo", magazine.getMaxDamage());

          if (!player.capabilities.isCreativeMode) {

            player.inventory.func_146026_a(gun.getMagazineItem());

          }

        }

and i need to know what these are

146028_b

146028_a

Posted

Look at what you think the methods would do. Inside the 1st if-statement you set an integer to NBT, and do something when you are NOT in creative mode. You are working on a gun

Item

, and you have a variable called

magazine

. Now I guess that you check if you got a magazine in your inventory, set an integer to NBT and consume the Item when you are NOT in creative mode. Now looking at the

InventoryPlayer 

class, it has the methods

hasItem

and

consumeInventoryItem

. So

func_146028_bis 

hasItem

and

func_146026_a

is

consumeInventoryItem

.

 

So you see, with a little logic it's very easy to figure out the proper names (writing this took me longer than getting the proper names without an IDE).

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

  • 1 year later...
Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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