Jump to content

dylandmrl

Members
  • Posts

    32
  • Joined

  • Last visited

Posts posted by dylandmrl

  1. Here it is:

    > Configure project :
    As part of making the publishing plugins stable, the 'deferred configurable' behavior of the 'publishing {}' block is now deprecated. Please add 'enableFeaturePreview('STABLE_PUBLISHING')' to your settings file and do a test run by publishing to a local repository. If all artifacts are published as expected, there is nothing else to do. If the published artifacts change unexpectedly, please see the migration guide for more details: https://docs.gradle.org/4.9/userguide/publishing_maven.html#publishing_maven:deferred_configuration. In Gradle 5.0 the flag will be removed and the new behavior will become the default.
    	at build_djo6g6vwo7zjge74uphn4saye.run(D:\Passion\gsbe\build.gradle:14)
    	(Run with --stacktrace to get the full stack trace of this deprecation warning.)
    New Dep: net.minecraftforge:forge:1.15.2-31.0.14_mapped_snapshot_20190719-1.14.3
    
    CONFIGURE SUCCESSFUL in 14s
    Could not resolve: org.junit.jupiter:junit-jupiter:5.6.0
    The getTestClassesDir() method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the getTestClassesDirs() method instead.
    

     

  2. Hello guys,

     

    My gradle can't resolve the junit artifacts inside my build.gradle.

     

    My build.gralde:

     

    buildscript {
        repositories {
            maven { url = 'https://files.minecraftforge.net/maven' }
            jcenter()
            mavenCentral()
        }
        dependencies {
            classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
        }
    }
    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: 'eclipse'
    apply plugin: 'maven-publish'
    
    version = '0.0.1'
    group = 'me.me.gsbe' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
    archivesBaseName = 'gsbe'
    
    sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
    
    minecraft {
        // The mappings can be changed at any time, and must be in the following format.
        // snapshot_YYYYMMDD   Snapshot are built nightly.
        // stable_#            Stables are built at the discretion of the MCP team.
        // 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: 'snapshot', version: '20190719-1.14.3'
        // 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')
    
                // Recommended logging data for a userdev environment
                property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
    
                // Recommended logging level for the console
                property 'forge.logging.console.level', 'debug'
    
                mods {
                    examplemod {
                        source sourceSets.main
                    }
                }
            }
    
            server {
                workingDirectory project.file('run')
    
                // Recommended logging data for a userdev environment
                property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
    
                // Recommended logging level for the console
                property 'forge.logging.console.level', 'debug'
    
                mods {
                    examplemod {
                        source sourceSets.main
                    }
                }
            }
    
            data {
                workingDirectory project.file('run')
    
                // Recommended logging data for a userdev environment
                property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
    
                // Recommended logging level for the console
                property 'forge.logging.console.level', 'debug'
    
                args '--mod', 'gsbe', '--all', '--output', file('src/generated/resources/')
    
                mods {
                    examplemod {
                        source sourceSets.main
                    }
                }
            }
        }
    }
    
    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.15.2-31.0.14'
    
        // 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
        testImplementation 'org.junit.jupiter:junit-jupiter:5.6.0'
    }
    
    test {
        useJUnitPlatform()
    }
    
    // Example for how to get properties into the manifest for reading by the runtime..
    jar {
        manifest {
            attributes([
                "Specification-Title": "examplemod",
                "Specification-Vendor": "examplemodsareus",
                "Specification-Version": "1", // We are version 1 of ourselves
                "Implementation-Title": project.name,
                "Implementation-Version": "${version}",
                "Implementation-Vendor" :"examplemodsareus",
                "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
            ])
        }
    }
    
    // Example configuration to allow publishing using the maven-publish task
    // we define a custom artifact that is sourced from the reobfJar output task
    // and then declare that to be published
    // Note you'll need to add a repository here
    def reobfFile = file("$buildDir/reobfJar/output.jar")
    def reobfArtifact = artifacts.add('default', reobfFile) {
        type 'jar'
        builtBy 'reobfJar'
    }
    publishing {
        publications {
            mavenJava(MavenPublication) {
                artifact reobfArtifact
            }
        }
        repositories {
            maven {
                url "file:///${project.projectDir}/mcmodsrepo"
            }
        }
    }

     

    I tried many stuff such as testCompile, plugins {id "java"], version 4 of junit, taking the artifact directly from Maven but nothing worked..

     

    Thanks in advance.

  3. Hello guys,

     

    For my mod I need to work a lot with GUI and for once nothing wrong is happening. However, I find the code of Minecraft very messy and inconstitent.

     

    I don't have the code in front of my eyes right now but I have figured out many things that are very stranger. As an example, all widget has a renderbutton when a widget isnt always a button. Container has a guiLeft when a widget as a x. The screen has a width variable for the width of the whole screen and not for his own width. KeyPressed in container doesnt focus on the widget focused first. When you resize the screen init is called when we could just move childrens and avoid to re initialise everything. And so on.

     

    I am maybe wrong with several principles. In general, what do you think about GUI. How do you handle them, do you have subclass like MyScreen and MyContainerScreen for consistency ?

     

    Because I am wondering about redo everything from focusable gui even my own container screen and so on..

  4. I don't know for the first one since the capability is in both case very different, one is a buffer the other one if a storage but both implementation are exactly similar.

     

    For your second comment, sorry I didn't use the good vocabulary's word. I am talking about all the tile entity stuff to store data without using capabilities (handleUpdateTag and stuff). However it was simple with this, since the block that use two times the queue was extending by the one using only one queue. I just had to override the writeNBT and readNBT to add the second one and create an new instance inside the second block with another name.

     

    if (te instanceof TileAbstractPipe) {
    	event.addCapability(new ResourceLocation(Datacraft.MOD_ID, "buffer_capability"), new PacketsProvider());
    }
    if (te instanceof TileAnalyser) {
    	event.addCapability(new ResourceLocation(Datacraft.MOD_ID, "packet_capability"), new PacketsProvider());
    }

     

    You see it's something like this where TileAnalyser extends TileAbstractPipe so the analyser should have both capability. Of cours here the provider is the same, it won't work but since the provider depend of an interface I can't create another one. Or maybe my block can have two times this capability but one with the direction "north" and another one with the "sud" hmmm ?

  5. Hello guys, happy new year,

     

    I am facing again another problem with capabilities, first of all I decided to remove every NBT for capabilities, am I right or not ?

     

    If I am right, then I am facing a problem. Indeed, I am trying to add two capabilities that are exactly the same.

     

    Let me explain, I have a storage capabilities that store a queue of number and I want to have two queues inside a same object. I could reimplement my code two times as two different capabilities but I will just reuse the same code again and I don't really like it. Do I have another choice ?

     

    I know that I need two different provider but a provider are directly linked to his interface or the interface should be the same twice so how can I do this well?

     

    For the moment I just think about adding two interface that are extending the parent one but then I have to write two times the same implementation on that implements interface 1 and another one interface 2.

     

    Also I can't immediatly create a capability that contains both queue since another tile depend on only one queue. I am sure I am missing something but what ?

  6. Okay I have tried to figure out how to do without blowing everything (I have certainly made mistakes again):

     

    12 hours ago, diesieben07 said:
    • That field will not be called "listeners" outside the development environment. You need to use ObfuscationReflectionHelper.findField with a SRG name. This will also call setAccessible for you.
    • Do not look up the Field instance every time. Do it once and store it in a static final field (both modifiers are important to allow the JVM to optimize this reflective access).
    public static Field field = ObfuscationReflectionHelper.findField(Container.class, "field_177758_a");

    I have found "field_177758_a" as an equivalent of listeners in the website that you provided.

     

    12 hours ago, diesieben07 said:
    • That is not how you handle exceptions. Ever.
    try {
        List<IContainerListener> listOfListeners = (List<IContainerListener>) DCContainer.field.get(this);
        for(IContainerListener listener: listOfListeners){
            if(listener instanceof ServerPlayerEntity){
                this.sendUpdate(listener);
            }
        }
    } catch (IllegalAccessException e) {
        Debugger.error(e);
    }

    For this one, I am not sure at all.

  7. For people who don't know how to do, I have something like :

     

    Inside your container:

    public void detectAndSendChanges() {
        super.detectAndSendChanges();
    
        if(this.tileEntity.isDifferent()){
            this.tileEntity.setDifferent(false);
            Field f = null;
            try {
                f = Container.class.getDeclaredField("listeners");
                f.setAccessible(true);
                try {
                    List<IContainerListener> listOfListeners = (List<IContainerListener>) f.get(this); //IllegalAccessException
                    for(IContainerListener listener: listOfListeners){
                        if(listener instanceof PlayerEntity){
                            // Send the packet
                        }
                    }
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                }
            } catch (NoSuchFieldException e) {
                e.printStackTrace();
            }
        }
    }

     

    Correct me if I am wrong but normally everything is ok! isDifferent is set as true if the tileentity receive any modification. Basically I have a function that make the tile entity dirty and put this variable to true at the same time.

  8. Ok I've implemented the container but I don't understand how to properly handle the "detectAndSendChanges" function. My tile entity contains a rather complex structure and I only see this function: "listener.sendWindowProperty(this, varToUpdate, newValue);" to communicate a change or, I need to change a whole structure which is not only composed of ints... Also, I can't access the listeners list since the variable is private.

×
×
  • Create New...

Important Information

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