Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.8] [SOLVED] Making mobs ignore the player?


Ferrettomato
 Share

Recommended Posts

You don't want to remove their AI tasks - then they won't attack anyone EVER again.

 

Easy way: cancel LivingAttackEvent when the target is wearing your item. Downside is that mobs may still 'target' the player, i.e. walking towards it and such, but you won't take any damage.

 

Another way: use LivingSetAttackTargetEvent to set the attacker's current target to null (or another nearby selectable target) if the target is wearing your item, but this doesn't (or perhaps didn't) work for all entities (e.g. creepers, iirc, as well as some others) so you'd have to account for that by using some fancier magic such as ASM.

 

Best way is a combination of the above 2 - the 2nd to prevent most mobs from even trying to target the player, and the 1st to stop them from doing any damage if they still end up targeting despite your other efforts.

 

Probably more ways as well, but that's all I can think of at the moment.

Link to comment
Share on other sites

I've already tried setting its target to null in the event, but the field is final, and the entity's saved target is private. I already have the item canceling damage, but that's not the point.

How did you set the target to null? I've done it using ((EntityLiving) event.entity).setAttackTarget(null); and that works for most mobs. 1.8 is better than 1.7.10 for this since now most mobs are using the AI system, whereas before spiders and many others were not, meaning they wouldn't be affected at all.

 

Anyway, the above should work (mostly) - the mobs won't even walk towards you. If it's not working for you, show your code.

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.

Guest
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.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Every time when i close my inventory in search mode the game crashes. i have many mods installed, but it has nothing to do with the mods.   here is the crash report: pastebin
    • I have a problem and that when I open forge it stays loading in the model manager and there it stays until I close the game then the game appears to have ended incorrectly Exit code 1
    • forge-1.16.4-35.1.4-installer.jar will not install. My 11 y/o son has been working on a world for months and all the mods need this specific version. Is there a way to get the missing files and install them manually? Please review this log file and reply with links if possible:   JVM info: Oracle Corporation - 12.0.2 - 12.0.2+10 java.net.preferIPv4Stack=true Found java version 12.0.2 Extracting json Considering minecraft client jar Downloading libraries Considering library net.minecraftforge:forge:1.16.4-35.1.4   File exists: Checksum validated. Considering library org.ow2.asm:asm:7.2   File exists: Checksum validated. Considering library org.ow2.asm:asm-commons:7.2   File exists: Checksum validated. Considering library org.ow2.asm:asm-tree:7.2   File exists: Checksum validated. Considering library org.ow2.asm:asm-util:7.2   File exists: Checksum validated. Considering library org.ow2.asm:asm-analysis:7.2   File exists: Checksum validated. Considering library cpw.mods:modlauncher:8.0.6   File exists: Checksum validated. Considering library cpw.mods:grossjava9hacks:1.3.0   File exists: Checksum validated. Considering library net.minecraftforge:accesstransformers:2.2.0-shadowed   Downloading library from https://maven.creeperhost.net/net/minecraftforge/accesstransformers/2.2.0-shadowed/accesstransformers-2.2.0-shadowed.jar java.io.FileNotFoundException: https://maven.creeperhost.net/net/minecraftforge/accesstransformers/2.2.0-shadowed/accesstransformers-2.2.0-shadowed.jar     at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)     at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)     at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)     at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)     at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)     at java.base/sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1969)     at java.base/sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1964)     at java.base/java.security.AccessController.doPrivileged(AccessController.java:552)     at java.base/sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1963)     at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1531)     at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1515)     at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:251)     at net.minecraftforge.installer.DownloadUtils.download(DownloadUtils.java:146)     at net.minecraftforge.installer.DownloadUtils.download(DownloadUtils.java:134)     at net.minecraftforge.installer.DownloadUtils.downloadLibrary(DownloadUtils.java:123)     at net.minecraftforge.installer.actions.Action.downloadLibraries(Action.java:79)     at net.minecraftforge.installer.actions.ClientInstall.run(ClientInstall.java:108)     at net.minecraftforge.installer.InstallerPanel.run(InstallerPanel.java:428)     at net.minecraftforge.installer.SimpleInstaller.launchGui(SimpleInstaller.java:170)     at net.minecraftforge.installer.SimpleInstaller.main(SimpleInstaller.java:143) Caused by: java.io.FileNotFoundException: https://maven.creeperhost.net/net/minecraftforge/accesstransformers/2.2.0-shadowed/accesstransformers-2.2.0-shadowed.jar     at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1915)     at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1515)     at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:527)     at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:335)     at net.minecraftforge.installer.DownloadUtils.getConnection(DownloadUtils.java:203)     at net.minecraftforge.installer.DownloadUtils.download(DownloadUtils.java:144)     ... 7 more Considering library net.minecraftforge:eventbus:3.0.5-service   Downloading library from https://maven.creeperhost.net/net/minecraftforge/eventbus/3.0.5-service/eventbus-3.0.5-service.jar java.io.FileNotFoundException: https://maven.creeperhost.net/net/minecraftforge/eventbus/3.0.5-service/eventbus-3.0.5-service.jar     at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)     at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)     at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)     at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)     at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)     at java.base/sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1969)     at java.base/sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1964)     at java.base/java.security.AccessController.doPrivileged(AccessController.java:552)     at java.base/sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1963)     at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1531)     at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1515)     at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:251)     at net.minecraftforge.installer.DownloadUtils.download(DownloadUtils.java:146)     at net.minecraftforge.installer.DownloadUtils.download(DownloadUtils.java:134)     at net.minecraftforge.installer.DownloadUtils.downloadLibrary(DownloadUtils.java:123)     at net.minecraftforge.installer.actions.Action.downloadLibraries(Action.java:79)     at net.minecraftforge.installer.actions.ClientInstall.run(ClientInstall.java:108)     at net.minecraftforge.installer.InstallerPanel.run(InstallerPanel.java:428)     at net.minecraftforge.installer.SimpleInstaller.launchGui(SimpleInstaller.java:170)     at net.minecraftforge.installer.SimpleInstaller.main(SimpleInstaller.java:143) Caused by: java.io.FileNotFoundException: https://maven.creeperhost.net/net/minecraftforge/eventbus/3.0.5-service/eventbus-3.0.5-service.jar     at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1915)     at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1515)     at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:527)     at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:335)     at net.minecraftforge.installer.DownloadUtils.getConnection(DownloadUtils.java:203)     at net.minecraftforge.installer.DownloadUtils.download(DownloadUtils.java:144)     ... 7 more Considering library net.minecraftforge:forgespi:3.2.0   File exists: Checksum validated. Considering library net.minecraftforge:coremods:3.0.0   File exists: Checksum validated. Considering library net.minecraftforge:unsafe:0.2.0   File exists: Checksum validated. Considering library com.electronwill.night-config:core:3.6.2   File exists: Checksum validated. Considering library com.electronwill.night-config:toml:3.6.2   File exists: Checksum validated. Considering library org.jline:jline:3.12.1   File exists: Checksum validated. Considering library org.apache.maven:maven-artifact:3.6.0   File exists: Checksum validated. Considering library net.jodah:typetools:0.8.1   File exists: Checksum validated. Considering library org.apache.logging.log4j:log4j-api:2.11.2   File exists: Checksum validated. Considering library org.apache.logging.log4j:log4j-core:2.11.2   File exists: Checksum validated. Considering library net.minecrell:terminalconsoleappender:1.2.0   File exists: Checksum validated. Considering library net.sf.jopt-simple:jopt-simple:5.0.4   File exists: Checksum validated. Considering library org.spongepowered:mixin:0.8.2   File exists: Checksum validated. Considering library com.github.jponge:lzma-java:1.3   File exists: Checksum validated. Considering library com.google.code.findbugs:jsr305:3.0.2   File exists: Checksum validated. Considering library com.google.code.gson:gson:2.8.0   File exists: Checksum validated. Considering library com.google.errorprone:error_prone_annotations:2.1.3   File exists: Checksum validated. Considering library com.google.guava:guava:20.0   File exists: Checksum validated. Considering library com.google.guava:guava:25.1-jre   File exists: Checksum validated. Considering library com.google.j2objc:j2objc-annotations:1.1   File exists: Checksum validated. Considering library com.nothome:javaxdelta:2.0.1   File exists: Checksum validated. Considering library commons-io:commons-io:2.4   File exists: Checksum validated. Considering library de.oceanlabs.mcp:mcp_config:1.16.4-20201102.104115@zip   File exists: Checksum validated. Considering library de.siegmar:fastcsv:1.0.2   File exists: Checksum validated. Considering library net.md-5:SpecialSource:1.8.5   File exists: Checksum validated. Considering library net.minecraftforge:binarypatcher:1.0.12   File exists: Checksum validated. Considering library net.minecraftforge:forge:1.16.4-35.1.4:universal   File exists: Checksum validated. Considering library net.minecraftforge:installertools:1.1.11   File exists: Checksum validated. Considering library net.minecraftforge:jarsplitter:1.1.2   File exists: Checksum validated. Considering library net.sf.jopt-simple:jopt-simple:4.9   File exists: Checksum validated. Considering library net.sf.jopt-simple:jopt-simple:5.0.4   File exists: Checksum validated. Considering library net.sf.opencsv:opencsv:2.3   File exists: Checksum validated. Considering library org.checkerframework:checker-qual:2.0.0   File exists: Checksum validated. Considering library org.codehaus.mojo:animal-sniffer-annotations:1.14   File exists: Checksum validated. Considering library org.ow2.asm:asm-analysis:6.1.1   File exists: Checksum validated. Considering library org.ow2.asm:asm-commons:6.1.1   File exists: Checksum validated. Considering library org.ow2.asm:asm-tree:6.1.1   File exists: Checksum validated. Considering library org.ow2.asm:asm:6.1.1   File exists: Checksum validated. Considering library trove:trove:1.0.2   File exists: Checksum validated. These libraries failed to download. Try again. net.minecraftforge:accesstransformers:2.2.0-shadowed net.minecraftforge:eventbus:3.0.5-service
    • Sad, so there isnt any working 1.8 ones not 1.8.9
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.