Jump to content

Recommended Posts

Posted

Hello, Mr./Ms.

My current requirement is to perform some behavior if the player's oxygen value decreases and some other behavior if the player's oxygen increases.

I didn't find an event that `listened to the player's oxygen value` change, so I used `TickEvent.ClientTickEvent` to try to listen to each player's oxygen change per tick.

I tried to get the instance of the player using `getEntity` and looked for methods related to oxygen in it, I found `getAirSupply` and `setAirSupply` methods.

These two methods do allow me to modify the player's oxygen, but if the player is in air, minecraft automatically restores 1 oxygen per tick, and when flooded, minecraft makes the player consume 1 oxygen per tick.

If I want my Mod to rigorously reduce the player's oxygen based on my conditions, can I just calculate and write multiple `if` judgments to rigorously reduce the player's oxygen?

Or does `forge` provide a way to cancel the `oxygen consumed/increased` event? Like canceling the injury event.

Addendum: What I said about strictly consuming the player's oxygen is the behavior of my Mod.

For example, I need to consume 3 oxygen per tick, but if the player is in air, the player will only actually consume 2 oxygen.

And if I need to regain 4 oxygen per tick, but if the player is in water, the player will actually only regain 3 oxygen.

Posted

You definitely need to be doing this on the server, not the client.

AFAIK there is no oxygen used event, so you will have to use a tick event. I would suggest using a capability to store the previous air level, and comparing it each tick.

Looking at LivingEntity#increaseAirSupply and LivingEntity#decreaseAirSupply you can see exactly how the air supply is replenished, the actual replenishing or losing is done in LivingEntity#baseTick.

Entity#setAirSupply is public, so you can set that to whatever you wish in order to update the vanilla bubbles rendering. Remember to check for the maxAirSupply, and if applicable the enchantments/effects on the player.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • New users at Temureceive a 40 Off discount on orders over 40 Off Use the code [ACS766913] during checkout to get TemuDiscount 40 Off For New Users. You n save 40 Off off your first order with the Promo Code available for a limited time only. Extra 30% off for new and existing customers + Up to $40 Off % off & more. Temu Promo Codes for New users- [ACS766913] Temudiscount code for New customers- [ACS766913] Temu $40 Off Promo Code- [ACS766913] what are Temu codes- ACS766913 does Temu give you $40 Off - [ACS766913] Yes Verified Temu Promo Code january 2025- {ACS766913} TemuNew customer offer {ACS766913} Temudiscount codejanuary 2025 {ACS766913} 40 off Promo Code Temu {ACS766913} Temu 40% off any order {ACS766913} 40 dollar off Temu code {ACS766913} TemuCoupon $40 Off off for New customers There are a number of discounts and deals shoppers n take advantage of with the Teemu Coupon Bundle [ACS766913]. TemuCoupon $40 Off off for New customers [ACS766913] will save you $40 Off on your order. To get a discount, click on the item to purchase and enter the code. You n think of it as a supercharged savings pack for all your shopping needs Temu Promo Code 80% off – [ACS766913] Free Temu codes 50% off – [ACS766913] TemuCoupon $40 Off off – [ACS766913] Temu buy to get ₱39 – [ACS766913] Temu 129 coupon bundle – [ACS766913] Temu buy 3 to get €99 – [ACS766913] Exclusive $40 Off Off TemuDiscount Code Temu $40 Off Off Promo Code : (ACS766913) Temu Discount Code $40 Off Bundle ACS766913) ACS766913 Temu $40 Off off Promo Code for Exsting users : ACS766913) Temu Promo Code $40 Off off Temu 40 Off coupon code (ACS766913) will save you 40 Off on your order. To get a discount, click on the item to purchase and enter the code. Yes, Temu offers 40 Off Coupon Code “ACS766913” for Existing Customers.  You can get a 40 Off bonus plus 30% off any purchase at Temu with the 40 Off Coupon Bundle at Temu if you sign up with the referral code [ACS766913] and make a first purchase of $40 Off or more. Temu Promo Code 40 off-{ACS766913} Temu Promo Code -{ACS766913} Temu Promo Code $40 Off off-{ACS766913} kubonus code -{ACS766913} Get ready to unlock a world of savings with our free Temu UK coupons! We’ve got you covered with a wide range of Temu UK coupon code options that will help you maximize your shopping experience.30% Off Temu UK Coupons, Promo Codes + 25% Cash Back [ ACS766913]   Yes, Temu offers 40 off coupon code {ACS766913} for first-time users. You can get a $40 bonus plus 40% off any purchase at Temu with the $40 Coupon Bundle if you sign up with the referral code [ACS766913] and make a first purchase of $40 or more. If you are who wish to join Temu, then you should use this exclusive TemuCoupon code 40 off (ACS766913) and get 40 off on your purchase with Temu. You can get a 40% discount with TemuCoupon code {ACS766913}. This exclusive offer is for existing customers and can be used for a 40 reduction on your total purchase. Enter coupon code {ACS766913} at checkout to avail of the discount. You can use the code {ACS766913} to get a 40 off TemuCoupon as a new customer. Apply this TemuCoupon code $40 off (ACS766913) to get a $40 discount on your shopping with Temu. If you’re a first-time user and looking for a TemuCoupon code $40 first time user(ACS766913) then using this code will give you a flat $40 Off and a 90% discount on your Temu shopping.     •    ACS766913: Enjoy flat 40% off on your first Temu order.     •    ACS766913: Download the Temu app and get an additional 40% off.     •    ACS766913: Celebrate spring with up to 90% discount on selected items.     •    ACS766913: Score up to 90% off on clearance items.     •    ACS766913: Beat the heat with hot summer savings of up to 90% off.     •    ACS766913: Temu UK Coupon Code to 40% off on Appliances at Temu. How to Apply Temu Coupon Code? Using the TemuCoupon code $40 off is a breeze. All you need to do is follow these simple steps:     1    Visit the Temu website or app and browse through the vast collection of products.     2    Once you’ve added the items you wish to purchase to your cart, proceed to the checkout page.     3    During the checkout process, you’ll be prompted to enter a coupon code or promo code.     4    Type in the coupon code: [ACS766913] and click “Apply.”     5    Voila! You’ll instantly see the $40 discount reflected in your total purchase amount. Temu New User Coupon: Up To 90% OFF For Existing Customers Temu Existing customer’s coupon codes are designed just for new customers, offering the biggest discounts 90% and the best deals currently available on Temu. To maximize your savings, download the Temu app and apply our Temu new user coupon during checkout.     •    ACS766913: New users can get up to 80% extra off.     •    ACS766913: Get a massive 40% off your first order!     •    ACS766913: Get 20% off on your first order; no minimum spending required.     •    ACS766913: Take an extra 15% off your first order on top of existing discounts.     •    ACS766913: Temu UK Enjoy a 40% discount on your entire first purchase.
    • i have just made a modpack and i accidentally added a few fabric mods and after deleting them i can no longer launch the pack if any one could help these are my latest logs [22:42:24] [main/INFO]:additionalClassesLocator: [optifine., net.optifine.] [22:42:25] [main/INFO]:Compatibility level set to JAVA_17 [22:42:25] [main/ERROR]:Mixin config epicsamurai.mixins.json does not specify "minVersion" property [22:42:25] [main/INFO]:Launching target 'forgeclient' with arguments [--version, forge-43.4.0, --gameDir, C:\Users\Mytht\curseforge\minecraft\Instances\overseer (1), --assetsDir, C:\Users\Mytht\curseforge\minecraft\Install\assets, --uuid, 4c176bf14d4041cba29572aa4333ca1d, --username, mythtitan0, --assetIndex, 1.19, --accessToken, ????????, --clientId, MGJiMTEzNGEtMjc3Mi00ODE0LThlY2QtNzFiODMyODEyYjM4, --xuid, 2535469006485684, --userType, msa, --versionType, release, --width, 854, --height, 480] [22:42:25] [main/WARN]:Reference map 'insanelib.refmap.json' for insanelib.mixins.json could not be read. If this is a development environment you can ignore this message [22:42:25] [main/WARN]:Reference map 'corpsecurioscompat.refmap.json' for gravestonecurioscompat.mixins.json could not be read. If this is a development environment you can ignore this message [22:42:25] [main/WARN]:Reference map 'nitrogen_internals.refmap.json' for nitrogen_internals.mixins.json could not be read. If this is a development environment you can ignore this message [22:42:25] [main/WARN]:Reference map 'arclight.mixins.refmap.json' for epicsamurai.mixins.json could not be read. If this is a development environment you can ignore this message [22:42:25] [main/WARN]:Reference map 'simplyswords-common-refmap.json' for simplyswords-common.mixins.json could not be read. If this is a development environment you can ignore this message [22:42:25] [main/WARN]:Reference map 'simplyswords-forge-refmap.json' for simplyswords.mixins.json could not be read. If this is a development environment you can ignore this message [22:42:25] [main/WARN]:Reference map '${refmap_target}refmap.json' for corgilib.forge.mixins.json could not be read. If this is a development environment you can ignore this message [22:42:25] [main/WARN]:Reference map 'MysticPotions-forge-refmap.json' for mysticpotions.mixins.json could not be read. If this is a development environment you can ignore this message [22:42:26] [main/WARN]:Reference map 'packetfixer-forge-forge-refmap.json' for packetfixer-forge.mixins.json could not be read. If this is a development environment you can ignore this message [22:42:26] [main/WARN]:Error loading class: atomicstryker/multimine/client/MultiMineClient (java.lang.ClassNotFoundException: atomicstryker.multimine.client.MultiMineClient) [22:42:26] [main/WARN]:@Mixin target atomicstryker.multimine.client.MultiMineClient was not found treechop.forge.compat.mixins.json:MultiMineMixin [22:42:26] [main/WARN]:Error loading class: com/simibubi/create/content/contraptions/components/fan/AirCurrent (java.lang.ClassNotFoundException: com.simibubi.create.content.contraptions.components.fan.AirCurrent) [22:42:26] [main/WARN]:Error loading class: shadows/apotheosis/ench/table/ApothEnchantContainer (java.lang.ClassNotFoundException: shadows.apotheosis.ench.table.ApothEnchantContainer) [22:42:26] [main/WARN]:@Mixin target shadows.apotheosis.ench.table.ApothEnchantContainer was not found origins_classes.mixins.json:common.apotheosis.ApotheosisEnchantmentMenuMixin [22:42:26] [main/WARN]:Error loading class: se/mickelus/tetra/blocks/workbench/WorkbenchTile (java.lang.ClassNotFoundException: se.mickelus.tetra.blocks.workbench.WorkbenchTile) [22:42:26] [main/WARN]:@Mixin target se.mickelus.tetra.blocks.workbench.WorkbenchTile was not found origins_classes.mixins.json:common.tetra.WorkbenchTileMixin [22:42:27] [main/WARN]:Error loading class: tfar/davespotioneering/blockentity/AdvancedBrewingStandBlockEntity (java.lang.ClassNotFoundException: tfar.davespotioneering.blockentity.AdvancedBrewingStandBlockEntity) [22:42:27] [main/WARN]:@Mixin target tfar.davespotioneering.blockentity.AdvancedBrewingStandBlockEntity was not found itemproductionlib.mixins.json:davespotioneering/AdvancedBrewingStandBlockEntityMixin [22:42:27] [main/WARN]:Error loading class: fuzs/visualworkbench/world/inventory/ModCraftingMenu (java.lang.ClassNotFoundException: fuzs.visualworkbench.world.inventory.ModCraftingMenu) [22:42:27] [main/WARN]:@Mixin target fuzs.visualworkbench.world.inventory.ModCraftingMenu was not found itemproductionlib.mixins.json:visualworkbench/ModCraftingMenuMixin [22:42:27] [main/WARN]:Error loading class: fuzs/easymagic/world/inventory/ModEnchantmentMenu (java.lang.ClassNotFoundException: fuzs.easymagic.world.inventory.ModEnchantmentMenu) [22:42:27] [main/WARN]:@Mixin target fuzs.easymagic.world.inventory.ModEnchantmentMenu was not found skilltree.mixins.json:easymagic/ModEnchantmentMenuMixin [22:42:27] [main/WARN]:Error loading class: shadows/apotheosis/ench/table/ApothEnchantmentMenu (java.lang.ClassNotFoundException: shadows.apotheosis.ench.table.ApothEnchantmentMenu) [22:42:27] [main/WARN]:@Mixin target shadows.apotheosis.ench.table.ApothEnchantmentMenu was not found skilltree.mixins.json:apotheosis/ApothEnchantContainerMixin [22:42:27] [main/WARN]:Error loading class: shadows/apotheosis/adventure/affix/socket/SocketingRecipe (java.lang.ClassNotFoundException: shadows.apotheosis.adventure.affix.socket.SocketingRecipe) [22:42:27] [main/WARN]:@Mixin target shadows.apotheosis.adventure.affix.socket.SocketingRecipe was not found skilltree.mixins.json:apotheosis/SocketingRecipeMixin [22:42:27] [main/WARN]:Error loading class: shadows/apotheosis/adventure/affix/socket/gem/bonus/AttributeBonus (java.lang.ClassNotFoundException: shadows.apotheosis.adventure.affix.socket.gem.bonus.AttributeBonus) [22:42:27] [main/WARN]:@Mixin target shadows.apotheosis.adventure.affix.socket.gem.bonus.AttributeBonus was not found skilltree.mixins.json:apotheosis/AttributeBonusMixin [22:42:27] [main/WARN]:Error loading class: shadows/apotheosis/adventure/affix/socket/gem/bonus/EnchantmentBonus (java.lang.ClassNotFoundException: shadows.apotheosis.adventure.affix.socket.gem.bonus.EnchantmentBonus) [22:42:27] [main/WARN]:@Mixin target shadows.apotheosis.adventure.affix.socket.gem.bonus.EnchantmentBonus was not found skilltree.mixins.json:apotheosis/EnchantmentBonusMixin [22:42:27] [main/WARN]:Error loading class: shadows/apotheosis/adventure/client/AdventureModuleClient (java.lang.ClassNotFoundException: shadows.apotheosis.adventure.client.AdventureModuleClient) [22:42:27] [main/WARN]:@Mixin target shadows.apotheosis.adventure.client.AdventureModuleClient was not found skilltree.mixins.json:apotheosis/AdventureModuleClientMixin [22:42:27] [main/WARN]:Error loading class: me/shedaniel/rei/RoughlyEnoughItemsCoreClient (java.lang.ClassNotFoundException: me.shedaniel.rei.RoughlyEnoughItemsCoreClient) [22:42:27] [main/WARN]:Error loading class: com/replaymod/replay/ReplayHandler (java.lang.ClassNotFoundException: com.replaymod.replay.ReplayHandler) [22:42:27] [main/WARN]:Error loading class: net/coderbot/iris/pipeline/newshader/ExtendedShader (java.lang.ClassNotFoundException: net.coderbot.iris.pipeline.newshader.ExtendedShader) [22:42:27] [main/WARN]:Error loading class: net/irisshaders/iris/pipeline/programs/ExtendedShader (java.lang.ClassNotFoundException: net.irisshaders.iris.pipeline.programs.ExtendedShader) [22:42:27] [main/INFO]:Initializing MixinExtras via com.llamalad7.mixinextras.service.MixinExtrasServiceImpl(version=0.3.6).
    • My Mohist server crashed as well but all it says in logs is " C:\Minecraft Mohist server>java -Xm6G -jar mohist.jar nogul  Error: Unable to access jarfile mohist.jar   C:\Minecraft Mohist server>PAUSE press any key to continue  .  .  . " Any ideas? i have the server file that its looking for where its looking for it.
  • Topics

×
×
  • Create New...

Important Information

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