Jump to content

Blackout

Members
  • Posts

    80
  • Joined

  • Last visited

Posts posted by Blackout

  1. I didn't know that Eclipse using its own compiler :o

    I've worked on my java's generics understanding, and I've fixed the issue using

    protected abstract <D extends IData<K>> void buildIndex(final Map<K, DependencyGraph<K, D>.Node> index, final DependencyGraph<K, D>.Node theNode) throws DuplicateKeyException;

    instead of

    protected abstract void buildIndex(final Map<K, DependencyGraph<K, ? extends IData<K>>.Node> index, final DependencyGraph<K, ? extends IData<K>>.Node theNode) throws DuplicateKeyException;
    

     

    Thanks a lot :)

  2. Oh ok my bad ^^

    I use default build.gradle

    The build.gradle in the repository is useless, I only use it to copy/paste when I update forge because I'm too lazy to edit version, group and archiveBaseName each time ^^ I should have remove it from git for a while ^^

     

    All is default Forge 1.9-12.16.1.1887 configuration, and my .git is located in /src

     

    I've gradle 2.7 installed on my computer so I don't need wrapper right ?

    However, I copy/paste all file in mdk zip except gradlew.bat and gradlew.sh

  3. Hello,

     

    I have some issues with generics.

    In eclipse (using JRE 7 with compilance setting set to 1.6), I have no error, my game launches well.

    But when I try to make a release using "gradle build" command, I get a compilation error about generics.

     

    \build\sources\main\java\fr\eyzox\dependencygraph\DependencyGraph.java:31: error: method buildIndex in class DataKeyProvider<K> cannot be applied to given types;
                            node.keyProvider.buildIndex(index, node);
                                            ^
      required: Map<KEY,DependencyGraph<KEY,? extends IData<KEY>>.Node>,DependencyGraph<KEY,? extends IData<KEY>>.Node
      found: Map<KEY,DependencyGraph<KEY,DATA>.Node>,DependencyGraph<KEY,DATA>.Node
      reason: actual argument Map<KEY,DependencyGraph<KEY,DATA>.Node> cannot be converted to Map<KEY,DependencyGraph<KEY,? extends IData<KEY>>.Node> by method invocation conversion
      where KEY,DATA,K are type-variables:
        KEY extends Object declared in class DependencyGraph
        DATA extends IData<KEY> declared in class DependencyGraph
        K extends Object declared in class DataKeyProvider

     

    I don't know why it works in Eclipse but doesn't when build.

    I've edit gradle.build to use Java 7 to compile with theses line :

    sourceCompatibility = 1.7
    targetCompatibility = 1.7
    

     

    Source code is available here : https://github.com/RedRelay/FCH_DEBUG

     

    Maybe it is pur java's generics missunderstanding, but I doubt it because all works fine in Eclipse.

     

    Edit : This is for 1.9 atm so I use the recommended version of forge for MC 1.9 (1.9-12.16.1.1887)

  4. Well, I'm trying to make a custom JUnit test runner to use JUnit for mods tests which required a operationnal Minecraft Server.

    So I'm calling GradleStartServer from my custom JUnit test runner. This appears when Eclipse plugin for JUnit call System.exit() when all test are executed.

    So anyway, I have to completly bypass the security manager using ASM.

     

    But, your project is open source, I spend free time to make a contribution to improve your code by avoiding this exception for futur case for example.

    It's not usefull for me, because as I said before, I need to completely bypass the SecurityManager.

    Maybe it should never be called by usual mod, but it could.

    When this method is called and the call stack is < 5 it will always crash, this is not hypothetical.

     

    Here my crash log :

    Exception in thread "main" [22:32:28] [main/INFO] [sTDERR]: [java.lang.ThreadGroup:uncaughtException:-1]: java.lang.ArrayIndexOutOfBoundsException: 5
    [22:32:28] [main/INFO] [sTDERR]: [java.lang.ThreadGroup:uncaughtException:-1]: 	at net.minecraftforge.fml.relauncher.FMLSecurityManager.checkPermission(FMLSecurityManager.java:21)
    [22:32:28] [main/INFO] [sTDERR]: [java.lang.ThreadGroup:uncaughtException:-1]: 	at java.lang.SecurityManager.checkExit(Unknown Source)
    [22:32:28] [main/INFO] [sTDERR]: [java.lang.ThreadGroup:uncaughtException:-1]: 	at java.lang.Runtime.exit(Unknown Source)
    [22:32:28] [main/INFO] [sTDERR]: [java.lang.ThreadGroup:uncaughtException:-1]: 	at java.lang.System.exit(Unknown Source)
    [22:32:28] [main/INFO] [sTDERR]: [java.lang.ThreadGroup:uncaughtException:-1]: 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

     

     

  5. Hello,

    I've found a IndexOfBoundException in FMLSecurityManager#checkPermission(Permission).

    @Override

        public void checkPermission(Permission perm)

        {

            String permName = perm.getName() != null ? perm.getName() : "missing";

            if (permName.startsWith("exitVM"))

            {

                Class<?>[] classContexts = getClassContext();

                String callingClass = classContexts.length > 3 ? classContexts[4].getName() : "none";

                String callingParent = classContexts.length > 4 ? classContexts[5].getName() : "none";

                // FML is allowed to call system exit and the Minecraft applet (from the quit button)

                if (!(callingClass.startsWith("net.minecraftforge.fml.")

                        || "net.minecraft.server.dedicated.ServerHangWatchdog$1".equals(callingClass)

                        || "net.minecraft.server.dedicated.ServerHangWatchdog".equals(callingClass)

                        || ( "net.minecraft.client.Minecraft".equals(callingClass) && "net.minecraft.client.Minecraft".equals(callingParent))

                        || ("net.minecraft.server.dedicated.DedicatedServer".equals(callingClass) && "net.minecraft.server.MinecraftServer".equals(callingParent)))

                        )

                {

                    throw new ExitTrappedException();

                }

            }

            else if ("setSecurityManager".equals(permName))

            {

                throw new SecurityException("Cannot replace the FML security manager");

            }

            return;

        }

     

    Could you fix it ? Or do you know where I can do a pull request ?

    Thanks

  6. Hello,

     

    I can't build my mod, I got the following error when I use *gradle build* command :

    #################################################
             ForgeGradle 2.0-SNAPSHOT        
      https://github.com/MinecraftForge/ForgeGradle  
    #################################################
                   Powered by MCP 9.10               
                 http://modcoderpack.com             
             by: Searge, ProfMobius, Fesh0r,         
             R4wk, ZeuX, IngisKahn, bspkrs           
    #################################################
    :deobfCompileDummyTask
    :deobfProvidedDummyTask
    :compileApiJava UP-TO-DATE
    :processApiResources UP-TO-DATE
    :apiClasses UP-TO-DATE
    :sourceMainJava UP-TO-DATE
    :compileJava
    warning: [options] bootstrap class path not set in conjunction with -source 1.6
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    1 warning
    :processResources UP-TO-DATE
    :classes
    :jar
    :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
    :extractRangemapSrc
    :retromapSources UP-TO-DATE
    :sourceJar
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Failed to capture snapshot of input files for task 'sourceJar' during up-to-date check.  See stacktrace for details.
    > java.io.FileNotFoundException: fr/eyzox/bsc/config/Config.java (Aucun fichier ou dossier de ce type)
    
    * Try:
    Run with --info or --debug option to get more log output.
    
    * Exception is:
    org.gradle.api.UncheckedIOException: Failed to capture snapshot of input files for task 'sourceJar' during up-to-date check.  See stacktrace for details.
    at org.gradle.api.internal.changedetection.rules.TaskUpToDateState.<init>(TaskUpToDateState.java:60)
    at org.gradle.api.internal.changedetection.changes.DefaultTaskArtifactStateRepository$TaskArtifactStateImpl.getStates(DefaultTaskArtifactStateRepository.java:132)
    at org.gradle.api.internal.changedetection.changes.DefaultTaskArtifactStateRepository$TaskArtifactStateImpl.isUpToDate(DefaultTaskArtifactStateRepository.java:70)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
    at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
    at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
    at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
    at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
    at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:154)
    at org.gradle.internal.Factories$1.create(Factories.java:22)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151)
    at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
    at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99)
    at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93)
    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
    at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
    at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
    at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:48)
    at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:51)
    at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:28)
    at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43)
    at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:170)
    at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
    at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
    at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
    at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
    at org.gradle.launcher.Main.doAction(Main.java:33)
    at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
    at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
    Caused by: org.gradle.api.UncheckedIOException: java.io.FileNotFoundException: fr/eyzox/bsc/config/Config.java (Aucun fichier ou dossier de ce type)
    at org.gradle.internal.hash.HashUtil.createHash(HashUtil.java:39)
    at org.gradle.api.internal.hash.DefaultHasher.hash(DefaultHasher.java:24)
    at org.gradle.api.internal.changedetection.state.CachingFileSnapshotter.snapshot(CachingFileSnapshotter.java:57)
    at org.gradle.api.internal.changedetection.state.CachingFileSnapshotter.snapshot(CachingFileSnapshotter.java:46)
    at org.gradle.api.internal.changedetection.state.CachingFileSnapshotter.snapshot(CachingFileSnapshotter.java:29)
    at org.gradle.api.internal.changedetection.state.DefaultFileCollectionSnapshotter$1.run(DefaultFileCollectionSnapshotter.java:70)
    at org.gradle.internal.Factories$1.create(Factories.java:22)
    at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:192)
    at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:175)
    at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:106)
    at org.gradle.cache.internal.DefaultCacheFactory$ReferenceTrackingCache.useCache(DefaultCacheFactory.java:187)
    at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:60)
    at org.gradle.api.internal.changedetection.state.DefaultFileCollectionSnapshotter.snapshot(DefaultFileCollectionSnapshotter.java:62)
    at org.gradle.api.internal.changedetection.rules.TaskUpToDateState.<init>(TaskUpToDateState.java:56)
    ... 57 more
    Caused by: java.io.FileNotFoundException: fr/eyzox/bsc/config/Config.java (Aucun fichier ou dossier de ce type)
    at org.gradle.internal.hash.HashUtil.createHash(HashUtil.java:34)
    ... 70 more
    
    
    BUILD FAILED
    

     

    My code compile and works when I run it througth Eclipse.

    I'm under a linux distribution, I use Forge 1.8 recommended, my sources files are in /src/main/java and my mcmod.info in /src/main/resources (the file in FileNotFoundException exists).

     

    There is my 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.0-SNAPSHOT'
        }
    }
    apply plugin: 'net.minecraftforge.gradle.forge'
    */
    
    // for people who want stable
    plugins {
        id "net.minecraftforge.gradle.forge" version "2.0.2"
    }
    
    version = "2.0.0"
    group= "fr.eyzox.forgecreeperheal" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
    archivesBaseName = "forgecreeperheal"
    
    minecraft {
        version = "1.8-11.14.4.1563"
        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_20141130"
        // 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
    
    }
    
    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'
        }
    }
    

     

    Could you mind telling me what I'm doing wrong ? Thank you

  7. The problem is that I don't want to load all data in RAM.

    If I have one WorldSavedData wich contains all my explosion data in a Collection, all will be loaded.

    How can I solve this problem using the minecraft save system ?

     

    I wanted to use ChunkDataEvent to store explosionID wich is my WorldSavedData key.

  8. Hello :)

     

    I want to remove a custom WorldSavedData, how can I do this ?

     

    In my mod, I need to store things for each explosion. Each explosion will have an WorldSavedData object.

    I will replace all block by the explosion, when no more block left, I want to remove the WorldSavedData entry.

     

    I don't want to just remove it from Map, I want to remove it from file.

  9. Hi, could you explain me how Chunk is loaded ?

     

    For my mod, I save all removed block from an explosion to restore it later. I currently work on serialization to save unrestored blocks when server shutdown.

     

    My first idea was storing in world.perWorldMapStorage a Map<Chunk, File> for "affected chunk ==> file where is stored explosion data" (1 file = 1 explosion, because I can have dependencies from other chunk to replace block in a good order) and create a file when an explosion occurs then store in json format data I need then save the file in "world directory/myMod/custom_name_timestamp.json". Create an engine to load and unload explosion data when chunk is loaded/unloaded.

     

    But it doesn't seen to be the best practice. Next I thought about creating an Entity which could contains my explosion data. So loading and unloading will be implemented by Minecraft code. Something less to do and maintains :D

     

    However to do that I need to know how chunk loading/unloading works. Let me explain with an example :

     

    I have a big explosion of 10 chunks. My entity is located in the middle of the explosion area. When entity is loaded block are progressively restored. But if entity is located in chunk loaded border, I have 5 chunk loaded and 5 chunk unloaded. When I want to restore a block located in a unloaded chunk, is this chunk loaded then immediately unloaded ? So if my next restoring is a block in this chunk, it will be loaded and unloaded again ?

     

  10. I ran in debug mod with breakpoint on each EntityItem constructors.

    Except these f*ck**g chickens who spawn eggs entity items each 5 min, I could see where is the problem by studying the stack trace.

     

    World.setBlockState call Chunk.setSate call Block.breakBlock call sometimes Block.updateNeightboor ><

    So the call to Block.breakBlock in Chunk.setState is the source of this issue.

     

    I think I have to create a copy of Chunk.setState method, use reflection to access private Chunk field and then I hope this will be fixed.

     

    However, I have an other question if I use reflection.

    What is the most performant ? Create a wrapper wich contains private chunk field initialized in constructor with reflection and store it in cache while explosion event processing. Or each time use reflection to get field ?

    I think I will ask this on stackoverflow but if someone have the answers, I take it :P

     

     

  11. This is not efficient, not scalable and not custom block compatible.

    Watch my code, I use a Factory to build each "healable block". Its allow someone who have create a custom block to create its own factory to make it compatable with my mod.

    I can't use falling, non-opaque etc ... because this is not constant rules.

     

    Then, with you method, you sort all block in one time when an explosion occurs. This could create a lag spike for massive explosions.

  12. Now I'm curious. How exactly did you do that in the video? I'm assuming you get affected block positions from explosion event, but how did you get them to slowly regenerate,  instead of all at once? Did you start a new thread for that?

     

    https://github.com/EyZox/ForgeCreeperHeal/tree/1.2.0

    Open source ;)

    Handler : https://github.com/EyZox/ForgeCreeperHeal/blob/1.2.0/main/java/fr/eyzox/forgecreeperheal/handler/ExplosionEventHandler.java

    Handler Processing Class : https://github.com/EyZox/ForgeCreeperHeal/blob/1.2.0/main/java/fr/eyzox/forgecreeperheal/worldhealer/WorldHealer.java

    Data Structure : https://github.com/EyZox/ForgeCreeperHeal/blob/1.2.0/main/java/fr/eyzox/timeline/AbstractTimeline.java

     

    I use the tick loop, because Minecraft isn't thread safe ;)

×
×
  • Create New...

Important Information

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