Posted October 23, 20196 yr Hello, I'm trying to spawn a Potion EntityItem with EntityItem potion1 = new EntityItem(worldIn, pos.getX(), pos.getY(), pos.getZ(), new PotionUtils().addPotionToItemStack(new ItemStack(Items.POTIONITEM), PotionTypes.WATER)); worldIn.spawnEntity(potion1); But every time I perform the action that should drop me the potion I get this error: [16:16:52] [Server thread/FATAL] [net.minecraft.server.MinecraftServer]: Error executing task java.util.concurrent.ExecutionException: java.lang.NoSuchMethodError: net.minecraft.potion.PotionUtils: method <init>()V not found at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_222] at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_222] at net.minecraft.util.Util.func_181617_a(SourceFile:47) [h.class:?] at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:723) [MinecraftServer.class:?] at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:397) [nz.class:?] at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:668) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526) [MinecraftServer.class:?] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222] Caused by: java.lang.NoSuchMethodError: net.minecraft.potion.PotionUtils: method <init>()V not found at com.environment.randomdrops.events.RandomDrops.Drops(RandomDrops.java:512) ~[RandomDrops.class:?] at net.minecraft.block.Block.removedByPlayer(Block.java:1178) ~[aow.class:?] at net.minecraft.server.management.PlayerInteractionManager.removeBlock(PlayerInteractionManager.java:271) ~[or.class:?] at net.minecraft.server.management.PlayerInteractionManager.func_180237_b(PlayerInteractionManager.java:324) ~[or.class:?] at net.minecraft.server.management.PlayerInteractionManager.func_180785_a(PlayerInteractionManager.java:244) ~[or.class:?] at net.minecraft.network.NetHandlerPlayServer.func_147345_a(NetHandlerPlayServer.java:704) ~[pa.class:?] at net.minecraft.network.play.client.CPacketPlayerDigging.func_148833_a(SourceFile:40) ~[lp.class:?] at net.minecraft.network.play.client.CPacketPlayerDigging.func_148833_a(SourceFile:10) ~[lp.class:?] at net.minecraft.network.PacketThreadUtil$1.run(SourceFile:13) ~[hv$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_222] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_222] at net.minecraft.util.Util.func_181617_a(SourceFile:46) ~[h.class:?] ... 5 more The if (!entity.world.isRemote) exists already
October 23, 20196 yr Author 37 minutes ago, diesieben07 said: PotionUtils.addPotionToItemStack is a static method (in fact all methods in PotionUtils are static). Why are you calling it as if it were an instance method? Your IDE should warn you about this, too. I need it to add some potion effects to a potion itemstack for a little block that drops few items when broken for a minigame I'm creating. if this is wrong how can I add it?
October 23, 20196 yr Author 1 hour ago, diesieben07 said: Did you read what I said? Do you know basic Java (difference between static and instance methods)? Oh sorry, I had the suppress warning and I didn't notice it
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.