Jump to content

Recommended Posts

Posted

I have problem with my entity spawn on server.

 

 

 

java.util.concurrent.ExecutionException: java.lang.NoSuchMethodError: cz.grossik.farmcraft2.tractor.EntityTractor: method <init>(Lnet/minecraft/world/World;)V not found

at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_101]

at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_101]

at net.minecraft.util.Util.runTask(Util.java:26) [util.class:?]

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

at net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:408) [DedicatedServer.class:?]

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

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

at java.lang.Thread.run(Unknown Source) [?:1.8.0_101]

Caused by: java.lang.NoSuchMethodError: cz.grossik.farmcraft2.tractor.EntityTractor: method <init>(Lnet/minecraft/world/World;)V not found

at cz.grossik.farmcraft2.item.ItemTractor.onItemRightClick(ItemTractor.java:55) ~[itemTractor.class:?]

at net.minecraft.item.ItemStack.useItemRightClick(ItemStack.java:176) ~[itemStack.class:?]

at net.minecraft.server.management.PlayerInteractionManager.processRightClick(PlayerInteractionManager.java:391) ~[PlayerInteractionManager.class:?]

at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:740) ~[NetHandlerPlayServer.class:?]

at net.minecraft.network.play.client.CPacketPlayerTryUseItem.processPacket(CPacketPlayerTryUseItem.java:43) ~[CPacketPlayerTryUseItem.class:?]

at net.minecraft.network.play.client.CPacketPlayerTryUseItem.processPacket(CPacketPlayerTryUseItem.java:9) ~[CPacketPlayerTryUseItem.class:?]

at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:15) ~[PacketThreadUtil$1.class:?]

at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_101]

at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_101]

at net.minecraft.util.Util.runTask(Util.java:25) ~[util.class:?]

... 5 more

 

 

 

Item right click:

@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
    {     
        	if (!worldIn.isRemote)
        	{
        		EntityTractor entity = new EntityTractor(worldIn);
        		entity.setPosition(playerIn.posX, playerIn.posY, playerIn.posZ);
        		worldIn.spawnEntityInWorld(entity);

        		--itemStackIn.stackSize;
            return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
        }
        else
        {
            return new ActionResult(EnumActionResult.PASS, itemStackIn);
        }
    }

Posted

It didn't help.

 

use my code, it work on me  :)

 

public class FireBallItem extends Item
{
    public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
    {
        if (!playerIn.capabilities.isCreativeMode)
        {
            --itemStackIn.stackSize;
        }
        worldIn.playSound((EntityPlayer)null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.4F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
        if (!worldIn.isRemote)
        {
            FireBall entitythrowable = new FireBall(worldIn, playerIn);
            entitythrowable.setHeadingFromThrower(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F);
            worldIn.spawnEntityInWorld(entitythrowable);
        }
        playerIn.addStat(StatList.getObjectUseStats(this));
        return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
    }
}

 

 

EDIT: ofc you have to configure it for yourself , but it should work out

 

Posted

@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
    {   
	if (!playerIn.capabilities.isCreativeMode)
        {
            --itemStackIn.stackSize;
        }

        if (!worldIn.isRemote)
        {
        	EntityTractor Tractor = new EntityTractor(worldIn);
        	Tractor.setPosition(playerIn.posX, playerIn.posY, playerIn.posZ);
        	worldIn.spawnEntityInWorld(Tractor);       
        }
        	
        playerIn.addStat(StatList.getObjectUseStats(this));
        return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
    }

 

Still the same error.

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



×
×
  • Create New...

Important Information

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