Jump to content

Recommended Posts

Posted

dear readers, i'm having trouble designing the ai for my custom squid. i've been trying a lot of things recently, but none have worked as i hoped. i am now stuck on this, and i am asking for your support. to put it short: i want my squid to act like normal squid, but swim towards boats, if none in the area players, and if it can't find those it will swim towards other entities. any entity it comes in contact with is dealt damage. my latest attempt led me to copy-paste the original squid ai, but that only lead to more problems. i changed the squid to my custom entity but i changed very little otherwise, and i would like to hear if you have any idea how to fix it, and otherwise another method of achieving my goals. i have put the code in this file, with all of my classes in which my entity is referenced and the original squid ai.

 

 

thanks for bothering to read this, i really thank you.

my problem(custom entity).txt

Posted
11 hours ago, cat ote said:

i have put the code in this file, with all of my classes in which my entity is referenced and the original squid ai.

Please use a service like GitHub, GitHub Gist or Pastebin for sharing code. Also don’t share Mojang’s intellectual property (their copyrighted code) online.

 

Other than that, great question and I’ll come back to answer it once I’m on a device that can open that file.

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)

Posted
4 hours ago, diesieben07 said:

Don't. It's borderline unreadable.

Ouch, yeah.

For anyone else who thinks of downloading it, here it is

i tried copypasting the squid ai to my custom squid, but it gave a lot of bugs. here is my entitylist class:
<ItemList class copied from HarryTalks or similar, static initialisers for EntityTypes>
my MutantSquid class:
<Copy past of minecraft entity squid class (maybe with a couple tweaks?)>
and the vanilla squid class, for convenience:
<Copy past of minecraft entity squid class>
if you were to help me, thank you. i can't figure this one out by myself.

 

37 minutes ago, cat ote said:

Thanks, but you've set it up a couple folders too low. Here's what a properly set up GitHub repository should look like.

While we're at it, here's what a proper registration class looks like and here's what a simple entity looks like.

As you can see, the better way of doing entities is extending a vanilla class and then overriding behaviour.

16 hours ago, cat ote said:

i want my squid to act like normal squid, but swim towards boats, if none in the area players, and if it can't find those it will swim towards other entities. any entity it comes in contact with is dealt damage.

I would do this by extending the squid and adding an AI task that swims towards a "target". I would also override the update method and periodically recalculate that target. I have no experience with AIs, so I'm not sure if that's the tight approach, but that's what I would start off with. If you keep checking my example mod, I'm planning on adding an AI that charges at players to my Wild Boar as soon as I get some spare time.

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)

Posted
2 hours ago, Cadiboo said:

I would do this by extending the squid and adding an AI task that swims towards a "target". I would also override the update method and periodically recalculate that target. I have no experience with AIs, so I'm not sure if that's the tight approach, but that's what I would start off with. If you keep checking my example mod, I'm planning on adding an AI that charges at players to my Wild Boar as soon as I get some spare time.

Pretty much, but one important point: mobs actually have two different goal types (NB: in 1.14+, "entity AI" objects are referred to as "goals") - a main goal, and a target selection goal.  Check out MobEntity, and a subclass method such as ZombieEntity#applyEntityAI(); you'll see separate types of goals for choosing a target, and actually doing stuff in-world.

So in the case of this custom squid, one approach would be a subclass of the vanilla squid with a targeting goal to find nearby boats or players (NearestAttackableTargetGoal won't quite work here since it only works for living entities which excludes boats), and another goal to make the squid move toward its target and attack it when in melee range (should be possible to extend MeleeAttackGoal for that, but no promises...). You'll probably also want to remove the squid's FleeGoal too if this is meant to be a hostile entity.

Posted (edited)
On 2/5/2020 at 2:08 PM, Cadiboo said:

Thanks, but you've set it up a couple folders too low. Here's what a properly set up GitHub repository should look like.

 

here's my new branch. just updated it

https://github.com/kingtorsten/endlessabyss

for some reason the link goes to the master branch so you need to slect the endlessabyss branch, i cant link it

Edited by cat ote
Posted
On 2/5/2020 at 4:40 PM, desht said:

You'll probably also want to remove the squid's FleeGoal too if this is meant to be a hostile entity.

but how should i do that? the fleegoal is located inside the original squid ai, and i cant edit the original squid ai.

Posted
2 hours ago, cat ote said:

but how should i do that? the fleegoal is located inside the original squid ai, and i cant edit the original squid ai.

AIs used to work off a task list and that task list used to be public. If they still work off a task list, you can just edit that list. Anyway, you’re not modifying the original squids AI, you’re modifying your squids AI. Correct me if I’m wrong but you can just instantiate your own subclass of FleeGoal and add it to your task list (after removing the original flee goal if necessary)

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)

