Jump to content

Recommended Posts

Posted

I want to prevent that players can drink from a bucket of milk.

I added milk bottles instead. It makes more sense for me drinking from bottles instead from a bucket (except if it's beer :-D)

Alright the question is wich event is that? Where do i even find all those events? Has someone an up to date list of all the events?

 

Currently this is what i have.

I made a class TemEventHandlerOverride:

 

public class TemEventHandlerOverride {
@SubscribeEvent
public void MilkBucketDrinkable(){

}

}

I did not fill in an event, because i don't know wich 1.

 

I register it like this, in the preInit:

MinecraftForge.EVENT_BUS.register(new TemEventHandlerOverride());

I'm not sure if it has to be registered in the preInit of Init.

Posted

Got it working. I hope i have done it right:

public class TemEventHandlerOverride {
@SubscribeEvent
public void MilkBucketDrinkable(PlayerInteractEvent.RightClickItem event){
	ItemStack stack = event.getItemStack();
	if(stack!=null){
		if (stack.getItem() == Items.MILK_BUCKET){
			event.setCanceled(true);
		}
	}
}
}

Posted

I saw Lex Manos post a piece of code where he captures events and sends them to to nowhere land.  Here https://github.com/LexManos/YUNoMakeGoodMap/blob/master/src/main/java/net/minecraftforge/lex/yunomakegoodmap/generators/StructureLoader.java#L48

 

He just gets all block events and they go away puff gone.

Disclaimer:  I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.

Posted

I saw Lex Manos post a piece of code where he captures events and sends them to to nowhere land.  Here https://github.com/LexManos/YUNoMakeGoodMap/blob/master/src/main/java/net/minecraftforge/lex/yunomakegoodmap/generators/StructureLoader.java#L48

 

He just gets all block events and they go away puff gone.

That is him canceling all block updates not getting rid of events.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

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.