Jump to content

How to prevent an entity from crossing a custom block?


OsHeaven

Recommended Posts

hi,

 

i want to build a block, that hostile mobs dont want to cross…

 

is there a possibility to change the pathNodeType in relation to the Entity what is collided with this block?

 

getAiPathNodeType() in relation to onEntityCollidedWithBlock() does not work

 

 

 

Link to comment
Share on other sites

I do not think this is possible because you don't have a reference to the entity which initiates the pathing check whatsoever. I suppose you might be able to replace the basic EntityMoveHelper with your wrapper that does the check for your specific block but this might cause incompatibilities with mods that attempt to do the same.

Link to comment
Share on other sites

You need to update the pathfinding code if you want the AI smart enough to avoid that block.  You can create custom PathNodeType objects (even though its an enum) using a Forge class called EnumHelper.  Example:

 

LADDER = EnumHelper.addEnum(PathNodeType.class, MODID + "LADDER", parameterTypes, 0.0F);  //0.0 means its as good as OPEN or WALKABLE

 

Link to comment
Share on other sites

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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • There is an issue with overloadedarmorbar - make a test without it
    • I started two worlds and I ran into the same problem on both of them. Both times my game froze after looting a chest on a ship from the ''When Dungeons Arise'' Mod. I assumed it was because of the sudden amount of achievements even tho that wasnt a problem in the past (my pc is pretty bad). But when I join the world it says ''joining world'' then I just see the unloaded world for a few seconds, so nothing but void. Then it says ''Loading terrain...'' as if i stepped in a portal. On the top right appears a message of a skill tree mod for a split second before the game then crashes. This happens every time for whatever reason on both worlds now. This is the crash report I got: The game crashed whilst unexpected error Error: java.lang.IncompatibleClassChangeError: Expecting non-static method 'void net.minecraft.client.gui.GuiComponent.m_93228_(com.mojang.blaze3d.vertex.PoseStack, int, int, int, int, int, int)' The link for the debug.log: https://paste.ee/p/u3eou# The link for the crash report: https://paste.ee/p/iBYik Dont know what helps here as info so heres a list of the mods. Advancement Plaques [Neo/Forge] AmbientSounds 6 Anvil Never Too Expensive AppleSkin Aquamirae (Forge) AttributeFix Balm Better Advancements Better Than Mending Bookshelf Born in Chaos Caelus API (Forge/NeoForge) Charm of Undying (Fabric/Forge/Quilt) Citadel Clumps Collective Colorful Hearts CorgiLib CraftPresence CreativeCore Curios API (Forge/NeoForge) DisenchantingForge Double Doors Easy Anvils [Forge & Fabric] EASY CRAFT Easy Experience Easy Piglins Easy Villagers Elytra Slot (Fabric/Forge/Quilt) Enchantment Descriptions End Remastered [NeoForge/Fabric] Enhanced Celestials - Blood, Blue, & Harvest (Super) Moons Equipment Compare [Neo/Forge] Even More Instruments! Forgiving Void GeckoLib Genshin Instruments Iceberg [Neo/Forge] Inventory HUD+ Item Highlighter [Neo/Forge] Jade 🔍 Jumpy Boats Just Enough Items (JEI) Just Zoom KleeSlabs Konkrete [Forge/NeoForge] L_Ender 's Cataclysm Legendary Tooltips [Neo/Forge] Majrusz Library Majrusz's Enchantments Mouse Tweaks Neat Obscure API (Forge) Overloaded Armor Bar Prism [Neo/Forge] Pufferfish's Skills [Fabric & Forge & NeoForge] Puzzles Lib [Forge & Fabric] Responsive Shields Royal Variations Savage Ender Dragon[Forge/Fabric] Structory: Towers Traveler's Backpack UniLib Upgraded Core Upgraded Netherite Upgraded Netherite : Ultimerite Vein Mining (Fabric/Forge/Quilt) When Dungeons Arise - Forge! When Dungeons Arise - Seven Seas Xaero's Minimap Xaero's World Map YUNG's API (Forge) YUNG's Better End Island (Forge) YUNG's Better Strongholds (Forge)
    • Make a test with another Launcher like MultiMC or AT Launcher
    • I'm playing on a Mac and when I launch from the normal forge launcher I get a GLFW error. So i'm using the Prism Launcher with java 8 trying to be able to make it run on a Mac. I've looked online but I keep getting hit with these logs and i'm not sure what to do. Log: https://mclo.gs/OVzhZtd
  • Topics

×
×
  • Create New...

Important Information

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