Posted
On 2/7/2020 at 6:08 PM, cat ote said:

but how should i do that? the fleegoal is located inside the original squid ai, and i cant edit the original squid ai.

As Cadiboo pointed out, you're not editing the original AI - you're editing the AI in your subclass, which inherits the original AI.

 

SquidEntity.FleeGoal itself has a private constructor, so you'd need to use reflection to access it.  But if you simply want to get rid of it, the cleanest way is probably to override SquidEntity#registerGoals() to simply not add the FleeGoal in the first place. The base registration method also adds a SquidEntity.MoveRandomGoal, which you may or may not want to keep.  If you do, it's conveniently public.

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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • that happens every time I enter a new dimension.
    • This is the last line before the crash: [ebwizardry]: Synchronising spell emitters for PixelTraveler But I have no idea what this means
    • What in particular? I barely used that mod this time around, and it's never been a problem in the past.
    • Im trying to build my mod using shade since i use the luaj library however i keep getting this error Reason: Task ':reobfJar' uses this output of task ':shadowJar' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. So i try adding reobfJar.dependsOn shadowJar  Could not get unknown property 'reobfJar' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. my gradle file plugins { id 'eclipse' id 'idea' id 'maven-publish' id 'net.minecraftforge.gradle' version '[6.0,6.2)' id 'com.github.johnrengelman.shadow' version '7.1.2' id 'org.spongepowered.mixin' version '0.7.+' } apply plugin: 'net.minecraftforge.gradle' apply plugin: 'org.spongepowered.mixin' apply plugin: 'com.github.johnrengelman.shadow' version = mod_version group = mod_group_id base { archivesName = mod_id } // Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. java.toolchain.languageVersion = JavaLanguageVersion.of(17) //jarJar.enable() println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" minecraft { mappings channel: mapping_channel, version: mapping_version copyIdeResources = true runs { configureEach { workingDirectory project.file('run') property 'forge.logging.markers', 'REGISTRIES' property 'forge.logging.console.level', 'debug' arg "-mixin.config=derp.mixin.json" mods { "${mod_id}" { source sourceSets.main } } } client { // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. property 'forge.enabledGameTestNamespaces', mod_id } server { property 'forge.enabledGameTestNamespaces', mod_id args '--nogui' } gameTestServer { property 'forge.enabledGameTestNamespaces', mod_id } data { workingDirectory project.file('run-data') args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') } } } sourceSets.main.resources { srcDir 'src/generated/resources' } repositories { flatDir { dirs './libs' } maven { url = "https://jitpack.io" } } configurations { shade implementation.extendsFrom shade } dependencies { minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" implementation 'org.luaj:luaj-jse-3.0.2' implementation fg.deobf("com.github.Virtuoel:Pehkui:${pehkui_version}") annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' minecraftLibrary 'luaj:luaj-jse:3.0.2' shade 'luaj:luaj-jse:3.0.2' } // Example for how to get properties into the manifest for reading at runtime. tasks.named('jar', Jar).configure { manifest { attributes([ 'Specification-Title' : mod_id, 'Specification-Vendor' : mod_authors, 'Specification-Version' : '1', // We are version 1 of ourselves 'Implementation-Title' : project.name, 'Implementation-Version' : project.jar.archiveVersion, 'Implementation-Vendor' : mod_authors, 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", "TweakOrder" : 0, "MixinConfigs" : "derp.mixin.json" ]) } rename 'mixin.refmap.json', 'derp.mixin-refmap.json' } shadowJar { archiveClassifier = '' configurations = [project.configurations.shade] finalizedBy 'reobfShadowJar' } assemble.dependsOn shadowJar reobf { re shadowJar {} } publishing { publications { mavenJava(MavenPublication) { artifact jar } } repositories { maven { url "file://${project.projectDir}/mcmodsrepo" } } } my entire project:https://github.com/kevin051606/DERP-Mod/tree/Derp-1.0-1.20
  • Topics

×
×
  • Create New...

Important Information

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