Jump to content

[1.12.2] Keep player from entering certain chunks


Elrol_Arrowsend

Recommended Posts

I am trying to keep a player out of a certain area of the map, and the method I was using wasn't going to work. The event I was using cant be cancled so it would tell me that they entered the area but would not stop them from doing so. 

What would be the best way to do this?

Link to comment
Share on other sites

You can set the entities position/motion and also use the GetCollisionBoxes event to return a collision box that prevents the entity from going inside.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

Add a collision box to the list (if it intersects with the players AABB) to prevent the player from entering the chunk

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

Ok, im not sure I am following, I have the player, and this event, but how do I add a collision box to it?
 

    @SubscribeEvent
    public void onChunkEnter(EntityEvent.EnteringChunk event) {
    	if(event.getEntity() instanceof EntityPlayerMP) {
    		EntityPlayerMP player = (EntityPlayerMP)event.getEntity();
    		ChatMethods.error(player, "You can not go that way!");
    	}
    }

 

Link to comment
Share on other sites

I was talking about the GetCollisionBoxesEvent

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

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