Jump to content

Recommended Posts

Posted (edited)

I am trying to create an entity which mimics the player using an item (placing a block, using a bucket, etc.).

I have a class VirtualPlayerEntity extends PlayerEntity, which is passed into the onItemRightClick method for the item my entity is holding.

My problem arises when that item is an empty bucket, used on a fluid block.

In the onItemRightClick method for the BucketItem class I get the error:

<com.trigonaut.mod.entity.VirtualPlayerEntity cannot be cast to net.minecraft.entity.player.ServerPlayerEntity>

caused by the FILLED_BUCKET criteria trigger.

 

How do I make VirtualPlayerEntity able to cast to ServerPlayerEntity? (preferably without extending it)
Is there a better way to emulate a player right-click?

How do other mods create this functionality?

 

Attached is my VirtualPlayerEntity class.

VirtualPlayerEntity.java

Edited by Trigonaut
including version of minecraft in title

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.