Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

LK1905

Members
  • Content Count

    38
  • Joined

  • Last visited

Community Reputation

0 Neutral

About LK1905

  • Rank
    Tree Puncher

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. What exactly do I put in the Button.ITooltip parameter? How do I "give it an Implementation"? I can't find any examples of it actually being used, neither in Vanilla or in other mods.
  2. If I don't have that there, the buttons don't update. Besides, thats not the issue I was asking, the issue is that only the last button hovered over does whats in that statement.
  3. Sorry for the late response, but I found how to make the buttons update. All I had to do was to clear existing buttons and re-run the init, whenever the buttons are hovered over, like this: if(styleButton[i].isHovered()) { this.renderTooltip(stack, new StringTextComponent(styleCap.getStyleDescription(i)), mouseX, mouseY); buttons.clear(); this.init(); } However I still have a problem with that statement, in that it still only works on the last non-null button, and not on any of the previous buttons. Anyone know why the statement would do so? Full class here.
  4. For the "listen to the change" part, there's a mouseClicked method in the Widget class (which the Button class extends from) that I think would do the job, but I'm not sure what the int button parameter does, do you know?
  5. I ended up finding a solution elsewhere for my buttons to display the updated texture on the correct button: package lk1905.gielinorcraft.client.gui.widget; import lk1905.gielinorcraft.Gielinorcraft; import lk1905.gielinorcraft.capability.attackstyle.AttackStyleCapability; import lk1905.gielinorcraft.capability.attackstyle.IAttackStyle; import lk1905.gielinorcraft.network.PacketHandler; import lk1905.gielinorcraft.network.attackstyle.AttackStyleClientPacket; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.widget.button.ImageButton; import net.minecraft.entity.player
  6. Okay, I removed the static from the player and styleCap variables, are you able to help me with the other problems I mentioned?
  7. The screen has 3 buttons, all with a "style id", which, when pressed, sends a packet to set an "active attack style", which is decided by the style id of the button pressed. The buttons are all grey, except for the button with the active style id, which is supposed to turn red, and also make the previously active button grey. The button colours do update, but only if i close/reopen the screen. I would like it to be able to update the colours while the screen is still open. Screen class package lk1905.gielinorcraft.client.gui.screen; import com.mojang.blaze3d.matrix.MatrixStack;
  8. Hi, I have 2 questions: 1. How do i get a gui screen to update instantly? My screens only update when I open/close them, or change the size of the Minecraft window. My in game gui updates instantly, which is what I want my screens to do aswell. 2. I have buttons on this gui that I want to, when hovered over, to display a string/tooltip. There is an ITooltip parameter in the constructor of the Button class, but I'm not sure what to put in there if I just want to display a string. How would I do that? Thanks.
  9. I solved the problem. The problem as that I didn't have the getMaxHealth() method saved within my serializeNBT() method, so the game still thought the value was zero. Saving that value fixed the problem.
  10. I'm trying to modify an entity's max health based on a stat, but either its not working or my client isn't acknowledging the change. The method for the change. Full class here. @Override public void modifyMaxHealth(LivingEntity entity) { if(entity == null) { return; } entity = getEntity(); final float newAmount = getMaxHealth(); final float oldAmount; final UUID MODIFIER_ID = UUID.fromString("d5d0d878-b3c2-469b-ba89-ac01c0635a9c"); final ModifiableAttributeInstance health = entity.getAttribute(Attributes.MAX_HEALTH); final AttributeModifier mod = new Att
  11. I've changed the serializeNBT and deserialize methods so the value of i is in the key: @Override public CompoundNBT serializeNBT() { CompoundNBT data = new CompoundNBT(); for(int i = 0; i < 26; i++) { data.putInt("xp_" + i, (int) xp[i]); data.putInt("dynamic_" + i, dynamicLevels[i]); data.putInt("static_" + i, staticLevels[i]); } return data; } @Override public void deserializeNBT(CompoundNBT data) { for(int i = 0; i < 26; i++) { xp[i] = data.getInt("xp_" + i); dynamicLevels[i] = data.getInt("dynamic_" + i); staticLevels[i] = data.getInt("stat
  12. Okay, I believe I've done what you have told me, and my gui does update me gaining xp. However, theres something wrong with my sync method, as whenever it is called, it resets all xp values to zero. So the values in my gui are lost when reloading the world. Heres the sync method in my Skills class: @Override public void sync(ServerPlayerEntity player) { if(entity instanceof ServerPlayerEntity) { PacketHandler.sendTo(new SkillsPacket(serializeNBT()), player); } } Heres my attempt at syncing on login, in my player event handler: @SubscribeEven
  13. Did you mean replace EntityLiving in the Object instanceof part with PlayerEntity? Because I just tried that and it made no difference.
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.