Jump to content

Problem using getActivePotionEffect


BonusPlay3

Recommended Posts

I was trying to get effects level, but when i use:

 

if (par3EntityPlayer.isPotionActive(Potion.moveSpeed.id))
	{
		int i = (par3EntityPlayer.getActivePotionEffect(Potion.moveSpeed.id).getAmplifier());
		wantedVelocity += (1 + i) * (0.35);
	}

 

it crashes my game. Eclipse says:'The method getActivePotionEffect(Potion) in the type EntityLivingBase is not applicable for the arguments (int)'.

 

crash-2014-08-13_16.29.54-server.txt

 

 

---- Minecraft Crash Report ----

// You should try our sister game, Minceraft!

 

Time: 13.08.14 16:29

Description: Exception in server tick loop

 

java.lang.Error: Unresolved compilation problem:

The method getActivePotionEffect(Potion) in the type EntityLivingBase is not applicable for the arguments (int)

 

at com.bonusplay3.bonuscraft.item.ItemNitroBoots.onItemRightClick(ItemNitroBoots.java:39)

at net.minecraft.item.ItemStack.useItemRightClick(ItemStack.java:166)

at net.minecraft.server.management.ItemInWorldManager.tryUseItem(ItemInWorldManager.java:345)

at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:575)

at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74)

at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122)

at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:247)

at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:736)

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:624)

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:495)

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:762)

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- System Details --

Details:

Minecraft Version: 1.7.10

Operating System: Windows 7 (amd64) version 6.1

Java Version: 1.8.0_11, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 866706304 bytes (826 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML: MCP v9.05 FML v7.10.25.1199 Minecraft Forge 10.13.0.1199 5 mods loaded, 5 mods active

mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

FML{7.10.25.1199} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.0.1199.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Forge{10.13.0.1199} [Minecraft Forge] (forgeSrc-1.7.10-10.13.0.1199.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

BonusCraft{1.7.10-1.0} [bonusCraft] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Baubles{1.0.1.3} [baubles] (Baubles-deobf-1.7.10-1.0.1.3.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Profiler Position: N/A (disabled)

Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

Player Count: 1 / 8; [EntityPlayerMP['ForgeDevName'/0, l='New World', x=-1115,73, y=0,50, z=-749,06]]

Type: Integrated Server (map_client.txt)

Is Modded: Definitely; Client brand changed to 'fml,forge'

 

 

crash-2014-08-13_16.29.55-client.txt

 

 

---- Minecraft Crash Report ----

// I let you down. Sorry :(

 

Time: 13.08.14 16:29

Description: Unexpected error

 

java.lang.Error: Unresolved compilation problem:

The method getActivePotionEffect(Potion) in the type EntityLivingBase is not applicable for the arguments (int)

 

at com.bonusplay3.bonuscraft.item.ItemNitroBoots.onItemRightClick(ItemNitroBoots.java:39)

at net.minecraft.item.ItemStack.useItemRightClick(ItemStack.java:166)

at net.minecraft.client.multiplayer.PlayerControllerMP.sendUseItem(PlayerControllerMP.java:434)

at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1556)

at net.minecraft.client.Minecraft.runTick(Minecraft.java:2043)

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1038)

at net.minecraft.client.Minecraft.run(Minecraft.java:961)

at net.minecraft.client.main.Main.main(Main.java:164)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at GradleStart.bounce(GradleStart.java:108)

at GradleStart.startClient(GradleStart.java:101)

at GradleStart.main(GradleStart.java:66)

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at com.bonusplay3.bonuscraft.item.ItemNitroBoots.onItemRightClick(ItemNitroBoots.java:39)

at net.minecraft.item.ItemStack.useItemRightClick(ItemStack.java:166)

at net.minecraft.client.multiplayer.PlayerControllerMP.sendUseItem(PlayerControllerMP.java:434)

at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1556)

 

-- Affected level --

Details:

Level name: MpServer

All players: 1 total; [EntityClientPlayerMP['ForgeDevName'/0, l='MpServer', x=-1115,73, y=2,12, z=-749,06]]

Chunk stats: MultiplayerChunkCache: 435, 435

Level seed: 0

Level generator: ID 01 - flat, ver 0. Features enabled: false

Level generator options:

Level spawn location: World: (-1099,4,-741), Chunk: (at 5,0,11 in -69,-47; contains blocks -1104,0,-752 to -1089,255,-737), Region: (-3,-2; contains chunks -96,-64 to -65,-33, blocks -1536,0,-1024 to -1025,255,-513)

Level time: 17416 game time, 1454 day time

Level dimension: 0

Level storage version: 0x00000 - Unknown?

Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)

Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: false

Forced entities: 1 total; [EntityClientPlayerMP['ForgeDevName'/0, l='MpServer', x=-1115,73, y=2,12, z=-749,06]]

