Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Simontange

Members
  • Joined

  • Last visited

Everything posted by Simontange

  1. No I don't know how to do this and why do this, it is to make some packages ? It is the line where I get the Nen value lenthBar = (int)(tmp*nen.getNen()); I watched like 3-4 tutorials on internet and moste of time they made an interface but the last guy don't made one and it works fine Now your saying it I d'ont find the methode read and write for the NBTTag I will restart my classes i think I register it in the CommonProxy in the PreInit it is good or not ?
  2. Hello i am a new moddeur and i am doing a mod based on Hxh so i would like to attach to the players a quantity of Nen (mana) and a max amount of Nen. So I used the system of capabilities I followed many tutorials to do it but every time I have a error null point exeption so I come here to ask your help, thank you in advance and sorry for my bad English . here my crash report : crash-2019-03-30_00.16.20-client.txt my classes : public class PlayerNen { private double Nen = 0.0; public PlayerNen() { } public double getNen() { return Nen; } public void setNen(double nen) { Nen = nen; } public void copyNen(PlayerNen Pnen) { Nen = Pnen.Nen; } public void saveNBTData (NBTTagCompound compound) {compound.setDouble("nen",Nen);} public void loadNBTData (NBTTagCompound compound){Nen=compound.getDouble("nen");} } public class PlayerProp { @CapabilityInject(PlayerNen.class) public static Capability<PlayerNen> Player_Nen; public static PlayerNen getPlayerNen(EntityPlayer player){ return player.getCapability(Player_Nen,null);} public class PropDispatcher implements ICapabilitySerializable<NBTTagCompound> { private PlayerNen playerNen = new PlayerNen(); @Override public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) { return capability == PlayerProp.Player_Nen; } @Nullable @Override public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) { if (capability == PlayerProp.Player_Nen){ return (T) playerNen; } return null; } @Override public NBTTagCompound serializeNBT() { NBTTagCompound nbt = new NBTTagCompound(); playerNen.saveNBTData(nbt); return nbt; } @Override public void deserializeNBT(NBTTagCompound nbt) { playerNen.loadNBTData(nbt); } } public class PlayerPropEvent { public static PlayerPropEvent instance = new PlayerPropEvent(); @SubscribeEvent public void onEntityContstructing (AttachCapabilitiesEvent<net.minecraft.entity.Entity> event){ Entity test = (net.minecraft.entity.Entity) event.getObject(); if (test instanceof EntityPlayer){ if (!event.getObject().hasCapability(PlayerProp.Player_Nen,null)){ event.addCapability(new ResourceLocation(MainHunterXHunter.modId,"nen"),new PropDispatcher()); } } } @SubscribeEvent public void onPlayerCloned(PlayerEvent.Clone event){ if(event.isWasDeath()){ if(event.getOriginal().hasCapability(PlayerProp.Player_Nen,null)){ PlayerNen old = event.getOriginal().getCapability(PlayerProp.Player_Nen,null); PlayerNen newstore = PlayerProp.getPlayerNen(event.getEntityPlayer()); newstore.copyNen(old); } } } } And here the class to setup a Nen bar, this works fine whithout capabilities public class NenOverlay extends Gui { private final ResourceLocation bar = new ResourceLocation(MainHunterXHunter.modId, "textures/barre.png"); @SubscribeEvent public void renderOverlay (RenderGameOverlayEvent event ){ Minecraft mc = Minecraft.getMinecraft(); EntityPlayer player = mc.player ; PlayerNen nen = PlayerProp.getPlayerNen(player); final int externalBarH = 20, externalBarL = 108, internalBarH = 14, internalBarL = 102; float tmp=0; int lenthBar =0; if (event.getType()==RenderGameOverlayEvent.ElementType.TEXT){ mc.renderEngine.bindTexture(bar); tmp = internalBarL/250; lenthBar = (int)(tmp*nen.getNen()); drawTexturedModalRect(5,5,0,0,externalBarL,externalBarH); drawTexturedModalRect(8,8,3,20,lenthBar,internalBarH); } } } Thank you for reading this.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.