• 0

    posted a message on When I use setBlock, textures don't update?
    So I have a bush block which I right-click and it gives me my item. That's all fine, but I've told it that once it has been clicked, change to another block (in this case, the empty version of the bush), that works but the texture doesn't change until there is a block update next to it. Do I need to turn this into a TileEntity (it's not my first choice as I find them difficult) or can I do something to force a block update?

    Bush class:

    package com.cydial.candyland.blocks;
    
    import java.util.Random;
    
    import net.minecraft.block.Block;
    import net.minecraft.block.material.Material;
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.entity.item.EntityItem;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.item.ItemStack;
    import net.minecraft.world.World;
    import net.minecraftforge.common.util.FakePlayer;
    
    import com.cydial.candyland.Main;
    
    public class BlockCandyBush extends Block
    {
    public BlockCandyBush(Material material)
    {
    super(material);
    
    this.setHardness(0.1F);
    this.setBlockTextureName(Main.MODID + ":candyBush");
    this.setBlockName("BlockCandyBush");
    this.setCreativeTab(CreativeTabs.tabBlock);
    this.setStepSound(Block.soundTypeGrass);
    this.opaque = false;
    }
    
    public Block getBlockDropped(int metadata, Random random, int fortune)
    {
    return Main.BlockCandyBushEmpty;
    }
    
    @Override
    public int quantityDropped(Random random)
    {
    return 1;
    }
    
    public boolean isOpaqueCube()
    {
    return false;
    }
    
    @Override
    public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
    {
    world.setBlock(x, y, z, this);
    spawnItemAtPlayer(player, new ItemStack(Main.ItemCandyCane));
    world.setBlock(x, y, z, Main.BlockCandyBushEmpty, 0, 0); //set the bush to the empty version
    Block below = world.getBlock(x, y - 1, z); //get the block below the bush
    world.setBlock(x, y - 1, z, below, 0, 0); //set it to itself (should cause a block update
    return true;
    }
    
    public static void spawnItemAtPlayer (EntityPlayer player, ItemStack stack)
    {
    if (!player.worldObj.isRemote)
    {
    EntityItem entityitem = new EntityItem(player.worldObj, player.posX + 0.5D, player.posY + 0.5D, player.posZ + 0.5D, stack);
    player.worldObj.spawnEntityInWorld(entityitem);
    if (!(player instanceof FakePlayer))
    entityitem.onCollideWithPlayer(player);
    }
    }
    }


    Empty Bush class:

    package com.cydial.candyland.blocks;
     
    import java.util.Random;
    
    import net.minecraft.block.Block;
    import net.minecraft.block.material.Material;
    import net.minecraft.creativetab.CreativeTabs;
    
    import com.cydial.candyland.Main;
    
    public class BlockCandyBushEmpty extends Block
    {
    public BlockCandyBushEmpty(Material material)
    {
    super(material);
    
    this.setHardness(0.1F);
    this.setBlockTextureName(Main.MODID + ":candyBushEmpty");
    this.setBlockName("BlockCandyBush");
    this.setCreativeTab(CreativeTabs.tabBlock);
    this.setStepSound(Block.soundTypeGrass);
    this.opaque = false;
    }
    
    public Block getBlockDropped(int metadata, Random random, int fortune)
    {
    return this;
    }
    
    @Override
    public int quantityDropped(Random random)
    {
    return 1;
    }
    
    public boolean isOpaqueCube()
    {
    return false;
    }
    }

    Posted in: Modification Development
  • 0

    posted a message on Creatiing a harvestable bush, need some help? :)
    Quote from Pyroglyph

    now to make it grow and change texture.


    Okay so now I have my candy bush (w/ candy) which changes to the empty bush (no candy) when right-clicked (you also get a candy cane) but do I use tickUpdate or something with a for loop to decide when to make the candy canes grow back? Also, when you right-click a full bush, it doesn't change texture unless there is a block update nearby. Any way to fix this without using a TileEntity? (becuase those are difficult)
    Posted in: Modification Development
  • 0

    posted a message on Creatiing a harvestable bush, need some help? :)
    Quote from master801

    You should have made your item static in the main class where you registered it. Not the actual item class file. :\


    It is static... And anyways I fixed it by importing my main class and not the Item class itself (becasue I registered the item in the Main class) but now is the problem of making the berries grow. I have already tested the rightclick thing and it works, now to make it grow and change texture.
    Posted in: Modification Development
  • 0

    posted a message on Creatiing a harvestable bush, need some help? :)
    Okay
    Quote from master801

    You should really look before questioning.

    https://github.com/S...eberryBush.java


    Okay I had a look at that and played round with it a bit, but now I'm stuck at this:
    spawnItemAtPlayer(player, new ItemStack(ItemCandyCane));


    Apparently ItemCandyCane "can't be resolved to a variable" even though it's a class and it's not supposed to be a variable. I have tried importing 'com.cydial.candyland.items.*' and 'com.cydial.candyland.items.ItemCandyCane' but none of these work. I also tried to do this:
    spawnItemAtPlayer(player, new ItemStack(com.cydial.candyland.items.ItemCandyCane));
    which didn't work either. Any help?
    Posted in: Modification Development
  • 0

    posted a message on Creatiing a harvestable bush, need some help? :)
    Quote from jabelar

    I think you probably want to consider this a "crop".


    I've already had a look and I think they only cover what block it can be placed on (might be handy) and to get the candycanes from it requires you to destroy it. Which I don't want. I want the bush to stay there, but with a different texture (a bush without the candy) that's why I suggested TileEntity.
    Posted in: Modification Development
  • 0

    posted a message on Creatiing a harvestable bush, need some help? :)
    Okay so my mod adds lots of candy to the game. What I want is a block which you can right-click and you get some candy canes. After a while the candy canes will grow back. I think I need a TileEntity (because I need 2 different textures kinda like a furnace) but I have never worked with them before.
    I've made the block and the textures so all I need is some guidance!
    Hope you can help, and if you do thank you :)

    BlockCandyBush.java:

    package com.cydial.candyland.blocks;
    
    import java.util.Random;
    import net.minecraft.block.Block;
    import net.minecraft.block.material.Material;
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.item.Item;
    import net.minecraft.world.IBlockAccess;
    import com.cydial.candyland.Main;
    
    public class BlockCandyBush extends Block
    {
    public BlockCandyBush(Material material)
    {
    super(material);
    
    this.setHardness(0.1F);
    this.setBlockTextureName(Main.MODID + ":candyBush");
    this.setBlockName("BlockCandyBush");
    this.setCreativeTab(CreativeTabs.tabBlock);
    this.setStepSound(Block.soundTypeGrass);
    this.opaque = false;
    }
    
    @Override
    public Item getItemDropped(int metadata, Random random, int fortune)
    {
    return com.cydial.candyland.Main.ItemCandyCane;
    }
    
    @Override
    public int quantityDropped(Random random)
    {
    return 4;
    }
    
    public boolean isOpaqueCube()
    {
    return false;
    }
    }

    Posted in: Modification Development
  • 0

    posted a message on Great mod idea! Need coders
    Quote from caagr98

    How about saying something about the idea?


    Yes, we would like to actually know about the idea before we can start doing it.
    Posted in: Mods Discussion
  • 0

    posted a message on Other mod compatibility/integration with my mod?
    You know what? I don't think I'm ready for a challenge of mod integration yet. I think I'll stick with the simpler stuff for now.

    Thank you all so much for your time and help! You have helped me gain a better understanding of Java, and therefore, the universe (to a certain extent).

    I bid you goodbye on this topic and I wish you well on all of your adventures!

    Ciao!

    ~Pyro
    Posted in: Modification Development
  • 0

    posted a message on Other mod compatibility/integration with my mod?
    Quote from coolAlias

    Maybe, you did say you were using an experimental version, which in my experience are certainly not guaranteed to even compile depending on how the author(s) set up their code system.

    Core mods are really a pain to work with, even when you get all the versions to match.


    Yes, I did wonder about the experimental version. And I read your API tutorial so I know coremods are a pain. I didn't realise it was a coremod but come to think of it, I did see some packages like 'ic2.core' but I thought that was just a baseplate for the mod author to build around when updates came about.
    Posted in: Modification Development
  • 0

    posted a message on Other mod compatibility/integration with my mod?
    Thanks, I added IC2 to that mods folder and now I get this error:


    [22:21:21] [main/WARN] [FML]: The coremod ic2.core.coremod.IC2core does not have a MCVersion annotation, it may cause issues with this version of Minecraft
    java.lang.NoSuchMethodError: cpw.mods.fml.relauncher.FMLRelaunchLog.makeLog(Ljava/lang/String;)V
    at ic2.core.coremod.IC2core.<init>(IC2core.java:11)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    at cpw.mods.fml.relauncher.CoreModManager.loadCoreMod(CoreModManager.java:424)
    at cpw.mods.fml.relauncher.CoreModManager.discoverCoreMods(CoreModManager.java:312)
    at cpw.mods.fml.relauncher.CoreModManager.handleLaunch(CoreModManager.java:214)
    at cpw.mods.fml.relauncher.FMLLaunchHandler.setupHome(FMLLaunchHandler.java:90)
    at cpw.mods.fml.relauncher.FMLLaunchHandler.setupClient(FMLLaunchHandler.java:67)
    at cpw.mods.fml.relauncher.FMLLaunchHandler.configureForClientLaunch(FMLLaunchHandler.java:34)
    at cpw.mods.fml.common.launcher.FMLTweaker.injectIntoClassLoader(FMLTweaker.java:112)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:114)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    
    [22:21:21] [main/ERROR] [FML]: An error occurred trying to configure the minecraft home at C:\Users\Pyroglyph\Desktop\modding\eclipse\. for Forge Mod Loader
    java.lang.NoSuchMethodError: cpw.mods.fml.relauncher.FMLRelaunchLog.makeLog(Ljava/lang/String;)V
    at ic2.core.coremod.IC2core.<init>(IC2core.java:11) ~[industrialcraft-2_2.0.386-experimental.jar:?]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.7.0_55]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.7.0_55]
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.7.0_55]
    at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.7.0_55]
    at java.lang.Class.newInstance(Unknown Source) ~[?:1.7.0_55]
    at cpw.mods.fml.relauncher.CoreModManager.loadCoreMod(CoreModManager.java:424) ~[forgeSrc-1.7.2-10.12.1.1060.jar:?]
    at cpw.mods.fml.relauncher.CoreModManager.discoverCoreMods(CoreModManager.java:312) ~[forgeSrc-1.7.2-10.12.1.1060.jar:?]
    at cpw.mods.fml.relauncher.CoreModManager.handleLaunch(CoreModManager.java:214) ~[forgeSrc-1.7.2-10.12.1.1060.jar:?]
    at cpw.mods.fml.relauncher.FMLLaunchHandler.setupHome(FMLLaunchHandler.java:90) [forgeSrc-1.7.2-10.12.1.1060.jar:?]
    at cpw.mods.fml.relauncher.FMLLaunchHandler.setupClient(FMLLaunchHandler.java:67) [forgeSrc-1.7.2-10.12.1.1060.jar:?]
    at cpw.mods.fml.relauncher.FMLLaunchHandler.configureForClientLaunch(FMLLaunchHandler.java:34) [forgeSrc-1.7.2-10.12.1.1060.jar:?]
    at cpw.mods.fml.common.launcher.FMLTweaker.injectIntoClassLoader(FMLTweaker.java:112) [forgeSrc-1.7.2-10.12.1.1060.jar:?]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:114) [launchwrapper-1.9.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]
    
    Exception in thread "main" java.lang.NoSuchMethodError: cpw.mods.fml.relauncher.FMLRelaunchLog.makeLog(Ljava/lang/String;)V
    at ic2.core.coremod.IC2core.<init>(IC2core.java:11)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    at cpw.mods.fml.relauncher.CoreModManager.loadCoreMod(CoreModManager.java:424)
    at cpw.mods.fml.relauncher.CoreModManager.discoverCoreMods(CoreModManager.java:312)
    at cpw.mods.fml.relauncher.CoreModManager.handleLaunch(CoreModManager.java:214)
    at cpw.mods.fml.relauncher.FMLLaunchHandler.setupHome(FMLLaunchHandler.java:90)
    at cpw.mods.fml.relauncher.FMLLaunchHandler.setupClient(FMLLaunchHandler.java:67)
    at cpw.mods.fml.relauncher.FMLLaunchHandler.configureForClientLaunch(FMLLaunchHandler.java:34)
    at cpw.mods.fml.common.launcher.FMLTweaker.injectIntoClassLoader(FMLTweaker.java:112)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:114)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)


    I believe it's something to do with a coding error in IC2?
    Posted in: Modification Development
  • 0

    posted a message on Other mod compatibility/integration with my mod?
    Quote from coolAlias

    if you make it required, then your mod will not be able to load without IC2, effectively making your mod an IC2 extension, and not a standalone mod. If that's what you want to do, no problem, but please be clear about that when you ask :P

    mcmod.info should be in your resources package, and only in that package: "src/main/resources/mcmod.info", for example.


    Okay I didn't think about it like that, maybe I shouldn't make IC2 a dependency. I also have put my mcmod.info into the folder you specified.

    Now I'm using the console to check whether IC2 is loading or not. I've placed the IC2 jar in the mods folder (the mods folder being alongside the src, eclipse and bin folders etc) and it's not even loading when I test Minecraft. Have I put it in the wrong place? I have no idea.
    Posted in: Modification Development
  • 0

    posted a message on Other mod compatibility/integration with my mod?
    Quote from coolAlias

    You can use the following:
    if (Loader.isModLoaded("IC2_modid")) {
    // add recipes
    } else {
    // instantiate clone item
    // add clone recipes
    }


    Btw, you may find my Modding With APIs tutorial helpful.


    Either a] look at the source code (if open source, or peek with JD-GUI, or ask the developers), or b] using the GameRegistry, print all the items out to the console and find the ones you need.


    Thanks for your help, I'll try your isModLoaded code when I can. Also I had a look at it with JD-GUI before looking at this post and found that the ModID was just IC2.

    I'll also take a look at your Modding With APIs as soon as I can :)

    EDIT: One problem is, I can't find the Plantball in the IC2 jar (decompiled in JD-GUI) so I don't know which unlocalized name to use for it. Another problem is that my mcmod is messed up (eclipse said I had an extra one so I deleted the clone and now it says I don't have one) and also I don't know where to put it. And it's not checking if IC2 exists as I can start my Minecraft without IC2 being installed. :( :(
    Posted in: Modification Development
  • 0

    posted a message on Other mod compatibility/integration with my mod?
    Quote from jabelar

    I think you should make sure that your mcmod.info file lists the IC2 as a dependency (you can also check from your mod to ensure that IC2 is actually present) and then just create recipes that use them.


    Okay, so how would I check if IC2 exists? And how would I find it's internal name (ic2 / IC2 / mod_ic2 / mod_IC2 etc etc)? I really have no clue. I normally dabble in C# and can think of a method to check if a file exists but not Java as I'm new to that. Is this the right place to be asking? Am I asking the right questions?
    Posted in: Modification Development
  • 0

    posted a message on Other mod compatibility/integration with my mod?
    Quote from jabelar

    I'm not sure you need the API to use things in the crafting recipes. I think you should make sure that your mcmod.info file lists the IC2 as a dependency (you can also check from your mod to ensure that IC2 is actually present) and then just create recipes that use them.

    For example, I think you can look up items in other mods using the GameRegistry findItem() method where you put in the modid and item name as strings.


    Okay, I was thinking of making it check to see if IC2 was present, and if not, create a clone of the plantball item. Which would be cool. Although the mcmod.info idea sounds easy, it would require people to get it even if they didn't want it (it makes some people lag) so thats where the plantball clone comes from. The clone wouldn't have all the IC2 functions in it as the mod wouldn't be installed, but if it was, the clone wouldn't be implemented. If you catch my drift.

    In case you didn't get that, let me give you some pseudocode:
    if (IC2exists == true)
    {
        //add recipe for ic2 plantball here
    }
    else
    {
        public void Item Plantball = new PlantBallClone();
        //register the textures and lang and stuff
    }
    Posted in: Modification Development
  • 0

    posted a message on Other mod compatibility/integration with my mod?
    Quote from Puredarkness

    I'm fairly sure there's an API or source for IC2. Just check this page here:

    http://ic2api.player...astStableBuild/


    Okay so I have imported the API to my project but can't use the 'import' line to use any of the IC2 things. Eclipse acts like it doesn't exist. No doubt I have either imported it incorrectly or I am missing something blatently obvious.
    Posted in: Modification Development
  • To post a comment, please or register a new account.