Everything posted by squidlex
-
Correctly Render Gui above the Hunger Bar
After using mods such as 'Armor Toughness Bar' and 'Rustic' for reference, I am rendering my GUI above the foodbar in a manner that will automatically make room for other mods by using if (event.getType() == ElementType.FOOD) The issue is that if any other mod cancels this event, (to hide or replace the hunger bar) then my GUI is not rendered. Is there a workaround for this so that my GUI will still appear correctly above or below GUIs added by other mods?
-
Make ClientTickEvent run exclusively when the game is not paused
Perfect. Thank you!
-
Make ClientTickEvent run exclusively when the game is not paused
I am trying to stop my ClientTickEvent from running when the game itself is paused. Whilst I could check to see if the player has a Gui/Screen open, this would prevent the code from running when the game is paused on a server or LAN World, which I don't want. How can I check if the game itself is not paused? I know I could use the PlayerTickEvent for this, however I want to use the ClientTickEvent as I am interacting with Client Side values for my GUI.
-
How to correctly get the player that sent a message to the server
Hi! I am sending a message to the server from the player using this: PacketHandler.instance.send(PacketDistributor.SERVER.noArg(), new SWeightMessage(intWeight)); When it arrives it updates the player's capability like so. @Override public void handle(SWeightMessage message, Supplier<Context> supplier) { supplier.get().enqueueWork(() -> { supplier.get().getSender().getCapability(WeightProvider.WEIGHT_CAP).ifPresent(w -> { w.set(message.weight); }); }); supplier.get().setPacketHandled(true); } The issue is that this is changing the Weight of EVERY player to this value and I have no idea why. Any help would be greatly appreciated! This message is fired from the client everytime they equip or unequip an item of armor or join the world.
-
How to write Strings to a packet buffer
Thank you for the answer and additional detail!
-
How to write Strings to a packet buffer
Hi! I'm updating a 1.12 mod to 1.16 and can't figure out how to transfer Strings through packets. This used to be ByteBufUtils.writeUTF8String(buffer) but I don't know how to do this in later versions. Any help would be greatly appreciated!
-
Use Item Tooltip Event when player joins world
All I needed was a not null check.. Thank you so much!
-
Use Item Tooltip Event when player joins world
Hey there, I'm trying to create ModConfig dependent text as a tooltip to be added to all items. The best way to do this would be to use the Item Tooltip Event, however this runs before the Config is loaded. I'd imagine there's obviously no way for me to change when the event is fired, so is there a way to add text when the player joins the world? I'm already using the Render Tooltip Event (Which fires when the tooltip is rendered and therefore the ModConfig is loaded) for other things such as icons, so I know it doesn't allow me to adjust text. Thank you for your help!
-
Get a potion by its registry name
Hi! I'm trying to figure out how to get a potion by its registry name (So it can be added to my Mod config). Is there any way to achieve this? The only method I've found is (off the top of my head) Potion.getPotionById() Thanks for your help!
-
Hide player damage effect [1.16.X]
Hi! I'm cancelling the Living Hurt Event forge provides, which is working as expected and preventing any player damage. The player however is flashing red and playing the hit effect sound. Is there any way to disable this? -Note I am also cancelling the Knockback event. Thanks for your help!
-
How to add a Tutorial Step
Perfect, thank you
-
How to add a Tutorial Step
A quick follow up question, how would I check if this is the currently active step?
-
How to add a Tutorial Step
Thank you, I'll do that!
-
How to add a Tutorial Step
Hey! I'm trying to add a tutorial step between 'MovementStep' and 'FindTreeStep'. It seems simple enough, but I'm trying to find a clean way to do this. Thanks for your help!
-
How to get the sum of all enchantment levels equipped
hahaha I'm very tired. (and an idiot from the looks of things)
-
How to get the sum of all enchantment levels equipped
Thanks Diesieben! I added this to my Utils class. I used this for reference whilst doing it, thanks Tavi!
-
How to get the sum of all enchantment levels equipped
Hi! I'm trying to get the total enchantment level of a specific enchantment equipped when wearing armor. For example, if the player has: Boots with CUSTOM_ENCH V Helmet with CUSTOM_ENCH III I will get the value 5 + 3 = 8. I've figured out how to get the max level, (e.g. the example above would return 5 as it's larger than 3), however I haven't figured out how to get the cumulative value. Thanks for your help!
-
Check if player wakes up in the Morning
This is perfect, thank you!
-
How to create the regeneration effect on hearts for other HUD elements
Thank you!
-
Check if player wakes up in the Morning
Hi, I'm trying to detect when the player wakes up in the morning. The Player Wakes Up Event is firing whenever I press wake up.. So I'm wondering if there's a workaround to only run my code if the player slept through the night? Checking if the world is daytime isn't working, as the event seems to fire before the time is changed. Thanks for your help!
-
How to create the regeneration effect on hearts for other HUD elements
I have a custom HUD above the hunger bar that I want to imitate the 'wave' effect applied on the player's hearts when they have the regeneration effect. I've tried to make sense of the Class for this, however it seems incredibly confusing as the variables are very shortly named. Any help would be greatly appreciated! Of course I'm not asking for someone to do this for me, just if anyone knows any tips or pointers to get me started.
-
How to run code every time a Potion effect is applied
I see, thank you so much for all your help!
-
How to run code every time a Potion effect is applied
Thank you! My Potion isn't using Attribute modifiers however, is there a way I can still use this?
-
How to run code every time a Potion effect is applied
I'm currently using a tick event to check if the Player has the Potion Effect, with a Boolean Capability to only run the code on the first tick of the potion effect being applied. PSEUDOCODE: tickEvent(PlayerTickEvent event) { if(we're on the server){ if(player doesn't have effect capability && player has potion effect) { // Do stuff give player active effect capability; } else if (player has effect capability && player does not have potion effect) { // Do stuff remove player active effect capability } } } The issue here is that if the potion effect is applied again whilst the player has it, the first line of code doesn't run. Is there a workaround to this? Thanks for your help!
-
Attach Attribute to an existing entity
Hi, I'm wondering if anyone knows the best way to attach a custom attribute to a pre-existing entity. Thanks for your help!
IPS spam blocked by CleanTalk.