Jump to content

GeoffNukem

Forge Modder
  • Posts

    15
  • Joined

  • Last visited

Posts posted by GeoffNukem

  1. I can't see how doing it manually can be so difficult. I've always installed forge and mods manually, and had no issues (touch wood). All you do is copy a few files here and there and you're done. Just make sure you read up on it before you go into it. For example, if you're installing Forge, read the wiki for how to do it. If you're installing a mod, then look on their thread or their readme files on how to install it. A good mod author(s), in my opinion, should always provide clear instructions on how to (un)installation their mod, no matter how simple it is.

  2. This is pretty much what I do, maybe not named as they are here, but the important stuff should be there.

     

    The @Mod class.

     

    @Mod(modid = "MyMod", name = "My Mod", version = "1.0.0")
    @NetworkMod ( clientSideRequired = true, serverSideRequired = false)
    public final class MyMod {
    
    @SidedProxy(clientSide = "[MyPackage.ClientProxy", serverSide = "MyPackage.CommonProxy")
    public static CommonProxy proxy;
    @Instance
    public static MyMod instance;
    
    @PreInit
    public void preInit(FMLPreInitializationEvent event) { }
    
    @Init
    public void Load(FMLInitializationEvent event) {
    	proxy.registerRenderInformation();
    }

     

    ClientProxy class.

     

    public class ClientProxy extends CommonProxy {
    
    @Override
    public void registerRenderInformation() {
    	TickRegistry.registerTickHandler(new MyTickHandler(), Side.CLIENT);
    }
    
    }

     

    MyTickHandler class.

     

    public final class MyTickHandler implements ITickHandler {
    
    public MyTickHandler() { }
    
    @Override
    public void tickStart(EnumSet<TickType> type, Object... tickData) { }
    
    @Override
    public void tickEnd(EnumSet<TickType> type, Object... tickData) {
    	if (type.equals(EnumSet.of(TickType.RENDER))) {
    		onRenderTick();
    	} else if (type.equals(EnumSet.of(TickType.CLIENT))) {
    		GuiScreen guiscreen = Minecraft.getMinecraft().currentScreen;
    		if (guiscreen != null) {
    			onTickInGUI(guiscreen);
    		} else {
    			onTickInGame();
    		}
    	}
    }
    
    @Override
    public EnumSet<TickType> ticks() {
    	return EnumSet.of(TickType.RENDER, TickType.CLIENT);
    }
    
    @Override
    public String getLabel() {
    	return "MyMod";
    }
    
    private void onRenderTick() {
    	if(Minecraft.getMinecraft().theWorld != null) {
    		[myLeaves].setGraphicsLevel(Minecraft.getMinecraft().gameSettings.fancyGraphics);
    	}
    }
    
    private void onTickInGame() { }
    
    private void onTickInGUI(GuiScreen guiscreen) { }
    

     

    Your leaves class should be okay.

     

    Also remember to change the names of the classes and things to the ones you're using.

     

    Hope this helps.

  3. On the wiki (here), there is an example of how to set up the Tick Handler. If you haven't already, go through this. In there is an OnRenderTick method. Inside that I do this for my leaves:

     

    private void onRenderTick() {
    if(isWorldLoaded()) {
    	MCGLoader.block_leaves.setGraphicsLevel(fancyGraphics);
    	fancyGraphics = this.mc.gameSettings.fancyGraphics;
    }
    }
    

     

    The isWorldLoaded() is just a method checking if the world is loaded (!= null). I then call the leaves' setGraphicsLevel() method which then sets the fancy graphics on/off. I don't use the 'this.blockIndexInTexture' line. Obviously, make sure you change it so that it calls for your leaves block and not mine lol.

     

    The code may need cleaning up a bit, but this is how I do it and it works for me. I hope it'll work with you :)

  4. I have tried in every possible way to get it to work, replacing recipes that work with it, and everything. It even works for my other furnace and the default furnace, just not this one, and I dont understand it. All my other recipes and all the other vanilla recipes work

     

    Just had a look at the code you've posted on the OP and I have found this in your canSmelt and smeltItem methods:

    ItemStack var1 = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0]);

    I know that was over a week ago and is probably old code by now, but did you change those lines to something like this?

    ItemStack var1 = ThorMod_GoldronFurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0]);

  5. Minecraft Generations

    Version: 0.1.0    MC Version: 1.3.2

    Requires: MC Forge, Universal (4.0.0.241 or higher)


    Information

    Minecraft Generations is a mod which aims to change the way you'd usually play Minecraft. It does this by adding features, like the inability to punch trees for wood, no more wooden tools and adding new Tools, Materials and Crafting Recipes. There have been a lot of changes to Minecraft, so scroll around to familiarise yourself.

     

    As this mod changes game-play, so I have included a GettingStarted.txt file. This is just a simple text file telling you how to get started with this mod. The contents of the Getting Started text file is somewhere below, so you can check it out before you download the mod. As the mod expands (and it will), I'll produce more guides if needed. But for now, I recommend that you read this guide. If any of you think that you can do a better job at making a guide, feel free to do so. If you have any questions feel free to ask.

     

    It isn't certain that other mods will work with this mod. I have not tested and will not be testing this mod with any other mods. I will not be purposely making sure that this mod will be compatible with another. I'll try my best to make this compatible with other mods, but if it doesn't work then it doesn't work. I will make list of mods that are (in)compatible, so if there is a mod that works with this one, post the name, version and MC version. Then if others agree that it works, I'll add it to the list. A config file will be generated (just start the game with the mod installed) in the config folder (

    .minecraft\config\MCGenerations

    to be precise), so if there are any ID conflicts and you know what you're doing, then you can change them there.

     

    This mod has not been tested on multiplayer and I can't promise that'll work neither. I did try to set up the mod for it and it is something I do want to get working. So try it at your own risk. If you do try it, please let me know how you got on.

     

    This mod is very much in early development and there is still a lot of work to be done. I have already got a bunch of ideas, which I might share soon, but if you have any requests or ideas then do share them. Also please post feedback on the changes I've made, as I would really like your views on them :)

     

    Download Link:

    Download (MediaFire)


    Installation

    Download & install Minecraft Forge - Universal (4.0.0.241 or higher).

     

    Copy the

    MCG.zip

    in the

    .minecraft\mods

    folder. If you do not have a mods folder, make one.

     

    Start Minecraft, so the Config file can be generated. The config file is located in the

    config\MCGenerations

    folder in your

    .minecraft

    folder.

     

    Uninstallation

    Delete, or move out of the mods folder, the

    MCG.zip

    file. It is that simple. You may also delete the MCGenerations folder and its contents, but this is just a clean up step and isn't necessary.


    Videos

    Mod Spotlights go here. If you want to make a Spotlight, then go ahead and I'll post it here (if its good ;) )

     

    Screenshots

     

     

    Campfire

     

     

    ShCxMkc3

    ULK6gsNB

     

     

    Diamond Set

     

     

    plhEhNmx

     

     

    Logs

     

     

    JdpwgP5k

     

     

    Copper, Tin & Bronze

     

     

    clYoUtHY

     

     

    Stone Axe Head

     

     

    9BpQe1D3

     

     

    Stone Axe

     

     

    9G2zQd2U

     

     

    Swords

     

     

    BnYemthA

     

     

     

     

     

    Current Features

    This mod replaces/overwrites items in the game.

    • New Materials
      • Bronze - Make tools and stuff :)

      [*]More Blocks & Items

      • Campfire - Start fire to cook food. Also good for a source of light.
      • 1/2 & 1/4 logs - Be a true lumberjack and chop logs into small planks.

      [*]More Recipes

      [*]New Tool Sets

      [*]More Swords

      [*]New Tools:

      • Hammer - Good for smashing certain blocks, also a useful construction tool.
      • Club - Good for smashing certain blocks, also a weapon.

       

      [*]More coming soon :D

     

    Changes to Minecraft

    This mod makes lots of changes to Minecraft. It adds and edits a ton of things to Minecraft. I have also 'removed' certain items and placed my own in their place. Just so we're clear, when I say 'removed' I just mean I set them to null and used that ID for my own stuff. The original stuff are still there, just unused at the moment. My aim is to do this without touching any base classes. If there are any base edits, I'll tell you.

     

    So check out the list below for the changes I've made.

     

     

    • EnumToolMaterial
      All I have done here is made my own EnumToolMaterial and basically just used that. I've changed the number of uses and harvest levels to materials.
      The harvest levels are:
       
       
      • WOOD, GOLD = 0
      • STONE = 1
      • BRONZE = 2 (new)
      • IRON = 3
      • DIAMOND = 4

       

       

       

      [*]Tools & Weapons

      Wood and Gold tools & weapons are 'removed'.

      I have also changed the Crafting Recipes to make tools and the process to make them. You must craft the Tool 'head' first and then craft the head with a stick or something like that.

      I have also retextured the original Tools. For example, the Diamond tools and the Stone tools.

       

      [*]Coal Ore - This just requires Bronze or above.

      [*]The Hammer

      This changes Minecraft, as I have also made certain blocks only obtainable by a hammer.

      The idea of the Hammer is its an effective 'smashing' tool, but also a tool to construct with. Basically, blocks like the Cobblestone blocks, Stone Bricks and Clay bricks (the blocks used for construction) can only be obtained with a hammer.

       

      [*]Trees

      You cannot simply punch trees for the wood. First you must craft an axe to chop them down. You'll then be given 2 half logs (blocks). Place the half logs down and chop them to get 2 quarter logs. Then place the quarter logs to get planks. For more info, read the Getting Started guide.

       

     

     

    Right now I'm just trying things out and seeing how they go. That is why feedback from you guys is so important for me. So please post what you think :)

     

    Readme

     

     

    -----------------------------------------------------
    =====================================================
                    MINECRAFT GENERATIONS
    =====================================================
                  Version(MC): 0.1.0 (1.3.2)
    -----------------------------------------------------
    ========================
        List of Contents
    ========================
    
    1.	Contents
    2.	Mod Information & stuff
    3.	Installation 
    4.	Uninstallation
    5.	Credits
    6.	Change log
    
    ===============================
    2.  Mod Information & stuff
    ===============================
    
    Version(MC): 0.1.0 (1.3.2)
    Requires:	
    	Minecraft v1.3.2
    	Minecraft Forge (MCForge) V4.0.0.241 or higher
    
    
    You MUST NOT redistrubute or sell this mod or any contents of 
    this mod!!
    You MUST NOT include this mod in any Mod Packs!! And do not bother
    asking me for permission to do so because the answer will be no. Why?
    Because this is a stand alone mod. You can either install this mod with
    others or none at all.
    
    It isn't certain that all other mods will be compatible with this 
    mod and I'm not purposly making this mod compatiable with any other mod. 
    If it works, great. If not, never mind.
    It also isn't certain that this mod will work on Multiplayer,
    as I have not tested this (and probably wont for a while). So play it on
    multiplayer at your OWN risk.
    
    Currently, I am proud to say, the mod edit NO original minecraft 
    classes. This mod aims to not edit any origial classes and I am making my best
    efforts that future releases will conatin no original MC classes. I'm not making
    any promises that future releases will not contain base edits, but like I just
    stated this will be avoided.
    
    Minecraft Generations (MCG) changes gameplay from the start. A 
    simple Getting Started text file (GettingStarted.txt) is provided. It is
    recommended that you read the guide so you know what to do, as one gameplay
    change is you cannot punch trees to get wood.
    
    Spotlights and Texture packs are welcome. Just tell me that you're
    doing one. Once you're done and if its appropriate, tell me and I can
    then link it on the Opening post.
    
    ====================
    3.  Installation
    ====================
    !!!MAKE A BACKUP OF YOUR .minecraft FOLDER!!! (So if things were 
    to mess up, you can fall back to your backup)
    
    Download & install the lastest (4.0.0.241 or higher) Minecraft 
    Forge Universal files.
    
    Copy the MCG.zip in the .minecraft\mods folder.
    If you do not have a mods folder, make one.
    
    ======================
    4.  Uninstallation
    ======================
    Delete, or move out of the mods folder, the MCG.zip file. It is
    THAT simple.
    You may delete the MCG config files in the config folder, but this isn't
    necessary (just a clean up step).
    
    ===============
    5.  Credits
    ===============
    
              Coding:	GeoffNukem
    	Textures:	GeoffNukem
    	 Testing:	GeoffNukem
       
    ==================
    6.  Change log
    ==================
    
    0.1.0:
        -   First Release
    
        -   Added some new Blocks, Items & Tools
    
        -   New Tools -
                    Hammer: Used for smashing certain blocks and 'building' 
                            (picking up brick blocks and cobblestone).
                    Club:   A tool also used to smash certain blocks. Can 
                            also be used as a weapon.
    
        -   Removed Wooden Tools & Weapons.
    
        -   Retextured some tools and weapons:
                            Diamond tools and sword are retextured.
    
        -   Removed certain recipes:
                            All default tool recipes are removed and are given
                            alternative recipes.
    
        -   Tweaked EnumToolMaterials (I actually just made my own and used 
            that, the vanilla EnumToolMaterials is untouched)
    
        -   Changed harvest levels to tools and blocks. (The blocks below are just examples)
    	GOLD & WOOD 	= 0		(Block)oreCoal   = 2 (BRONZE)
    	STONE			= 1		(Block)oreIron   = 2 (BRONZE)
    	BRONZE			= 2		(Block)oreGold   = 3 (IRON)
    	IRON			= 3		(Block)obsidian  = 4 (DIAMOND)
    	DIAMOND			= 4	
    
    =====================================================
    

     

     

    Getting Started

     

     

    -----------------------------------------------------
    =====================================================
                    MINECRAFT GENERATIONS
    =====================================================
                  Version(MC): 0.1.0 (1.3.2)
    -----------------------------------------------------	
    
    =======================
        Getting Started
    =======================
    
    This is a quick getting started guide, as this mod changes the 
    usual gameplay of the vanila MC.
    
    I recommend that you read this, so you know what you're doing. It
    will also prevent you wondering why you cannot get wood from trees.
    
    --------------------
        Getting Wood
    --------------------
    
    The method of getting wood has changed. Punching trees for wood is
    impossible. Instead there are various of steps to do before you can chop
    trees.
    
    
    Step 1 - The Club
    ---------------------
    If you dig through leaves then there is a chance of getting 1 of
    2 items, a Sapling or Tree Branch. The Sapling is the orignal Sapling, you
    can place this into your crafting grid to get 2 Sticks. You'll need these
    sticks to make tools later on.
    
    The Tree Branch can be craft, along with Flint, into a Club. So
    after digging through the leaves, find some gravel and get a some Flint.
    Then place the flint and Club in the crafting grid (shapeless). Then you'll
    get a Wooden Club.
    
    The Club can be used for smashed certain blocks. It can also be
    used as a weapon.
    
    
    
    Step 2 - Cobblestone & Tool Heads
    -------------------------------------
    Cobblestone (item) is found by bashing Weak stone Blocks with a
    club (or a hammer). Weak stone (or Stone (Weak)) can be found anywhere.
    They look similar to the cobblestone blocks, but with lighter cracks.
    
    With the Cobblestone, you can then craft Stone Tool Heads. Tool
    heads are used to make the final tools themselves. Example, a Stone Axe
    Head can be used to make a Stone Axe. All tools are crafted by making the
    tool head, and then crafting this with a stick.
    
    The crafting pattern for a Tool Head is similar to the default
    pattern when making a tool, just minus the two sticks in the middle. For
    example:
    [C][C]
    [C][ ]		=	Stone Axe Head
    
    C = Cobblestone
    
    Step 3 - Stone tools
    ------------------------
    Stone tools are crafted differently to the other tools. For these
    you will need Sugar Canes. You can then craft a stone tool like so:
    [H][s]
    [/][ ]
    
    H = Stone Tool Head, [s] = Sugar Cane and [/] = Stick
    
    You should now be able to craft a Stone Axe. 
    
    
    Step 4 - Workbench
    ----------------------
    Chop a tree with a Stone Axe, and you'll be given 2 Half Logs.
    Place the half logs into the world and chop it. You'll now be given 2
    Quater Logs. Chop these down even further and you'll have Planks (item).
    A 2x2 pattern with these Planks can be used to craft a Plank Block. You can
    then craft a Workbench
    
    From here you can then craft things like a Stone Pickaxe Head,
    CobbleStone (block) and any other 3x3 crafting pattern 
    
    
    Step 5 - CampFire
    ---------------------
    Probably by now, its getting dark. So, craft a campfire using
    cobblestone (Item) like so:
    [c][c][c]
    [c][ ][c]
    [c][c][c]
    
    Grab the Campfire and place it on the ground somewhere. You can
    use a campfire to cook food. It can also be used to smelt copper and tin
    into bronze. You can also heat up quarter logs to make charcoal. Quarter logs
    can also be used as a 'fuel' for the fire.
    
    Campfires are also a very good light source (a little brighter than a torch).
    Fuel will also last twice as long as they would in a furnace, however, items take
    twice as long to cook too. Iron Ore or Gold Ore cannot be smelted in a campfire.
    
    I recommend cooking up some quarter logs for charcoal, as you can then make
    torches. This is also the only way to get Coal, as you'll need a Bronze Pickaxe to
    mine for Coal.
    
    
    
    Step 6 - Bronze
    -------------------
    By now, you may have found some new ores and may have guessed that they are in 
    fact Copper (orange) and Tin (grey). Mine these with ANY Pickaxe and you will get their ores.
    You can cook these seperately in a campfire to get an ingot of that material. OR you can craft
    the two ores together (1 by 1, shapeless) to put them together. Then smelt the two together and
    you will then get bronze Ingots. You can also put copper and tin ingots together to smelt bronze
    that way.
    
    You can then start making Bronze tool heads and put them in a crafting grid with a stick.
    You will then get Bronze Tools, which you can use a Bronze Pickaxe to get Iron.
    
    Step 7 - Iron
    -----------------
    I probably will not need to explain this. Getting an iron ingot is done by the usual way of
    smelting it inside a Furnace (NOT a campfire). Iron Tools are then made by making the Tool heads and
    putting them on a stick.
    
    You can also make an Iron Rod. Simple place a stick in a crafting grid, with 1 Iron Ingot on top
    and another Iron Ingot on the bottom.
    
    [i]
    [/]	[/ = stick, I = Iron Ingot]
    [i]
    
    Iron Rods can be used to make Iron Tools with the Iron rod.
    
    Step 8 - Gold
    -----------------
    Same as Iron. Expect you cannot make Gold Tools. However you can make a Gold Rod, which can then
    be used with Iron Tool heads. Try it and see the result 
    
    
    
    Step 9 - Have Fun and keep checking for updates
    ---------------------------------------------------
    Play around a see what you can find out for yourself or you can have a look at the Items in 
    the Creative Game Mode to see what could be made.
    
    I hope this small guide has helped you to get started with the mod. More features of the mod
    will be added in the future, so do check the Forum Thread to keep updated.
    
    

     

     

    In/Compatibility List

    If you have tried and tested with mod with other mods and it either works or it doesn't, post the name of the mod here. If others agree that it works then I'll add it here. I'll have some sort of a traffic light system on the list, which states which mod work and doesn't. So if a mod is not on the list, then it doesn't necessarily means it does (not) work.

    (Red = Incompatible | Green = Compatible | Orange = Works with MCG, but has some issues)

     

     


     

     

  6. Well for your Gold Ore example, what I suggest you do is generate stone where there are Gold Ores and then regenerate the Gold Ores to your specifications (like 32+ Y). Although, that depends if user generated ores/blocks are called after the vanilla blocks.

     

    That might be the clumsy and messy method you've mentioned, but its a way that can work without touching any Vanilla classes, which is always a plus.

  7. Just one small issue with that one: It will only find the first one, because it stops at the "return" statement.

     

    I think that was the whole point of that piece of code, but you can just simply change the return statement to do what ever you want it to do. You could return a whole List/Array of the blocks or just an Integer (

    int

    ), which returns the amount of the blocks it can find with the same Block ID. There is so much you can do with that little function :D

  8. There are a few tutorial series knocking around in the MC Forums at the Tutorials section. Here are a few links:

     

    MC Forums Tutorials Section

    deverions forge modding tutorials (MC forum topic)

    freezzerrr's Video tutorials (MC forum topic)

     

    In my view, modding MC isn't like modding some other games out there which have their own 'construction kits' or some sort of third party program to just add things here and there. To mod MC you need to know the basics in programming in order to mod MC, especially Object Oriented Programming, as Java is a OO-Programming language. Programming can be a difficult subject for some/most people and some may get the grasps of it quicker than others. But knowing even the basics will go a long way. Just remember it takes practice, experimenting and a regular supply of a cup of tea.

     

    I'd love to start my own Tutorial series, as I'd like to chip in to the community with a few things that I know. Perhaps I could help to beef up the wiki a bit, but before I do that I'd like to get at least 1 or 2 mods out.

     

    Anyway, I hope those links help. :)

  9. I'm not sure if this is a bug or I'm (most likely) failing and doing it wrong. So I'll post just it here as a 'Help!' topic :)

     

    When I use the ICraftingHandler's onCrafting method, it gets called twice. Here is the code:

     

    The Client Proxy Class, registering the MCGCraftingHandler class.

    public class MCGClientProxy extends MCGCommonProxy {
    
    @Override
    public void registerRenderInformation() {
    	MCG mcg = new MCG();
    
    	GameRegistry.registerCraftingHandler(new MCGCraftingHandler());
    
    	KeyBindingRegistry.registerKeyBinding(new MCGKeyHandler(mcg));
    	TickRegistry.registerTickHandler(mcg, Side.CLIENT);
    }
    
    }
    

    The CraftingHandler Class implementing the ICraftingHandler interface

    public class MCGCraftingHandler implements ICraftingHandler {
    
    @Override
    public void onCrafting(EntityPlayer player, ItemStack item,
    		IInventory craftMatrix) {
    	System.out.println("Crafted");
    
    }
    
    @Override
    public void onSmelting(EntityPlayer player, ItemStack item) {
    	System.out.println("Smelted");
    
    }
    }
    

     

    As you may be able to see, the methods just displaying some text on the console and it should only do this once. However, after crafting (and smelting) I get the messages twice.

     

    (I also have a MCGLoader class which has the @mod annotation, which calls the ClientProxy's registerRenderInformation())

     

    Now I'm pretty sure I am doing something wrong here (but the methods work?). I first tried implementing the ICraftingHandler in the MCG class, as that is my 'main' class where I place all of the main code in there. That initially came out with the same result. I then created the Handler class and same result.

     

    At the time I've come across this I was using the 200 build. I did (about half an ago?) update to the latest build at the time (225) and the same thing has happened.

     

    I also saw the FML's ModLoaderCraftingHelper class, but I have a feeling I'll need to implement the BaseModProxy Interface somewhere (?). However, that is also implementing the ICraftingHandler so I guess I'll get the same result.

     

    If I am doing it wrong, please tell me how and I'll fix it. If it is a bug, then I'll live with it (I'll also be glad I'm doing it right).

     

    Thanks for reading.

  10. Hello.

     

    I'm not sure about adding a new texture on the HUD, but I did manage to place a string/text on the screen.

     

    Follow the Ticking example on the wiki. This a very handy thing to know/have if you want to add things that require constant updates. Once you have that ready, add this in the onRenderTick() Method:

     

    FMLClientHandler.instance().getClient().fontRenderer.drawStringWithShadow(displayText(String), x(int), y(int), color(int));

     

    Bare in mind this could be tidied up, but this was just from a quick test I've just done a few minutes ago. Obviously, don't forget to change the displayText(String) to a string and x,y & color to a number. For example:

    FMLClientHandler.instance().getClient().fontRenderer.drawStringWithShadow("Hello World!", 0, 0, 16777215));

     

    There is also a drawString method with the same parameters, just that it displays the text with no shadow.

     

    The color parameter is an Integer and I'm uncertain how that works (although I am going to find out). However, I did find (somewhere buried deep in the files and I can't remember where) this value: 16777215 and this seems to give the same white color as the other texts

     

    The Color parameter is the Hex color value (eg FF0000) converted into Decimal.

     

    For the textures look how Minecraft displays the GUI elements (Inventory bar, health bar etc). I know things can be difficult with all over the unnamed variables (var1..var2), but if you're using Eclipse you can just highlight the variable name and all off the references highlight also so you can just follow where the variables lead. Sometimes you might see a named variable, which is a nice treat.

     

    I hope this helps. Any questions just ask.

  11. Okay. After a spark of insipration (and a night sleep), I think I've done it. The idea of it was to use a tick method and basically have a boolean flag indicating if a world has be loaded.

     

    How I did was I made myself a TickHandler class using the example on the wiki. I then just made the boolean variable and checked it along with checking the MC.theWorld whether it is null.

     

    The code for what I've done is below if anyone is curious. The key methods are the OnTickInGame() and the OnTickInGUI(). I've also added an Unload method while I was at it.

     

    public class MyTickHandler implements ITickHandler {
    
    boolean isLoaded = false;
    
    @Override
    public void tickStart(EnumSet<TickType> type, Object... tickData) { }
    
    @Override
    public void tickEnd(EnumSet<TickType> type, Object... tickData) {
    	GuiScreen guiscreen = Minecraft.getMinecraft().currentScreen;
            	if (guiscreen != null) {
                    	onTickInGUI(guiscreen);
            } else {
            	        onTickInGame();
            }	
    }
    
    @Override
    public EnumSet<TickType> ticks() {
    	EnumSet<TickType> wantedTicks = EnumSet.of(TickType.CLIENT);
            	wantedTicks.add(TickType.CLIENTGUI);
            return wantedTicks;
    }
    
    @Override
    public String getLabel() {
    	return null;
    }
    
    public void onTickInGame() {
    
    	if(!isLoaded && FMLClientHandler.instance().getClient().theWorld != null)
    	{
    		isLoaded = true;
    		onLoad();
    		System.out.println("World loaded: " + isLoaded);
    	}
    
    }
    
    public void onTickInGUI(GuiScreen guiscreen) {
    
    	if (isLoaded && FMLClientHandler.instance().getClient().theWorld == null)
    	{
    		isLoaded = false;
    		onUnload();
    		System.out.println("World loaded: " + isLoaded);
    	}
    }
    public void onLoad() { }
    
    public void onUnload() { }
    
    }
    

     

    The code might need some tweaking, so if anyone has any ideas then please say so. Also does anyone mind if I add this to the wiki? If so then where do you want it?

     

    Hope this helps for others. :)

  12. I was wondering if there was an OnLoad event/method anywhere for when the player loads a new/saved world. For example, once the user enters a world, an 'onLoad' method or similar is called. I've been looking around the files and had no luck. So I thought I'd better ask here, just in case I've missed it.

     

    If not, is there any way of adding one myself or at least a work around? I have a feeling it'll need one of the orginal classes to do so. I'd rather not edit any orginal classes, as that'll obviously decrease the chances of mod compatibility with other mods.

     

    I did try the Load event class inside the World class, but had no luck with that. I also tried the IPlayerTracker Interface and tried that with little luck. Unless i'm missing something or doing something wrong with them.

     

    The reason I ask is I want to trigger some code once a world has been loaded or when the player has entered the world. Just so I could do some GUI changes and perhaps a welcome message and things once the game starts, but also avoid editing orginal classes as much as possible. Maybe there is another way of doing this?

     

    Thanks in advance. :)

×
×
  • Create New...

Important Information

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