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.

Featured Replies

Posted

Hello,

I have the following code as shown:

//potion effects?
if (player != null && event.phase == TickEvent.ClientTickEvent.Phase.START) {
    Collection<EffectInstance> effects = player.getActivePotionEffects();
    if (!effects.isEmpty()) {

        for (EffectInstance e : effects) {

            player.removePotionEffect(e.getPotion());

            player.addPotionEffect(new EffectInstance(e.getPotion(), e.getDuration(), e.getAmplifier(), true, false));
        }

    }

 

Now this throws a ConcurrentModificationException at the line of the for-loop, and I'm not sure why. Supposedly you cannot modify a list while using a for-loop, but I am not modifying the effects Collection as its already been assigned.

 

[14:03:03] [Client thread/ERROR] [ne.mi.ev.EventBus/EVENTBUS]: Exception caught during firing event: null
    Index: 1
    Listeners:
        0: NORMAL
        1: ASM: class flytre.cineroid.ForgeEvents tick(Lnet/minecraftforge/event/TickEvent$ClientTickEvent;)V
        2: ASM: net.minecraftforge.common.ForgeInternalHandler@1beb3b74 checkSettings(Lnet/minecraftforge/event/TickEvent$ClientTickEvent;)V
java.util.ConcurrentModificationException
    at java.base/java.util.HashMap$HashIterator.nextNode(HashMap.java:1498)
    at java.base/java.util.HashMap$ValueIterator.next(HashMap.java:1526)
    at flytre.cineroid.ForgeEvents.tick(ForgeEvents.java:66)
    at net.minecraftforge.eventbus.ASMEventHandler_1_ForgeEvents_tick_ClientTickEvent.invoke(.dynamic)
    at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:80)
    at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258)
    at net.minecraftforge.fml.hooks.BasicEventHooks.onPreClientTick(BasicEventHooks.java:104)
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1330)
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:904)
    at net.minecraft.client.Minecraft.run(Minecraft.java:384)
    at net.minecraft.client.main.Main.main(Main.java:128)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55)
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37)
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54)
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72)
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:81)
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:65)
    at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:101)

 

 

I'm wondering how to fix this code! (My end goal is to remove potion particles from the player on the client-side, which I attempt to do by removing the effect and re-adding the effect without particles.)

Edited by Flytre
Error Detail

  • Author

Looks like I'm going about it completely wrong. Can anyone point me in the direction of the right way to do this?

8 minutes ago, Flytre said:

Looks like I'm going about it completely wrong. Can anyone point me in the direction of the right way to do this?

Use an Iterator and a while loop. Also you should check if the PotionEffect has the particles so you are not changing them every tick.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

  • Author
1 hour ago, Animefan8888 said:

Use an Iterator and a while loop. Also you should check if the PotionEffect has the particles so you are not changing them every tick.

Thank you!

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...

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.