Jump to content

Vinyarion

Members
  • Posts

    55
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by Vinyarion

  1. Well, that was anticlimactic.
    New build.gradle:
     

    buildscript {
        repositories {
            maven { url = 'https://maven.minecraftforge.net' }
    //        maven { url = 'https://files.minecraftforge.net/maven' }
            mavenCentral()
        }
        dependencies {
            classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '4.1.+', 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.
    .
    .
    .
    rest of file as normal

    So much for not editing above the line.

    BUILD SUCCESSFUL in 14s

     

  2. Recently updated my IntelliJ IDEA, and the project imported just fine.
    Then out of the blue, the gradle refresh fails:

    Spoiler

     

    
    
    
    
    > Configure project :
    Java: 1.8.0_144 JVM: 25.144-b01(Oracle Corporation) Arch: amd64
    WARNING: This project is configured to use the official obfuscation mappings provided by Mojang. These mapping fall under their associated license, you should be fully aware of this license. For the latest license text, refer below, or the reference copy here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md, You can hide this warning by running the `hideOfficialWarningUntilChanged` task
    WARNING: (c) 2020 Microsoft Corporation. These mappings are provided "as-is" and you bear the risk of using them. You may copy and use the mappings for development purposes, but you may not redistribute the mappings complete and unmodified. Microsoft makes no warranties, express or implied, with respect to the mappings provided here.  Use and modification of this document or the source code (in any form) of Minecraft: Java Edition is governed by the Minecraft End User License Agreement available at https://account.mojang.com/documents/minecraft_eula.
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Could not find mappings_official-1.16.5.zip (net.minecraft:mappings_official:1.16.5).
    Searched in the following locations:
        https://files.minecraftforge.net/maven/net/minecraft/mappings_official/1.16.5/mappings_official-1.16.5.zip
    
    * Try:
    Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Exception is:
    com.intellij.openapi.externalSystem.model.ExternalSystemException: Could not find mappings_official-1.16.5.zip (net.minecraft:mappings_official:1.16.5).
    Searched in the following locations:
        https://files.minecraftforge.net/maven/net/minecraft/mappings_official/1.16.5/mappings_official-1.16.5.zip
    	at org.jetbrains.plugins.gradle.model.ProjectImportAction.addBuildModels(ProjectImportAction.java:346)
    		[Massive stack trace]
    	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
    org.gradle.internal.resolve.ArtifactNotFoundException: Could not find mappings_official-1.16.5.zip (net.minecraft:mappings_official:1.16.5).
    Searched in the following locations:
        https://files.minecraftforge.net/maven/net/minecraft/mappings_official/1.16.5/mappings_official-1.16.5.zip
    	at org.gradle.internal.resolve.result.DefaultBuildableArtifactResolveResult.notFound(DefaultBuildableArtifactResolveResult.java:28)
    		[Massive stack trace]
    	at java.lang.Thread.run(Thread.java:748)
    
    
    
    * Get more help at https://help.gradle.org
    
    BUILD FAILED in 3s
    
    Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
    Use '--warning-mode all' to show the individual deprecation warnings.
    See https://docs.gradle.org/6.8.1/userguide/command_line_interface.html#sec:command_line_warnings
    

     

    This was unexpected, as literally no problems were happening before this.
    build.gradle:

    Spoiler

     

    
    
    
    
    
    buildscript {
        repositories {
            maven { url = 'https://files.minecraftforge.net/maven' }
            mavenCentral()
        }
        dependencies {
            classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '4.1.+', 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 = '1.0'
    group = 'net.sybyline.qiteru' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
    archivesBaseName = 'qiteru'
    
    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: 'official', 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')
    
                // 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')
    
                // 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 '--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": "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
    // 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"
            }
        }
    }

     

    Upon clicking the url of the location searched, I get this: [Screenshot]

    Spoiler

    image.thumb.png.938ecda0b4b433aeffdca7fd8aaceee0.png

    I have tried manually specifying different gradle versions, Java versions for gradle, and reimported the project several times (deleting the idea project entirely) with the exact same result.
     

    Edit:
    Probably has something to do with the migration of files.minecraftforge.net/maven to maven.minecraftforge.net

  3. You need to register the dimension during the event, like this:

    @SubscribeEvent
    public static void dimReg(RegisterDimensionsEvent event) {
      while (sky() == null);
    }
    public static DimensionType sky() {
      ModDimension sky = SKY_DIM.get();
      return DimensionManager.registerOrGetDimension(sky.getRegistryName(), sky, null, true);
    }

     

  4. image.thumb.png.bf9959a729c03d85bf2030a8181e7089.png

    This is the thing Draco said you should look at, it says exactly what folder the relevant file is in.
    If it doesn't exist, that might mean you need to create it.
     

    On 10/11/2020 at 1:06 PM, ChampionAsh5357 said:

    1.15.2 has an optional license information. 1.16.3 requires that the license information be present in the toml. You can simply add license="<your license here>" into your mods.toml near the top and that should fix it. You can view some licenses here.

    Add license="<your license here>" to that file.

  5. You should probably make a capability that attaches to furnaces, then check if your item is in the output slot of the furnace. The capability stores the previous size of the output stack so you don't generate your effects every tick, only when the stack size of your item increases. To run things every tick, you'll want to subscribe to a `WorldTickEvent` and iterate through the `World.tickableTileEntities`.

  6. If you want to look at type heirarchy or annotation data, Forge has already searched the classpath for annotations and types for mod loading and event bus subscription. Here's what it would look like to use it for something:
     

    public static Set<Class<? extends ParentClass>> init() {
      return ModList.get()
        .getAllScanData()
        .stream()
        .map(ModFileScanData::getClasses)
        .flatMap(Collection::stream)
        .filter(data -> "your.ParentClass".equals(data.parent.getClassName()))
        .map(Type::getClassName)
        .map(Class::forName)
        .map(ParentClass.class::asSubclass)
        .collect(Collectors.toSet());
    }

    This is very simplistic, because the `parent` field is private, so you would have to use reflection, and `Class.forName(String)` throws some things, so it can't be used in a method reference like that, but otherwise, this kind of thing has worked for me before.

  7. Take a look at how `EntityRenderer.renderName(Entity,String,MatrixStack,IRenderTypeBuffer,int)void` does it, and copy something like it.
    You could also use something like this that I wrote for 1.15, it should be pretty similar in 1.16:

    public static void renderName(Quaternion cameraOrientation, FontRenderer fontrenderer, String displayNameIn, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn, double x, double y, double z) {
    		matrixStackIn.push();
    		matrixStackIn.translate(x, y, z);
    		matrixStackIn.rotate(cameraOrientation);
    		matrixStackIn.scale(-0.025F, -0.025F, 0.025F);
    		Matrix4f matrix4f = matrixStackIn.getLast().getMatrix();
    		float f1 = Minecraft.getInstance().gameSettings.getTextBackgroundOpacity(0.25F);
    		int j = (int) (f1 * 255.0F) << 24;
    		float f2 = (float) (-fontrenderer.getStringWidth(displayNameIn) / 2);
    		fontrenderer.renderString(displayNameIn, f2, 0, 553648127, false, matrix4f, bufferIn, false, j, packedLightIn);
    		fontrenderer.renderString(displayNameIn, f2, 0, -1, false, matrix4f, bufferIn, false, 0, packedLightIn);
    		matrixStackIn.pop();
    	}

     

  8. Yes, you need to subscribe to `GuiScreenEvent.InitGuiEvent.Pr

    e event)` in order to add widgets, the event itself has a method `addWidget`.
    Here's an example of how it could be used:

    @SubscribeEvent
    public void addCustomButtonToInventory(GuiScreenEvent.InitGuiEvent.Pre event)
    {
      if (event.getGui() instanceof InventoryScreen)
      {
        event.addWidget(new Button(x, y, width, height, text, button -> {
          Minecraft.getInstance().displayGuiScreen(new CustomGUI());
        }));
      }
    }

    If you aren't familiar with the `button -> {...}` syntax, this Button constructor takes an Button.IPressable as a parameter, which is the behavior that happens when you click. Equivalent code would look like this:

    @SubscribeEvent
    public void addCustomButtonToInventory(GuiScreenEvent.InitGuiEvent.Pre event)
    {
      if (event.getGui() instanceof InventoryScreen)
      {
        event.addWidget(new Button(x, y, width, height, text, new CustomAction()));
      }
    }
    
    class CustomAction implements IPressable {
      public void onPress(Button button) {
        Minecraft.getInstance().displayGuiScreen(new CustomGUI());
      }
    }

    Hope this helps!

    • Like 1
    • Thanks 1
×
×
  • Create New...

Important Information

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