Jump to content

Getting a block (if any) between mob and player


Mad Alchemist

Recommended Posts

I am trying to make zombies able to break wall if there is a yummy player behind it. As far as I understood, I have to use RayTraceResult, but zombies have only

public RayTraceResult pick(double p_213324_1_, float p_213324_3_, boolean p_213324_4_)

What this methot does, and, what are these arguments with as meaningless names as usually?

P.S. I am using 1.16.5

Link to comment
Share on other sites

23 hours ago, diesieben07 said:

I would recommend you use Parchment mappings too get parameter names. Check the documentation.

Tried to set up all stuff from parchment docs. Got following error:
 

Could not resolve all files for configuration ':runtimeClasspathCopy'.
> Could not find net.minecraftforge:forge:1.16.5-36.1.0_mapped_parchment_1.16.5_at_8047e1fb20118f11ea75ef67e07a7d525623ed3c.
  Searched in the following locations:
    - file:/C:/Users/Mad Alchemist/.gradle/caches/forge_gradle/bundeled_repo/net/minecraftforge/forge/1.16.5-36.1.0_mapped_parchment_1.16.5_at_8047e1fb20118f11ea75ef67e07a7d525623ed3c/forge-1.16.5-36.1.0_mapped_parchment_1.16.5_at_8047e1fb20118f11ea75ef67e07a7d525623ed3c.pom
    - file:/C:/Users/Mad Alchemist/.gradle/caches/forge_gradle/bundeled_repo/net/minecraftforge/forge/1.16.5-36.1.0_mapped_parchment_1.16.5_at_8047e1fb20118f11ea75ef67e07a7d525623ed3c/forge-1.16.5-36.1.0_mapped_parchment_1.16.5_at_8047e1fb20118f11ea75ef67e07a7d525623ed3c.jar
  Required by:
      project :

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

Here is my build.gradle now:

Spoiler
buildscript {
    repositories {
        maven { url = 'https://files.minecraftforge.net/maven' }
        maven { url = 'https://repo.spongepowered.org/repository/maven-public/' }
        maven { url = 'https://maven.parchmentmc.org' }
        mavenCentral()
    }
    dependencies {
        classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
        classpath 'org.parchmentmc:librarian:1.+'
        classpath group: 'org.spongepowered', name: 'mixingradle', version: '0.7-SNAPSHOT'
    }
}


apply plugin: 'net.minecraftforge.gradle'
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'org.parchmentmc.librarian.forgegradle'
apply plugin: 'org.spongepowered.mixin'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'

dependencies {
    annotationProcessor 'org.spongepowered:mixin:0.8:processor'
}


version = '1.16.5-1.0.8.2'
group = 'com.madalchemist.zombienation' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'zombienation'

mixin {
    add sourceSets.main, "mixins.zombienation.refmap.json"
}


java.toolchain.languageVersion = JavaLanguageVersion.of(8) // Mojang ships Java 8 to end users, so your mod should target Java 8.

