Posted May 24, 20196 yr 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?
May 24, 20196 yr 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 Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.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)
May 24, 20196 yr Author How would I use the GetCollisionBoxes to do that, The event I was looking at was when an entity entered a chunk?
May 24, 20196 yr 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 Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.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)
May 24, 20196 yr Author 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!"); } }
May 24, 20196 yr I was talking about the GetCollisionBoxesEvent About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.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)
May 24, 20196 yr Author Ah, alright, makes sense then. I will see if I can get it working tomorrow. Thanks for the help, I will post back here when I get something drummed up.
May 24, 20196 yr you need to look at EntityEvent.EnteringChunk. i cant remember, but that event only fires when a entity spawns
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.