I've searched through google and read that this is a problem.
I can't prevent milk from removing my potion effect. I tried disabling milk in the curative items list, it didn't work, and one of them crashed with a player ticking exception. Canceling the potionremoveevent resulted in the same thing.
---- Minecraft Crash Report ----
// I just don't know what went wrong
Time: 9/1/19 12:03 PM
Description: Ticking player
java.util.ConcurrentModificationException: null
at java.util.HashMap$HashIterator.remove(HashMap.java:1459) ~[?:1.8.0_212] {}
at net.minecraft.entity.LivingEntity.clearActivePotions(LivingEntity.java:761) ~[?:?] {}
at net.minecraft.item.MilkBucketItem.onItemUseFinish(MilkBucketItem.java:36) ~[?:?] {}
at net.minecraft.item.ItemStack.onItemUseFinish(ItemStack.java:208) ~[?:?] {}
at net.minecraft.entity.LivingEntity.onItemUseFinish(LivingEntity.java:2778) ~[?:?] {}
at net.minecraft.entity.player.ServerPlayerEntity.onItemUseFinish(ServerPlayerEntity.java:1054) ~[?:?] {pl:accesstransformer:B}
at net.minecraft.entity.LivingEntity.updateActiveHand(LivingEntity.java:2664) ~[?:?] {}
at net.minecraft.entity.LivingEntity.tick(LivingEntity.java:2112) ~[?:?] {}
at net.minecraft.entity.player.PlayerEntity.tick(PlayerEntity.java:235) ~[?:?] {pl:accesstransformer:B}
at net.minecraft.entity.player.ServerPlayerEntity.playerTick(ServerPlayerEntity.java:381) ~[?:?] {pl:accesstransformer:B}
at net.minecraft.network.play.ServerPlayNetHandler.tick(ServerPlayNetHandler.java:183) ~[?:?] {}
at net.minecraft.network.NetworkManager.tick(NetworkManager.java:245) ~[?:?] {}
at net.minecraft.network.NetworkSystem.tick(NetworkSystem.java:148) ~[?:?] {}
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:881) ~[?:?] {pl:accesstransformer:B}
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:799) ~[?:?] {pl:accesstransformer:B}
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) ~[?:?] {pl:runtimedistcleaner:A}
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:645) [?:?] {pl:accesstransformer:B}
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212] {}
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Thread: Server thread
Stacktrace:
at java.util.HashMap$HashIterator.remove(HashMap.java:1459)
at net.minecraft.entity.LivingEntity.clearActivePotions(LivingEntity.java:761)
at net.minecraft.item.MilkBucketItem.onItemUseFinish(MilkBucketItem.java:36)
at net.minecraft.item.ItemStack.onItemUseFinish(ItemStack.java:208)
at net.minecraft.entity.LivingEntity.onItemUseFinish(LivingEntity.java:2778)
at net.minecraft.entity.player.ServerPlayerEntity.onItemUseFinish(ServerPlayerEntity.java:1054)
at net.minecraft.entity.LivingEntity.updateActiveHand(LivingEntity.java:2664)
at net.minecraft.entity.LivingEntity.tick(LivingEntity.java:2112)
at net.minecraft.entity.player.PlayerEntity.tick(PlayerEntity.java:235)
-- Player being ticked --
Details:
Entity Type: minecraft:player (net.minecraft.entity.player.ServerPlayerEntity)
Entity ID: 348
Entity Name: Dev
Entity's Exact location: -183.23, 69.00, 61.58
Entity's Block location: World: (-184,69,61), Chunk: (at 8,4,13 in -12,3; contains blocks -192,0,48 to -177,255,63), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
Entity's Momentum: 0.00, -0.08, 0.00
Entity's Passengers: []
Entity's Vehicle: ~~ERROR~~ NullPointerException: null
Stacktrace:
at net.minecraft.entity.player.ServerPlayerEntity.playerTick(ServerPlayerEntity.java:381)
at net.minecraft.network.play.ServerPlayNetHandler.tick(ServerPlayNetHandler.java:183)
at net.minecraft.network.NetworkManager.tick(NetworkManager.java:245)
-- Ticking connection --
Details:
Connection: net.minecraft.network.NetworkManager@79c84d7
Stacktrace:
at net.minecraft.network.NetworkSystem.tick(NetworkSystem.java:148)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:881)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:799)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:645)
at java.lang.Thread.run(Thread.java:748)
-- System Details --
Details:
Minecraft Version: 1.14.4
Minecraft Version ID: 1.14.4
Operating System: Mac OS X (x86_64) version 10.14.5
Java Version: 1.8.0_212, AdoptOpenJDK
Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), AdoptOpenJDK
Memory: 72759824 bytes (69 MB) / 1037041664 bytes (989 MB) up to 1908932608 bytes (1820 MB)
CPUs: 4
JVM Flags: 1 total; -Xss1M
FML: New FML!
Loaded coremods (and transformers): Nothing
Player Count: 1 / 8; [ServerPlayerEntity['Dev'/348, l='New World', x=-183.23, y=69.00, z=61.58]]
Data Packs: vanilla, mod:forge, mod:bombsaway
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'forge'
I'm not really sure why this is happening, and I haven't modded with 1.14 yet and it looks like stuff has changed...
Somewhere a list is getting modified while iterating through it. Line 48 in RadiationEffect is adding an effect, and it looks like the method is called when an effect is removed. Maybe this is causing the exception.
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, LivingEntity entityLiving) {
if (!worldIn.isRemote) entityLiving.curePotionEffects(stack); // FORGE - move up so stack.shrink does not turn stack into air
if (entityLiving instanceof ServerPlayerEntity) {
ServerPlayerEntity serverplayerentity = (ServerPlayerEntity)entityLiving;
CriteriaTriggers.CONSUME_ITEM.trigger(serverplayerentity, stack);
serverplayerentity.addStat(Stats.ITEM_USED.get(this));
}
if (entityLiving instanceof PlayerEntity && !((PlayerEntity)entityLiving).abilities.isCreativeMode) {
stack.shrink(1);
}
if (!worldIn.isRemote) {
entityLiving.clearActivePotions();
}
return stack.isEmpty() ? new ItemStack(Items.BUCKET) : stack;
}
milk bucket clears the potions twice:
entityLiving.clearActivePotions(); and if (!worldIn.isRemote) entityLiving.curePotionEffects(stack); // FORGE - move up so stack.shrink does not turn stack into air
I successfully relocated Line 48, and prevented the crashing, however the milk does not work, probably because of entityLiving.clearActivePotions(); in MilkBucketItem.
Why no subscribe to the use item event and cancel it if the item is a milk bucket, that way the milk bucket code isn't called. Then remove all of the effects the player has except for yours, the radiation one.
I've searched through google and read that this is a problem.
I can't prevent milk from removing my potion effect. I tried disabling milk in the curative items list, it didn't work, and one of them crashed with a player ticking exception. Canceling the potionremoveevent resulted in the same thing.
My code is here: https://github.com/jay20162016/bombsaway_forge_mod
Can you post the crash report? I don't think there is much I can do until I see that.
This is after drinking milk on RadiationEffect
I'm not really sure why this is happening, and I haven't modded with 1.14 yet and it looks like stuff has changed...
Somewhere a list is getting modified while iterating through it. Line 48 in RadiationEffect is adding an effect, and it looks like the method is called when an effect is removed. Maybe this is causing the exception.
When it is removed by expiry it doesn't crash though. It might have to do with milk specifically, not just curative items
milk bucket clears the potions twice:
entityLiving.clearActivePotions(); and if (!worldIn.isRemote) entityLiving.curePotionEffects(stack); // FORGE - move up so stack.shrink does not turn stack into air
I successfully relocated Line 48, and prevented the crashing, however the milk does not work, probably because of entityLiving.clearActivePotions(); in MilkBucketItem.
Why no subscribe to the use item event and cancel it if the item is a milk bucket, that way the milk bucket code isn't called. Then remove all of the effects the player has except for yours, the radiation one.
I got it working by canceling the Potion Remove Event
Sweet! Sounds easier than what I suggested! I didn't even know that was an event.