println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
minecraft {
    // The mappings can be changed at any time, and must be in the following format.
    // Channel:   Version:
    // snapshot   YYYYMMDD   Snapshot are built nightly.
    // stable     #          Stables are built at the discretion of the MCP team.
    // official   MCVersion  Official field/method names from Mojang mapping files
    //
    // You must be aware of the Mojang license when using the 'official' mappings.
    // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
    //
    // Use non-default mappings at your own risk. they may not always work.
    // Simply re-run your setup task after changing the mappings to update your workspace.
    mappings channel: 'parchment', version: '1.16.5'
    // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
    
    accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')

    // Default run configurations.
    // These can be tweaked, removed, or duplicated as needed.
    runs {

        client {
            workingDirectory project.file('run')
            args '--tweakClass', 'org.spongepowered.asm.launch.MixinTweaker', '--mixin', 'mixins.zombienation.json'

            // Recommended logging data for a userdev environment
            // The markers can be changed as needed. 
            // "SCAN": For mods scan.
            // "REGISTRIES": For firing of registry events.
            // "REGISTRYDUMP": For getting the contents of all registries.
            property 'forge.logging.markers', 'REGISTRIES'

            // Recommended logging level for the console
            // You can set various levels here.
            // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
            property 'forge.logging.console.level', 'debug'

            mods {
                examplemod {
                    source sourceSets.main
                }
            }
        }

        server {
            workingDirectory project.file('run')
            //args '--tweakClass', 'org.spongepowered.asm.launch.MixinTweaker', '--mixin', 'mixins.zombienation.json'
            args '--mixin', 'mixins.zombienation.json'

            // Recommended logging data for a userdev environment
            // The markers can be changed as needed. 
            // "SCAN": For mods scan.
            // "REGISTRIES": For firing of registry events.
            // "REGISTRYDUMP": For getting the contents of all registries.
            property 'forge.logging.markers', 'REGISTRIES'

            // Recommended logging level for the console
            // You can set various levels here.
            // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
            property 'forge.logging.console.level', 'debug'

            mods {
                examplemod {
                    source sourceSets.main
                }
            }
        }

        data {
            workingDirectory project.file('run')

            // Recommended logging data for a userdev environment
            // The markers can be changed as needed. 
            // "SCAN": For mods scan.
            // "REGISTRIES": For firing of registry events.
            // "REGISTRYDUMP": For getting the contents of all registries.
            property 'forge.logging.markers', 'REGISTRIES'

            // Recommended logging level for the console
            // You can set various levels here.
            // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
            property 'forge.logging.console.level', 'debug'

            // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
            args '-Xmx 2G', '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')

            mods {
                examplemod {
                    source sourceSets.main
                }
            }
        }
    }
}

// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }

dependencies {
    // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
    // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
    // The userdev artifact is a special name and will get all sorts of transformations applied to it.
    minecraft 'net.minecraftforge:forge:1.16.5-36.1.0'


    // You may put jars on which you depend on in ./libs or you may define them like so..
    // compile "some.group:artifact:version:classifier"
    // compile "some.group:artifact:version"

    // Real examples
    // compile 'com.mod-buildcraft:buildcraft:6.0.8:dev'  // adds buildcraft to the dev env
    // compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env

    // The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
    // provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'

    // These dependencies get remapped to your current MCP mappings
    // deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev'

    // For more info...
    // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
    // http://www.gradle.org/docs/current/userguide/dependency_management.html



}

// Example for how to get properties into the manifest for reading by the runtime..
jar {
    manifest {
        attributes([
            "Specification-Title": "madalchemist",
            "Specification-Vendor": "madalchemist",
            "Specification-Version": "1", // We are version 1 of ourselves
            "Implementation-Title": project.name,
            "Implementation-Version": project.version,
            "Implementation-Vendor" : "madalchemist",
            "TweakClass": "org.spongepowered.asm.launch.MixinTweaker",
            "MixinConfigs": "mixins.zombienation.json",
            "FMLCorePluginContainsFMLMod": "true",
            "ForceLoadAsMod": "true",
            "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
        ])
    }
}

// Example configuration to allow publishing using the maven-publish task
// This is the preferred method to reobfuscate your jar file
jar.finalizedBy('reobfJar') 
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
//publish.dependsOn('reobfJar')

publishing {
    publications {
        mavenJava(MavenPublication) {
            artifact jar
        }
    }
    repositories {
        maven {
            url "file:///${project.projectDir}/mcmodsrepo"
        }
    }
}

 

And here how it was before: Last version that worked

I am not familiar enough with gradle internals and where it downloads all dependencies from and where it stores all cached stuff.

Link to comment
Share on other sites

On 5/8/2022 at 11:40 AM, diesieben07 said:

Then you have not applied Parchment correctly.

Closed project, restartedd IDE, loaded project again... Yes! Those meaningless P_666_666_666 gone away.

But still, is this method (public RayTraceResult pick(double pHitDistance, float pPartialTicks, boolean pHitFluids) suitable for my needs? As far as I understand, pHitDistance is how long is the ray traced, pHidFluids is whether fluid blocks cause collision,  but what are pPartialTicks?
 

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.

Announcements



×
×
  • Create New...

Important Information

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