Jump to content

Recommended Posts

Posted (edited)

Hi, I'm currently trying to develop a mod, that stops the enderman from picking up blocks. I know such a mod already exists but ist is too comprehensive for my tasta and also not suppurts my current minecraft version. Also I wanted to learn something about minecraft modding. This is my fist minecraft mod.

I want to create an eventhandler like this:
 

@SubscribeEvent
public void onEndermanPickUpBlock(PickUpLootEvent event) {
    // Check if the entity picking up the block is an Enderman
    if (event.getEntity() instanceof EndermanEntity) {
        // Cancel the event to prevent the Enderman from picking up the block
        event.setCanceled(true);
    }
}

 

Sadly my informations seem to be outdated, since both the class EndermanEntity and the class PickUpLootEvent seem to have been renamed or removed completely in my current forge version 1.19.2-43.2.0

I also could not find a documentation, that would help me to find wout what happened to these classes. https://docs.minecraftforge.net/en/latest/ returns no results.

I found the class net.minecraft.world.entity.monster.EnderMan in the library files but I have no Idea what happened to the event. I hope someone can help me.

Edited by Lennard Schilling
typo
Posted
On 12/28/2022 at 4:51 PM, ChampionAsh5357 said:

You could deny the `EntityMobGriefingEvent` by setting the result, but you could also just disable mob griefing without the need for a mod.

Thanks, this event looks like what I'm looking for. Disabeling mob griefing in the settings would is not exactly what I want since it also removes the vilagers ability to consume food and it disables creeper block damage.

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.