Jump to content

CraftedCart

Members
  • Posts

    22
  • Joined

  • Last visited

Posts posted by CraftedCart

  1. I have a mod set up and it works fine when running

    :runClient

    with Gradle. The issue I have though, is that when running

    :build

    , the build terminates at

    :extractRangemapReplacedMain

    . This only seems to happen for one of my mods though. That depends on another mod which builds just fine.

     

    I've tried running

    gradle clean

    , deleting ~/.gradle, as well as deleting my mod's

    .gradle

    and

    build

    folders. Doing neither helped.

     

    Forge Vesion:

    1.9.4-12.17.0.1990

     

    gradle build

    output:

     

    #################################################
             ForgeGradle 2.2-SNAPSHOT-0447b4e        
      https://github.com/MinecraftForge/ForgeGradle  
    #################################################
                   Powered by MCP unknown               
                 http://modcoderpack.com             
             by: Searge, ProfMobius, Fesh0r,         
             R4wk, ZeuX, IngisKahn, bspkrs           
    #################################################
    Found AccessTransformer: cargo_at.cfg
    :deobfCompileDummyTask
    :deobfProvidedDummyTask
    :sourceApiJava
    :FluidUI:compileJava
    Note: /Users/Mike/Developer/IdeaProjects/FluidUI/src/main/java/io/github/craftedcart/fluidui/FontCache.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    :FluidUI:processResources UP-TO-DATE
    :FluidUI:classes
    :FluidUI:jar
    :FluidUIMinecraftAdditions:deobfCompileDummyTask
    :FluidUIMinecraftAdditions:deobfProvidedDummyTask
    :FluidUIMinecraftAdditions:sourceApiJava
    :FluidUIMinecraftAdditions:compileApiJava UP-TO-DATE
    :FluidUIMinecraftAdditions:processApiResources UP-TO-DATE
    :FluidUIMinecraftAdditions:apiClasses UP-TO-DATE
    :FluidUIMinecraftAdditions:sourceMainJava
    :FluidUIMinecraftAdditions:compileJava
    :FluidUIMinecraftAdditions:processResources
    :FluidUIMinecraftAdditions:classes
    :FluidUIMinecraftAdditions:jar
    :compileApiJava UP-TO-DATE
    :processApiResources UP-TO-DATE
    :apiClasses UP-TO-DATE
    :sourceMainJava
    :compileJava
    Note: /Users/Mike/Developer/Minecraft Mod Projects/Cargo/build/sources/main/java/io/github/craftedcart/cargo/util/StringManager.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    :processResources
    :classes
    :jar
    :sourceTestJava
    :compileTestJava UP-TO-DATE
    :processTestResources UP-TO-DATE
    :testClasses UP-TO-DATE
    :test UP-TO-DATE
    :extractMcpData SKIPPED
    :extractMcpMappings SKIPPED
    :getVersionJson
    :extractUserdev UP-TO-DATE
    :genSrgs SKIPPED
    :reobfJar
    :extractRangemapReplacedMain
    /Users/Mike/Developer/Minecraft Mod Projects/Cargo/build/sources/main/java
    > Building 55% > :extractRangemapReplacedMain%
    

     

     

    build.gradle

    :

     

    
    // For those who want the bleeding edge
    buildscript {
        repositories {
            jcenter()
            maven {
                name = "forge"
                url = "http://files.minecraftforge.net/maven"
            }
        }
        dependencies {
            classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
        }
    }
    apply plugin: 'net.minecraftforge.gradle.forge'
    
    /*
    // for people who want stable - not yet functional for MC 1.8.8 - we require the forgegradle 2.1 snapshot
    plugins {
        id "net.minecraftforge.gradle.forge" version "2.0.2"
    }
    */
    version = "1.0"
    group= "io.github.craftedcart.cargo" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
    archivesBaseName = "Cargo"
    
    //Java 1.8 required
    sourceCompatibility = 1.8
    targetCompatibility = 1.8
    
    minecraft {
        version = "1.9.4-12.17.0.1990"
        runDir = "run"
        
        // 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 allways work.
        // simply re-run your setup task after changing the mappings to update your workspace.
        mappings = "snapshot_20160518"
        // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
    }
    
    dependencies {
        // 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'
    
        // the deobf configurations:  'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided,
        // except that these dependencies get remapped to your current MCP mappings
        //deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev'
        //deobfProvided '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
    
        compile project(':FluidUI')
        compile project(':FluidUIMinecraftAdditions')
    
    }
    
    jar {
        manifest {
            attributes 'FMLAT': 'cargo_at.cfg'
        }
    }
    
    processResources
    {
        // this will ensure that this task is redone when the versions change.
        inputs.property "version", project.version
        inputs.property "mcversion", project.minecraft.version
    
        // replace stuff in mcmod.info, nothing else
        from(sourceSets.main.resources.srcDirs) {
            include 'mcmod.info'
                    
            // replace version and mcversion
            expand 'version':project.version, 'mcversion':project.minecraft.version
        }
            
        // copy everything else, thats not the mcmod.info
        from(sourceSets.main.resources.srcDirs) {
            exclude 'mcmod.info'
        }
    }
    
    

     

     

    settings.gradle

    :

     

    include ':FluidUI'
    project(':FluidUI').projectDir = new File(settingsDir, '../../IdeaProjects/FluidUI')
    
    include ':FluidUIMinecraftAdditions'
    project(':FluidUIMinecraftAdditions').projectDir = new File(settingsDir, '../FluidUIMinecraftAdditions')
    

     

  2. Hi there.

    I would like to draw on top of inventory screens, however I have one issue. Items in inventories draw above my overlay.

     

    rupoQwU.png

     

    Here, I'm darkening the screen (Eventually, I plan to draw useful stuff on top of the inventory GUI, rather than just darkening the screen, so please don't tell me to not bother darkening it). Notice how the chest draws on top of my overlay.

     

    I hook into

    RenderTickEvent

    to draw on top of inventories

     

        @SubscribeEvent
        public void tickEvent(TickEvent.RenderTickEvent e) {
            if (e.phase == TickEvent.Phase.END) {
                UIUtils.calcStuff();
                drawOverlay();
            }
        }
    
        public void drawOverlay() {
            Minecraft mc = Minecraft.getMinecraft();
    
            if (mc.currentScreen instanceof GuiContainer) { //A container GUI is open
                drawContainerOverlay(mc, (GuiContainer) mc.currentScreen); //This draws the overlay
            }
        }
    

  3. I'd need to see the whole class so I can see the ordering of your calls but you've forgotten to pop part of the stack and have fucked the GLState, plain and simple here (done this countless times myself ;])

     

    IE you call

            GlStateManager.disableTexture2D();
    

    I've got no clues if you've reenabled the textures or not

     

    I do re-enable Texture2D

                GuiUtils.setup(false);
                rootComponent.onUpdate();
    
                GL11.glColor4d(1, 1, 1, 1);
                GlStateManager.enableTexture2D(); // <<<< This line here!
                GL11.glEnable(GL11.GL_BLEND);
                GL11.glMatrixMode(GL11.GL_PROJECTION);
    
                int guiScale = new ScaledResolution(Minecraft.getMinecraft(), Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight).getScaleFactor();
                GL11.glScaled(guiScale, guiScale, guiScale);
    

     

    As for seeing the whole class... (There's several)

    Well... I made a custom GUI system. I'll show you the main parts.

    All of the drawing is done with the GuiUtils class

    The other main classes are UIRootComponent, UIComponent and GuiGameOverlay

     

    Here are the 4 files (You asked for the whole thing. It's rather large!):

    https://gist.github.com/CraftedCart/e53f6465e60fff6ed45d

  4. Hi there!

    I have an overlay (Hooked into RenderGameOverlayEvent) and have tried drawing a simple semi-transparent white rectangle

    Unfortunatly, the rectangle is opaque (not 50% transparent), and items become invisble in my hotbar, and when I open my inventory screen

    Showing NEI crashes with a message to do with drawing items.

     

    Here's the NEI crash stack in case if it helps

            at net.minecraft.item.ItemStack.getMetadata(ItemStack.java:280)
    at net.minecraft.client.renderer.ItemModelMesher.getMetadata(ItemModelMesher.java:70)
    at net.minecraft.client.renderer.ItemModelMesher.getItemModel(ItemModelMesher.java:43)
    at net.minecraft.client.renderer.entity.RenderItem.renderItemIntoGUI(RenderItem.java:360)
    at codechicken.nei.guihook.GuiContainerManager.drawItem(GuiContainerManager.java:210)
    at codechicken.nei.guihook.GuiContainerManager.drawItem(GuiContainerManager.java:178)
    at codechicken.nei.ItemPanel.draw(ItemPanel.java:129)
    at codechicken.nei.LayoutManager.renderObjects(LayoutManager.java:197)
    at codechicken.nei.guihook.GuiContainerManager.renderObjects(GuiContainerManager.java:389)
    at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:135)
    at net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:470)
    

     

    Transparency works on the shadow at the bottom of the white rectangle, and it also works if I clear the screen before drawing anything.

     

    nVAsIdr.jpg

     

    Here's the code for the overlay

                GuiUtils.setup(false);
                rootComponent.onUpdate();
    
                GL11.glColor4d(1, 1, 1, 1);
                GlStateManager.enableTexture2D();
                GL11.glEnable(GL11.GL_BLEND);
                GL11.glMatrixMode(GL11.GL_PROJECTION);
    
                int guiScale = new ScaledResolution(Minecraft.getMinecraft(), Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight).getScaleFactor();
                GL11.glScaled(guiScale, guiScale, guiScale);
    

     

    rootComponent.onUpdate()

    draws the UI

     

    Here's

    GuiUtils.setup()

        public static void setup(boolean clearBuffer) {
            GL11.glMatrixMode(GL11.GL_PROJECTION);
            GL11.glLoadIdentity();
            GL11.glOrtho(0, Display.getWidth(), Display.getHeight(), 0, 10000, -10000);
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
    
            if (clearBuffer) {
                GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
            }
    
            GL11.glShadeModel(GL11.GL_SMOOTH);
            GL11.glEnable(GL11.GL_LINE_SMOOTH);
    
            GlStateManager.enableBlend();
            GlStateManager.disableTexture2D();
            GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
            GlStateManager.color(1, 1, 1, 1);
            TextureImpl.bindNone();
        }
    

  5. If you want to run code in actual Minecraft, not in dev, you need to reobfuscate your code. ForgeGradle does this automatically for you when you run

    gradle build

    .

     

    Ah, I probably should have said that I packaged the code into a .jar (IntelliJ's Build > Build Artifact) when it was running in the dev environment, and that the dev environment read from that jar, rather than reading from the soruce.

  6. TL;DR

    A plugin system which adds Jars to the classloader can call several Minecraft methods when running from within IntelliJ Idea, however it errors when running it in standard Forge (when the mod jar is dropped in the mods folder)

     

    Hi there!

    I'm trying to develop a plugin system for my mod, however I'm very confused as to why it works when I run / debug it from IntelliJ Idea, but it doesn't work when I put the mod jar in my mods folder, and the plugin in the mods/CraftedCart/MFFClientPlugins folder.

     

    The plugin loads, however it errors whenever I try to use several Minecraft methods.

    GLStateManager

    seems to be broken. It couldn't

    pushMatrix

    or

    translate

    BlockPos

    also seems to be broken. It errors when I try to

    getX()

     

    Here's the error for the

    getX()

    method (

    testMFFPlugin

    is the plugin, and it's trying to draw a

    TESR

    ).

    Caused by: java.lang.NoSuchMethodError: net.minecraft.util.BlockPos.getX()I

    The whole stack:

    10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: java.lang.reflect.InvocationTargetException
    [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
    [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at java.lang.reflect.Method.invoke(Method.java:497)
    [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at io.github.craftedcart.MFF.client.render.blocks.TERendererFFProjector.func_180535_a(TERendererFFProjector.java:37)
    [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.func_178469_a(SourceFile:114)
    [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.func_180546_a(SourceFile:102)
    [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at net.minecraft.client.renderer.RenderGlobal.func_180446_a(RenderGlobal.java:655)
    [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at net.minecraft.client.renderer.EntityRenderer.func_175068_a(EntityRenderer.java:1294)
    [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at net.minecraft.client.renderer.EntityRenderer.func_78471_a(EntityRenderer.java:1207)
    [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at net.minecraft.client.renderer.EntityRenderer.func_78480_b(EntityRenderer.java:1032)
    [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1048)
    [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:345)
    [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at net.minecraft.client.main.Main.main(SourceFile:120)
    [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at java.lang.reflect.Method.invoke(Method.java:497)
    [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: Caused by: java.lang.NoSuchMethodError: net.minecraft.util.BlockPos.getX()I
    [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	at io.github.craftedcart.TestMFFPlugin.TestMFFPluginBase.renderTEFFProjector(TestMFFPluginBase.java:65)
    [10:19:29] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: 	... 19 more
    FramebufferStatus 0x0000 at beginHand
    FramebufferStatus 0x0000 at pre endHand
    GL error 0x0502: Invalid operation at renderCompositeFinal
    

     

    The details of how plugins are loaded:

     

    1: Plugins are added to the class loader

    LaunchClassLoader loader = (LaunchClassLoader) DependencyUtils.class.getClassLoader(); //DependencyUtils is one of my classes
    loader.addURL(file.toURI().toURL()); //In this case, the file variable would be the mods/CraftedCart/MFFClientPlugins/testMFFPlugin.jar file
    

     

    2: Plugins are searched for an

    @MFFClientPlugin

    annotation using Reflections (Note the extra s on the end of that. It's an external library)

    Reflections reflections = new Reflections();
    clientPlugins = reflections.getTypesAnnotatedWith(MFFClientPlugin.class);
    

     

    3: The

    load()

    method is called on all plugins using Reflection

    for (Class clazz : clientPlugins) {
        Method loadMethod = clazz.getMethod("load");
        loadMethod.invoke(clazz.newInstance());
    }
    

     

    In the test plugin, it would set 2 variables (The method to call when rendering the TESR, and its class)

    The TESR then uses Reflection to invoke the method on that class

  7. Hi there.

    The mod I'm working on requires another jar file to function properly (slick-util.jar). I have it set up so that if the file

    mods/CraftedCart/slick-util.jar

    doesn't exist, my mod will download it before doing anything else (in pre-init). The only issue I have now is how do I load the .jar file. I am aware of the Loader and ModDiscoverer classes, however I have no idea how to use them, or if they will help.

     

    (Oh, and slick-util.jar isn't a mod, but it works if I throw it into the mods folder)

     

    EDIT:

    Nevermind, found it whilst looking through CodeChickenCore

     

    File depsPath = new File(Minecraft.getMinecraft().mcDataDir.getAbsolutePath(), "mods/CraftedCart");
    
    LaunchClassLoader loader = (LaunchClassLoader) DependencyUtils.class.getClassLoader();
    loader.addURL(new File(depsPath, "slick-util.jar").toURI().toURL());
    

     

    As far as I can tell, my DependencyUtils class can be replaced with another one of your own classes.

    The example above will load mods/CraftedCart/slick-util.jar

  8. Hi. I have a TileEntity which sets blocks, however I'm running into a problem where if it tries to place a block in an unloaded chunk (I think), a large, oddly shaped wall appears in that unloaded area, before the chunk is loaded and the wall is removed.

     

    Minecraft also appears to slow to a crawl while this happens. Chunks take a really long time to load, and I get

    Can't keep up

    messages several times in the console.

     

    How would I check if a block is in a loaded chunk, before trying to place it?

     

    Here are some screenshots:

    wGC1e14.jpg

    57kc7Vj.jpg

  9. Well, you're still going to be drawing quads in all likelihood.  Just that you need a texture on those quads to give you the gradient.  You're not going to get the gradient effect without the texture (or a hell of a lot of work).

     

    I guess I could draw a thin cuboid, however I kinda wanted a way to dynamically change the colour of the gradient dynamically (Interpolation). Do you know of any way to do that (eg, is there a way to use a procedurally generated texture?)

     

    Also the glow in the screenshot is quite nice. Does anyone have any idea how to implement that?

  10. I've set up a block with a TileEntitySpecialRenderer which renders fine when I place it in the world, however I have no idea how to make it render in an inventory (It's currently a block with the missing texture in an inventory). How would I do this?

     

    If it's not possible, then how do I make it so that a block renders as a 2D item in an inventory?

     

    Thanks :)

×
×
  • Create New...

Important Information

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