Jump to content

Nauktis

Members
  • Posts

    23
  • Joined

  • Last visited

Posts posted by Nauktis

  1. Hi,

     

    I have a question regarding Containers.

    Is there a new instance created on the server for each player using the GUI?

    I am a bit confused as a Container contains a list of players and a list of crafters.

     

    I am asking because I want to reduce the number of updates I send to the client by caching values in the Container (on the server) and only send information if something changed.

    But I don't know if there is a one to one relationship between Container instances and players having the GUI open.

     

    Thanks.

  2. Use gradle to fetch everything for you.

     

    Add this to your build.gradle (you need to change the versions as they come from a property file for me):

    dependencies {
        compile "codechicken:CodeChickenLib:${config.minecraft_version}-${config.codechickenlib_version}:dev"
        compile "codechicken:CodeChickenCore:${config.minecraft_version}-${config.codechickencore_version}:dev"
        compile "codechicken:ForgeMultipart:${config.minecraft_version}-${config.forgemultipart_version}:dev"
        compile "codechicken:NotEnoughItems:${config.minecraft_version}-${config.notenoughitems_version}:dev"
    }
    

     

  3. I found a quick and easy way to do it but I am very curious about the dev version of COFH.

    They provide so little information on their website for devs...

     

    Later I would also like to access the list of existing recipes (to implement my own pulverizer).

    So if you have information about that as well please post :)

     

    Here's my quick test code (working)

    try {
        Class klass = Class.forName("cofh.api.modhelpers.ThermalExpansionHelper");
        Method method = klass.getMethod("addPulverizerRecipe", int.class, ItemStack.class, ItemStack.class);
        method.invoke(null, 150, new ItemStack(Items.apple), new ItemStack(Items.arrow));
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
    

    You obviously want to handle the different catch clauses to account for the fact that the recipe was not added.

  4. Hi,

     

    I know someone probably asked before but I really could not find the information.

    I would like to add Thermal Expansion (pulverizer, induction smelter, etc.) recipes for my items.

     

    I know the COFH team provides a class ThermalExpansionHelper to do that but I have no idea how to get access to it in my dev environment.

    Also, I do not want to depend on any mod. If Thermal Expansion is available, I'll add my recipes but if it is not, my mod will just add classic recipes instead.

     

    Could you help me a bit or point me to the right direction?

     

    Thanks a lot.

     

    N.

  5. Hi,

     

    I am having some issues with my design regarding the way TileEntities are created.

     

    As you know, there are basically two ways for a TileEntity to be created.

    - The Block creates it upon placement using createNewTileEntity(). There we have all the freedom to pass any information we want.

    - The TileEntity is created (using default constructor) when loading a game that had one already there.

     

    My problem is the following:

    My TileEntity needs some configuration values when it is created (lets say the size of its inventory).

    I previously stored this value in the NBT tag of the TileEntity and had no problem.

     

    But this value is actually configuration and never changes, so I though it is a bit silly that each TileEntity saves it.

     

    Before continuing I need to precise that I can not store that config value statically (MyModConfiguration.getConfigValue()) because my TileEntity is used by different blocks that each have a different config value.

    Lets say I have block1 that has an inventory size of 10 and block2 that has an inventory size of 20.

     

    The way to work around this is to ask the block of the TileEntity its config value (worldObj.getBlock(x,y,z).getConfigValue()).

    My problem is that when a TileEntity is loaded the readFromNBT is called immediately before anything else from the TileEntity is set (world object, position, etc.)

    My TileEntity is therefore trying to restore the inventory content while the inventory is not yet created because I can not access its size.

     

    Would you see a way to work around this? How do you typically handle loading of TileEntities?

    I hope my explanations are clear enough and thanks a lot beforehand.

  6. Alright, I'll try it this way then.

     

    I didn't try before because the Javadoc is saying:

    /**
    * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot.
    */

     

    Any idea why "(ignoring stack size)"?

    It is usually used to limit the kind of item you can put in.

  7. Hi,

     

    I an trying to limit what can be inserted in an inventory.

    The kind of limitation I need is:

    • "No more than 10 item Items.apple at any given time."
    • "No more than 8 item Items.arrow at any given time."

    (all Items.apple do not need to be in the same slot)

     

    I am not looking for getInventoryStackLimit() as it will depend on the kind of item.

    I need the limitation to be applicable for GUI interactions but also machines inserting (hoppers and whatnot).

     

    I am currently using a IInventory as sides do not matter but it seems ISidedInventory allows for more control.

    Worst case scenario, I disallow interactions from machines and use the Slot to have more fine grained control.

     

    What do you think?

     

    Thanks a lot beforehand for your help ;)

  8. Hi,

     

    I've learned a mod isn't supposed to ship the API in its jar file (which of course makes sense).

    My problem is that by default (unless I missed something), the build.gradle takes everything in src/

     

    How should I configure the build to exclude the api files from the jar?

     

    Thanks a lot for your help.

  9. Hi,

     

    I would like to register different recipes for my items/blocks depending on what mods the user has installed.

    Simple example, I would have recipes with only vanilla items if the user has nothing but my mod. And I would have recipes that uses items from Thermal Expansion, if they are available.

     

    The problem I'm facing is how do I know if Thermal Expansion is installed?

    Recipes should be registered during the init event. And I'm correct, it is only in the post-init that you can ask if a Mod has been loaded (by its ID)

     

    Thanks in advance for your help ;)

     

    N.

  10. Thanks for your help.

    I added -Dfml.coreMods.load=codechicken.core.launch.CodeChickenCorePlugin,codechicken.nei.asm.NEICorePlugin

     

    Seems to go a bit further but now it crashes when starting:

     

     

    [23:02:38] [main/INFO] [GradleStart]: No arguments specified, assuming client.
    [23:02:38] [main/INFO] [GradleStart]: Extra: []
    [23:02:38] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --username, ForgeDevName, --tweakClass, cpw.mods.fml.common.launcher.FMLTweaker, --accessToken, {REDACTED}, --assetIndex, 1.7.10, --assetsDir, /Users/Harold/.gradle/caches/minecraft/assets, --version, 1.7.10]
    [23:02:38] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker
    [23:02:38] [main/INFO] [LaunchWrapper]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker
    [23:02:38] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker
    [23:02:38] [main/INFO] [FML]: Forge Mod Loader version 7.10.25.1207 for Minecraft 1.7.10 loading
    [23:02:38] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.7.0_51, running on Mac OS X:x86_64:10.9.4, installed at /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre
    [23:02:38] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
    [23:02:38] [main/INFO] [FML]: Found a command line coremod : codechicken.core.launch.CodeChickenCorePlugin
    [23:02:38] [main/WARN] [FML]: The coremod codechicken.core.launch.CodeChickenCorePlugin does not have a MCVersion annotation, it may cause issues with this version of Minecraft
    [23:02:38] [main/INFO] [FML]: Found a command line coremod : codechicken.nei.asm.NEICorePlugin
    [23:02:38] [main/WARN] [FML]: The coremod codechicken.nei.asm.NEICorePlugin does not have a MCVersion annotation, it may cause issues with this version of Minecraft
    [23:02:38] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
    [23:02:38] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker
    [23:02:38] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
    [23:02:38] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker
    [23:02:38] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper
    [23:02:39] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work!
    [23:02:40] [main/ERROR] [FML]: The minecraft jar file:/Users/Harold/.gradle/caches/minecraft/net/minecraftforge/forge/1.7.10-10.13.0.1207/forgeSrc-1.7.10-10.13.0.1207.jar!/net/minecraft/client/ClientBrandRetriever.class appears to be corrupt! There has been CRITICAL TAMPERING WITH MINECRAFT, it is highly unlikely minecraft will work! STOP NOW, get a clean copy and try again!
    [23:02:40] [main/ERROR] [FML]: FML has been ordered to ignore the invalid or missing minecraft certificate. This is very likely to cause a problem!
    [23:02:40] [main/ERROR] [FML]: Technical information: ClientBrandRetriever was at jar:file:/Users/Harold/.gradle/caches/minecraft/net/minecraftforge/forge/1.7.10-10.13.0.1207/forgeSrc-1.7.10-10.13.0.1207.jar!/net/minecraft/client/ClientBrandRetriever.class, there were 0 certificates for it
    [23:02:40] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing
    [23:02:40] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper
    [23:02:40] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper
    [23:02:40] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper
    [23:02:40] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper
    [23:02:40] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker
    [23:02:43] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.TerminalTweaker
    [23:02:43] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.TerminalTweaker
    [23:02:43] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}
    [23:02:47] [main/INFO]: Setting user: ForgeDevName
    [23:02:51] [Client thread/INFO]: LWJGL Version: 2.9.1
    [23:02:52] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization
    [23:02:52] [Client thread/INFO] [FML]: MinecraftForge v10.13.0.1207 Initialized
    [23:02:52] [Client thread/INFO] [FML]: Replaced 182 ore recipies
    [23:02:52] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization
    [23:02:52] [Client thread/INFO] [FML]: Searching /Users/Harold/Documents/minecraft/mods/SolarFlux/eclipse/mods for mods
    [23:02:52] [Client thread/INFO] [FML]: Also searching /Users/Harold/Documents/minecraft/mods/SolarFlux/eclipse/mods/1.7.10 for mods
    [23:02:54] [Client thread/ERROR] [FML]: FML has detected a mod that is using a package name based on 'net.minecraft.src' : net.minecraft.src.FMLRenderAccessLibrary. This is generally a severe programming error.  There should be no mod code in the minecraft namespace. MOVE YOUR MOD! If you're in eclipse, select your source code and 'refactor' it into a new package. Go on. DO IT NOW!
    [23:02:57] [Client thread/INFO] [FML]: Forge Mod Loader has identified 7 mods to load
    Aug 21, 2014 11:02:57 PM com.google.common.eventbus.EventBus$LoggingSubscriberExceptionHandler handleException
    SEVERE: Could not dispatch event: cpw.mods.fml.common.LoadController@6ea3ffa8 to public void cpw.mods.fml.common.LoadController.buildModList(cpw.mods.fml.common.event.FMLLoadEvent)
    [23:02:57] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge
    ---- Minecraft Crash Report ----
    // You're mean.
    
    Time: 8/21/14 11:02 PM
    Description: Initializing game
    
    java.util.NoSuchElementException: Missing nodes from graph
    at cpw.mods.fml.common.toposort.TopologicalSort$DirectedGraph.addEdge(TopologicalSort.java:70)
    at cpw.mods.fml.common.toposort.ModSorter.buildGraph(ModSorter.java:114)
    at cpw.mods.fml.common.toposort.ModSorter.<init>(ModSorter.java:46)
    at cpw.mods.fml.common.Loader.sortModList(Loader.java:251)
    at cpw.mods.fml.common.Loader.loadMods(Loader.java:472)
    at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:204)
    at net.minecraft.client.Minecraft.startGame(Minecraft.java:532)
    at net.minecraft.client.Minecraft.run(Minecraft.java:941)
    at net.minecraft.client.main.Main.main(Main.java:164)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at GradleStart.bounce(GradleStart.java:107)
    at GradleStart.startClient(GradleStart.java:100)
    at GradleStart.main(GradleStart.java:55)
    
    
    A detailed walkthrough of the error, its code path and all known details is as follows:
    ---------------------------------------------------------------------------------------
    
    -- Head --
    Stacktrace:
    at cpw.mods.fml.common.toposort.TopologicalSort$DirectedGraph.addEdge(TopologicalSort.java:70)
    at cpw.mods.fml.common.toposort.ModSorter.buildGraph(ModSorter.java:114)
    at cpw.mods.fml.common.toposort.ModSorter.<init>(ModSorter.java:46)
    at cpw.mods.fml.common.Loader.sortModList(Loader.java:251)
    at cpw.mods.fml.common.Loader.loadMods(Loader.java:472)
    at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:204)
    at net.minecraft.client.Minecraft.startGame(Minecraft.java:532)
    
    -- Initialization --
    Details:
    Stacktrace:
    at net.minecraft.client.Minecraft.run(Minecraft.java:941)
    at net.minecraft.client.main.Main.main(Main.java:164)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at GradleStart.bounce(GradleStart.java:107)
    at GradleStart.startClient(GradleStart.java:100)
    at GradleStart.main(GradleStart.java:55)
    

     

  11. Hi,

     

    I want to add Waila support to my mod.

    I followed the procedure ProfMobius highlighted on his website, adding the following to the gradle build file.

     

    repositories {
        maven {
            name "Mobius Repo"
            url "http://mobiusstrip.eu/maven"
        }
        maven {
            name 'CB Repo'
            url "http://chickenbones.net/maven/"
        }
    }
    
    dependencies {
        // I dont have to specify NEI.. because gradle magic. aka: transitive dependency resolution
        compile "mcp.mobius.waila:Waila:1.5.3_1.7.10"
    }
    

     

    Then a small: gradle clean setupDecompWorkspace eclipse --refresh-dependencies

    Jar files are there in my Eclipse and I start wrtiting my add-on.

    The problem I have is that when I start Minecraft from Eclipse, Forge complains that a requirement is not there: NEI

     

    Could someone help me?

     

    Thanks a lot.

  12. Thanks a lot for your help, you really made my day :)

     

    When the server loads the tile entity from NBT it now sends a Packet to my Client who in turn updates its tile entity state.

    When printing to the chat the values are stil a bit different though but I guess its because the value changes on the server before the client receives the packet.

     

    Another problem I have which is very much related is that the daytime seems desynchronized between the Client and the server :/

    I use the isDaytime() method on the World object that I receive in the onBlockActivated method of my block:

    if (pWorld.isRemote) {
    pPlayer.addChatMessage(new ChatComponentText("Remote isDaytime: " + pWorld.isDaytime()));
    } else {
    pPlayer.addChatMessage(new ChatComponentText("NotRemote isDaytime: " + pWorld.isDaytime()));
    }
    

     

    Which produces:

    vspaj7.png

     

    Am I missing something ?

    isRemote == true is the server and isRemote == false is the Client right?

    If I understand correctly, the full logic is executed on both the Client and the Server and some things are synced from now and then.

    My tile entity checks if it is daytime to produce energy and a different behaviour between Client and Server is a big issue for me :(

     

    Again, all my code can be found on GitHub: https://github.com/Nauktis/SolarFlux

  13. Hi,

     

    It seems that my tile entity for a block is desynchronized between the server and the client.

    I noticed it after creating a GUI for my block.

     

    The idea is really simple, the tile entity has an amount of energy stored.

    When loading a game with a block already in it, it seems that the Server is re-creating the tile entity using the readNBT method and therefor gets the proper value for the energy stored but on the Client side, the createNewTileEntity method is called and a new tile entity with no energy in it is created.

     

    Here is a link to my GitHub.

     

    The Block: https://github.com/Nauktis/SolarFlux/blob/master/src/main/java/com/nauktis/solarflux/blocks/SolarPanelBlock.java

    The Tile Entity: https://github.com/Nauktis/SolarFlux/blob/master/src/main/java/com/nauktis/solarflux/blocks/SolarPanelTileEntity.java

     

    Here is how I know the tile entities are desynchronized

    SolarPanelTileEntity tile = (SolarPanelTileEntity) pWorld.getTileEntity(pX, pY, pZ);
    if (pWorld.isRemote) {
    pPlayer.addChatMessage(new ChatComponentText("Remote: " + tile.getEnergyStored()));
    } else {
    pPlayer.addChatMessage(new ChatComponentText("NotRemote: " + tile.getEnergyStored()));
    }

    Here is the result:

    2hdtxqf.png

    This of course only occurs when loading a game with blocks already placed.

     

    Your help will be greatly appreciated :)

     

    N.

  14. Hi,

     

    I created a mod that contains some base and utility classes.

    I'd like to reuse those in a second mod.

    Can I simply include the classes in my second mod or am I gonna run into class loading issues?

     

    What is the way to go? Do I need to create a separate jar file with those classes (without any @Mod annotated class) and use it as a library for my mods?

    How to proceed with ForgeGradle?

     

    Thanks a lot for your help.

×
×
  • Create New...

Important Information

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