Jump to content

Recommended Posts

Posted (edited)

I’ve got an Item that has an energy capability that writes its energy amount to not every time it updates (is this the way I should be doing it?) but when energy is added to it by other items in my inventory (Actually Additions Batteries) the energy only updates on the server, not the client. If I drop the item and pick it up again or put it into another inventory (chest, furnace, generator etc) the energy updates to the right amount. However moving it around in my own inventory or using the item doesn’t update the energy.

My code:

 

https://github.com/Cadiboo/WIPTech/blob/master/src/main/java/cadiboo/wiptech/item/ItemEnergy.java > https://github.com/Cadiboo/WIPTech/blob/master/src/main/java/cadiboo/wiptech/item/ItemGun.java > https://github.com/Cadiboo/WIPTech/blob/master/src/main/java/cadiboo/wiptech/item/ItemRailgun113.java

 

Provider

https://github.com/Cadiboo/WIPTech/tree/master/src/main/java/cadiboo/wiptech/provider

(ModularWeaponProvider & ModularWeaponProvider113) neither works

 

What am I doing wrong/ should I be doing differently?

Edited by Cadiboo
added code

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted

I am setting my NBT in my getShareTag correctly, and the NBT should just work (deserialise/read automagically) client side. Am I missing something?

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted

Update, I've got it to work, but I want the server to sync the ItemStacks NBT more often, does anyone know what method I should use to achieve this?

 

this is pseudo code of what I'm trying to achieve

 

public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {

  if(energy.getEnergyStored() != prevEnergyStored)

  entityIn.connection.sendPacket(UPDATE_NBT);

}

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

  • 4 months later...
Posted (edited)

Yeah in the player inventory

 

What I’m trying to do:

Sync the energy to the client to display it inside the durability bar. I also don’t want this sync to trigger a re-equip animation OR to stop the ItemStack from being used (the way a bow is used).

 

What I assume I have to do:

Override getShareTag and shouldCauseReequipAnimation (and something else I think as these two aren’t enough to allow the time to continue being used).

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

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.

Announcements



×
×
  • Create New...

Important Information

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