Minecraft add potion effect, from custom potion effect

Currently trying to create a potion effect that once it runs out of time, applies other potion effects to the player. Seemed simple enough yet I found a few errors and bugs trying to accomplish this,

Directly trying to add the effect

@Override

public void performEffect(EntityLivingBase entity, int amplifier){

if (entity instanceof EntityPlayer)

{

EntityPlayer player = (EntityPlayer)entity;

if(player != null){

if(player.getActivePotionEffect(PotionRegistry.effectBuzz) != null){

int duraction = player.getActivePotionEffect(PotionRegistry.effectBuzz).getDuration();

if(duration <= 2){

player.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, 1200));

}

}

}

}

}

Needless to say this produces this error

[16:10:04] [Server thread/ERROR]: Encountered an unexpected exception

net.minecraft.util.ReportedException: Ticking player

at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:212) ~[NetworkSystem.class:?]

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:807) ~[MinecraftServer.class:?]

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:688) ~[MinecraftServer.class:?]

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) ~[IntegratedServer.class:?]

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:537) [MinecraftServer.class:?]

at java.lang.Thread.run(Unknown Source)...

Read More »

By: StackOverFlow - Monday, 16 April

Related Posts

  • Older News
  • How to run Maincraft above version 1.7 StackOverFlow (2 days ago) - Now use this methodjava -Xmx1024M -Djava.library.path=C:\Users\roman\AppData\Roaming/.minecraft/versions/1.10.1/natives -cp C:\Users\roman\AppData\Roaming.minecraft\libraries\net\java\jinput\jinput\2.0.5\jinput-2.0.5.jar;C:\Users\roman\AppData\Roaming.minecraft\libraries\net\java\jinput\jinput-platform\2.0.5\jinput-platform-2.0.5-natives-windows.jar;C:\Users\roman\AppData\Roaming.minecraft\libraries\net\java\jutils\jutils\1.0.0\jutils-1.0.0.jar;C:\Users\roman\AppData\Roaming.minecraft\libraries\net\minecraft\launchwrapper\1.5\launchwrapper-1.5.jar;C:\Users\roman\AppData\Roaming.minecraft\libraries\net\sf\jopt-simple\jopt-simple\4.5\jopt-simple-4.5.jar;C:\Users\roman\AppData\Roaming.minecraft\libraries\optifine\OptiFine\1.5.2_HD_U_D5\OptiFine-1.5.2_HD_U_D5.jar;C:\Users\roman\AppData\Roaming.minecraft\libraries\org\lwjgl\lwjgl\lwjgl\2.9.0\lwjgl-2.9.0.jar;C:\Users\roman\AppData\Roaming.minecraft\libraries\org\lwjgl\lwjgl\lwjgl-platform\2.9.0\lwjgl-platform-2.9.0-natives-windows.jar;C:\Users\roman\AppData\Roaming.minecraft\libraries\org\lwjgl\lwjgl\lwjgl_util\2.9.0\lwjgl_util-2.9.0.jar;C:\Users\roman\AppData\Roaming.minecraft\libraries\org\ow2\asm\asm-all\4.1\asm-all-4.1.jar;C:\Users\roman\AppData\Roaming/.minecraft/versions/1.10.1/1.10.1.jar net.minecraft.client.main.Main --username user --version 1.10.1 --gameDir C:\Users\roman\AppData\Roaming/.minecraft --assetsDir C:\Users\roman\AppData\Roaming/.minecraft/assets --assetsIndex 1.10 --uuid 00000000-0000-0000-0000-000000000000 --accessToken 00000000-0000-0000-0000-000000000000 --userProperties {"twitch_access_token":["00000000-0000-0000-0000-000000000000"]} --userType mojang --height 480 --width...
  • Android make boomerang [on hold] StackOverFlow (3 days ago) - I need to implement effect like instagram boomerang in my application. Help please, from what I need to start? I have tried to do this with ffmpeg, but it's very...