Retry entities: 0 total; []

Server brand: fml,forge

Server type: Integrated singleplayer server

Stacktrace:

at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:417)

at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2567)

at net.minecraft.client.Minecraft.run(Minecraft.java:990)

at net.minecraft.client.main.Main.main(Main.java:164)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at GradleStart.bounce(GradleStart.java:108)

at GradleStart.startClient(GradleStart.java:101)

at GradleStart.main(GradleStart.java:66)

 

-- System Details --

Details:

Minecraft Version: 1.7.10

Operating System: Windows 7 (amd64) version 6.1

Java Version: 1.8.0_11, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 867930728 bytes (827 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML: MCP v9.05 FML v7.10.25.1199 Minecraft Forge 10.13.0.1199 5 mods loaded, 5 mods active

mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

FML{7.10.25.1199} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.0.1199.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Forge{10.13.0.1199} [Minecraft Forge] (forgeSrc-1.7.10-10.13.0.1199.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

BonusCraft{1.7.10-1.0} [bonusCraft] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Baubles{1.0.1.3} [baubles] (Baubles-deobf-1.7.10-1.0.1.3.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Launched Version: 1.7.10

LWJGL: 2.9.1

OpenGL: Mobile Intel® 4 Series Express Chipset Family GL version 2.1.0 - Build 8.15.10.2302, Intel

GL Caps: Using GL 1.3 multitexturing.

Using framebuffer objects because EXT_framebuffer_object is supported.

Anisotropic filtering is supported and maximum anisotropy is 2.

Shaders are available because OpenGL 2.1 is supported.

 

Is Modded: Definitely; Client brand changed to 'fml,forge'

Type: Client (map_client.txt)

Resource Packs: []

Current Language: English (US)

Profiler Position: N/A (disabled)

Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

Anisotropic Filtering: Off (1)

 

 

Thanks for at least looking at my post :)

Link to comment
Share on other sites

That method does not want a potion id. Take off the '.id' and just pass the potion. It still may not work, however. You'll have to try it.

Link to comment
Share on other sites

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

    • Hello, new coder and first time posting, sorry if I get stuff wrong Been having a really difficult time trying to figure out this potion effect. I want to give a potion effect that denies the wither effect on the player. I've looked over a lot of different tutorials, and through some other mods and made something that sort of works but it was based on applyEffectTick and the players would still take a tick of damage before the potion effect kicked in. When looking up other ways to do this I saw there was like the PotionEvent but whenever I try to use it, I get errors of how it cannot be defined. This is my code right now that doesn't work package io.github.AndroPups.tsmp_models.effect; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectCategory; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.LivingEntity; public class NoWitherEffect extends MobEffect { public NoWitherEffect(MobEffectCategory mobEffectCategory, int color) { super(mobEffectCategory.BENEFICIAL, color); } public static void onPotionAdded(PotionEvent.PotionAddedEvent event) { LivingEntity entity = event.getEntityLiving(); MobEffect potionEffect = event.getPotionEffect().getEffect(); if (potionEffect == MobEffects.WITHER); { entity.removeEffect(MobEffects.WITHER); } } @Override public boolean isDurationEffectTick(int duration, int amplifier) { return true; } } And this code works but occasionally still applies damage because of ticking effect.   package io.github.AndroPups.tsmp_models.effect; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectCategory; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.LivingEntity; public class NoWitherEffect extends MobEffect { public NoWitherEffect(MobEffectCategory mobEffectCategory, int color) { super(mobEffectCategory.BENEFICIAL, color); } @Override public void applyEffectTick(LivingEntity pLivingEntity, int pAmplifier) { if (!pLivingEntity.level().isClientSide()) { if (pLivingEntity.hasEffect(MobEffects.WITHER)); { pLivingEntity.getEffect(MobEffects.WITHER); } } } @Override public boolean isDurationEffectTick(int duration, int amplifier) { return true; } } I've tried to see if PotionEvent was removed from recent Forge updates but can't really find any information on it. Any information at all would be helpful! Thanks!
    • Right after "private final Item item;" you will need "private final float chance;" Then you will need to add that variable to your constructor the same way you did for Item. It should work after that.
    • I am playing on Mac, tried to install a mod to the Forge mod folder, restarted Minecraft to activate it and now the game is crashing on launch with error code 1. Because I'm on Mac, I can't remotely access the mods folder without having to get into the Minecraft title screen to click the mods tab. Is there any way I can extract the file remotely, or is there a way to uninstall Forge so I can reinstall it with no mods?
    • I don't know how I missed it, but I did. The access transformer file had a capital T in it. Fixed that and the problem has been solved. I feel really stupid, but thank you for asking about that, because it had me rechecking until I finally saw it. I'm marking this solved.
  • Topics

×
×
  • Create New...

Important Information

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