Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.16.4] Removing Mob AI
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 1
Joshua66252

[1.16.4] Removing Mob AI

By Joshua66252, January 12 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

Joshua66252    0

Joshua66252

Joshua66252    0

  • Tree Puncher
  • Joshua66252
  • Members
  • 0
  • 2 posts
Posted January 12

I'm Trying To Remove All AI From A Mob Currently I Have Removed All Goal Selector Goals But I'm Not Sure How To Go About Removing Target Selector Goals
This Is My Current Code

    public void handleZombie(Entity ent,EntityJoinWorldEvent event)
    {
        ZombieEntity castEnt=((ZombieEntity)ent);
        Set<PrioritizedGoal> goals = ObfuscationReflectionHelper.getPrivateValue(GoalSelector.class, castEnt.goalSelector, "goals");
        goals.clear();
    }


The Reason I Need To Remove Target Selector Goals Is Because If I Add

  castEnt.goalSelector.addGoal(2, new ZombieAttackGoal(castEnt, 1.0D, false));


It Will Start Attacking The Player

  • Quote

Share this post


Link to post
Share on other sites

ChampionAsh5357    160

ChampionAsh5357

ChampionAsh5357    160

  • World Shaper
  • ChampionAsh5357
  • Members
  • 160
  • 1020 posts
Posted January 13

Target selectors are a separate instance of GoalSelector. Also, read the documentation on ObfuscationReflectionHelper as you cannot provide a mapped name for a field. What you have currently will fail in production, not on userdev. I will assume your cast is hopefully checked as well, although why you do not supply a ZombieEntity for the parameter instead is questionable on if it is checked.

  • Quote

Share this post


Link to post
Share on other sites

Joshua66252    0

Joshua66252

Joshua66252    0

  • Tree Puncher
  • Joshua66252
  • Members
  • 0
  • 2 posts
Posted January 13 (edited)
4 hours ago, ChampionAsh5357 said:

Target selectors are a separate instance of GoalSelector. Also, read the documentation on ObfuscationReflectionHelper as you cannot provide a mapped name for a field. What you have currently will fail in production, not on userdev. I will assume your cast is hopefully checked as well, although why you do not supply a ZombieEntity for the parameter instead is questionable on if it is checked.

    @SubscribeEvent
	public void entSpawn(EntityJoinWorldEvent event)
	{
		if (event.getEntity() instanceof ZombieEntity) handleZombie((ZombieEntity) event.getEntity(), event);
	}

It does Check If Its A Zombie This Is The Code For That

Edit: Btw Can You Please Send Me The Docs For ObfuscationReflectionHelper I Can't Find Them

Edited January 13 by Joshua66252
  • Quote

Share this post


Link to post
Share on other sites

ChampionAsh5357    160

ChampionAsh5357

ChampionAsh5357    160

  • World Shaper
  • ChampionAsh5357
  • Members
  • 160
  • 1020 posts
Posted January 14
2 hours ago, Joshua66252 said:

Edit: Btw Can You Please Send Me The Docs For ObfuscationReflectionHelper I Can't Find Them

They're on the class in the source itself. All javadocs are located there.

2 hours ago, Joshua66252 said:

It does Check If Its A Zombie This Is The Code For That

Then the cast inside the method is even more unnecessary as you're passing in a ZombieEntity and can make the parameter a ZombieEntity.

  • Quote

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Arthurmeade12
      Error Conecting to My Minecraft Server

      By Arthurmeade12 · Posted 1 minute ago

      My minecraft server and client start up normally with the same forge version, the same mods, and the same wi-fi. When I connect to my server it gives me an error about NBT tags. I have no Idea how to fix this error. Thank you for the help!   Latest and Debug logs for both client and server are attached.  client-debug.log client-latest.log server-debug.log server-latest.log
    • poopoodice
      [1.16.5] GameOverlay

      By poopoodice · Posted 18 minutes ago

      Last time I checked is still there, AbstractGui.fill()
    • Draco18s
      [1.16.4] Why recipe result calculated on server side?

      By Draco18s · Posted 26 minutes ago

      The server would have to do all the same calculations the client did in order to approve.
    • Arthurmeade12
      Forge Server

      By Arthurmeade12 · Posted 27 minutes ago

      I am running my forge server on MacOS Catalina. Will it work correctly if I update to MacOS Big Sur? Thanks!
    • Woodside
      [SOLVED][1.15.2]ServerWorld.spawnParticle excluding specific player

      By Woodside · Posted 59 minutes ago

      Oop, I was looking at sendPacketWithinDistance. I didn't realize I could grab the list of players and send each one a packet on a whim. I misunderstood the code at first!
  • Topics

    • Arthurmeade12
      0
      Error Conecting to My Minecraft Server

      By Arthurmeade12
      Started 1 minute ago

    • Luis_ST
      3
      [1.16.5] GameOverlay

      By Luis_ST
      Started Yesterday at 12:21 PM

    • S-Spirit
      5
      [1.16.4] Why recipe result calculated on server side?

      By S-Spirit
      Started Yesterday at 09:43 PM

    • Arthurmeade12
      0
      Forge Server

      By Arthurmeade12
      Started 27 minutes ago

    • Woodside
      4
      [SOLVED][1.15.2]ServerWorld.spawnParticle excluding specific player

      By Woodside
      Started 17 hours ago

  • Who's Online (See full list)

    • Arthurmeade12
    • Lyon
    • loordgek
    • s0apy_
    • Woodside
    • megaenderdragon
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.16.4] Removing Mob AI
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community