• 0

    posted a message on Replace/Disable/Edit Vanilla Block (Minor requirement)
    Alright, so I've got some working code for a the block break event, but I was wondering if anyone knew of a better way to do this? I just poked around the classes and found stuff that I thought might work. Please let me know if this is horribly inefficient or way less of a pain than I made it.

    What this does is it detect wen a player is breaking an iron ore block, and as long as they're using a pickaxe without silktouch it will add xp to the drop. The main thing I'm wondering about is the NBTTagList. This seems like a hacky way of finding out if the tool has silktouch on it.


    @SubscribeEvent
    public void breakEventHandler(BreakEvent event){
      if (event.block != null && ((Block)event.block).getUnlocalizedName().equals("tile.oreIron")) {
       EntityPlayer player = event.getPlayer();
       Item tool = player.inventory.getCurrentItem().getItem();
          if (ForgeHooks.canHarvestBlock(event.block, player, event.blockMetadata) && tool instanceof ItemPickaxe) {
           NBTTagList tagList=player.getCurrentEquippedItem().getEnchantmentTagList();
           boolean dropXP=true;
           if(tagList!=null){
            for(int i=0,l=tagList.tagCount();i<l;i++){
             /*
              Fortune 3 {id:35s,lvl:3s,}
              Silk Touch 1 {id:33s,lvl:1s,}
             */
             if(tagList.getStringTagAt(i).contains("id:33s")){
              dropXP=false;
              break;//for loop
             }
            }
           }
           if(dropXP){
            event.setExpToDrop(rand.nextInt(Iron_Deposit.maxXP - Iron_Deposit.minXP + 1)+Iron_Deposit.minXP);
           }
          }
      }
    }

    Posted in: Modification Development
  • 0

    posted a message on Replace/Disable/Edit Vanilla Block (Minor requirement)
    Ah, got into the event finally. I was missing this.

    MinecraftForge.EVENT_BUS.register(new EventHandler());


    I added it to my "init" method, and I (correctly?) assumed that the "new EventHandler()" was an instance of whatever class I have my subscribing event handlers in.
    Posted in: Modification Development
  • 0

    posted a message on Replace/Disable/Edit Vanilla Block (Minor requirement)
    So, I've tried the HarvestDropsEvent and the BreakEvent but these don't seem to be doing the trick. Are these events correct for catching the Iron Ore block getting broken/harvested?
    Posted in: Modification Development
  • 0

    posted a message on Replace/Disable/Edit Vanilla Block (Minor requirement)
    Not to be a necromancer, but this topic exactly matches what I want to do and only seems to have a pre-1.7.2 answer.

    So, I've got a custom replacement block all set up. Looks exactly like iron, behaves exactly like iron, but it drops the item I want (custom gem style ore rather than the iron ore block). How can I get minecraft to use my custom iron ore block instead of the base?

    1.) Replace it in the GameRegistry when the mod is loaded?
    2.) Make a custom chunk generator that uses my iron instead of the vanilla iron?

    Thanks!
    Posted in: Modification Development
  • 0

    posted a message on 1.7.2 Texture Issue
    Quote from master801

    Something like this? I don't really know since I haven't jumped into 1.7 yet.
    getIconsFromDamage(int damage)


    That's it! getIconsFromDamage instead of getIcon.

    Thanks for the help everyone! :)
    Posted in: Modification Development
  • 0

    posted a message on 1.7.2 Texture Issue
    Alright, I have a partial solution, but it will only work for single texture items. If the full path name, including the texture file is in lower case, then .setTextureName will work. But, .registerIcons and .getIcon still do not find the texture.

    /assets/wwugeneralmod/textures/items/ironore.png <-> iron_ore.setTextureName("WWUGeneralMod:ironOre");

    So, what do I need to do to get this working with .registerIcons and .getIcon so I can use multiple textures on an item (using damage based metadata)?
    Posted in: Modification Development
  • 0

    posted a message on 1.7.2 Texture Issue
    In general I prefer to avoid chaining method calls like that. It makes no difference to the bytecode compiler but makes for a readability mess in the IDE.

    I added the getIcon method to my Iron_Ore.java class, but I had to change the return type as eclipse couldn't find an Icon class in the packages made available by forge, just java swing stuff. I added this:

    public IIcon getIcon(int side, int meta){
    return this.icon;
    }

    Unfortunately this didn't change the behavior. No icon still. Does it need any annotations?

    Second, I tried removing the registerIcons() method from Iron_Ore.java and used the setTextureName() method in my preInit handler, but this also had no effect.

    As far as the assets system goes, in the path name, should the MODID have identical case or should it all be lower case? Is it a bug that the lang files are found by Forge regardless of case while the textures require a specific case???
    Posted in: Modification Development
  • 0

    posted a message on 1.7.2 Texture Issue
    My original path is assets\wwugeneralmod\textures\items\ironOre.png

    When I make the path case match the modid case (assets\WWUGeneralMod\textures\items\ironOre.png) I get the following error:
    Using missing texture, unable to load wwugeneralmod:textures/items/ironOre.png
    java.io.FileNotFoundException: wwugeneralmod:textures/items/ironOre.png

    When I use all lowercase in the actual path name, I don't get the error.

    The lang file seems to be found either way.
    Posted in: Modification Development
  • 0

    posted a message on 1.7.2 Texture Issue
    I forgot to mention, I'm not getting any error messages in the eclipse console other than the normal "you are in a development environment or something is very wrong" errors.

    My item is showing up in the creative tab and it's properly grabbing the name from en_US.lang. Sadly it's got the pink/black fail texture and not the texture in assets.wwugeneralmod.textures.items.

    As an aside, does anyone know how to edit the tags on a topic? I used the wrong delimiter and created a single useless tag. :steve_joyous:
    Posted in: Modification Development
  • 0

    posted a message on Need help with starting a MTG "Magic The Gathering" Mod
    No offense intended, but I'm sure most people here have mods that they would love everyone to help them with for free. You'll likely need to show some development effort on your part to get people excited about helping you. Like you mentioned, there are tons of tasks involved with developing. Pick one as a starting point and dive in! There's nothing like getting your hands dirty when it comes to game development. ;)
    Posted in: Mods Discussion
  • 0

    posted a message on 1.7.2 Texture Issue
    I'm new to mod development though I'm not new to Java. I'm having trouble getting textures to show up, specifically an item texture. I've done a lot of reading and I'm just not catching what's wrong. Any help would be greatly appreciated.

    Iron_Ore.java
    package com.whichwaysup.minecraft.items;
    import com.whichwaysup.minecraft.Config;
    import net.minecraft.client.renderer.texture.IIconRegister;
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.item.Item;
    import net.minecraft.util.IIcon;
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    public class Iron_Ore extends Item {
    
    public static String unlocalizedName="ironOre";
    public Iron_Ore() {
    super();
    }
    
    @SideOnly(Side.CLIENT)
    private IIcon icon;
    
    @SideOnly(Side.CLIENT)
    @Override
    public void registerIcons(IIconRegister iconRegister){
    this.icon=iconRegister.registerIcon(Config.MODID + ":" + unlocalizedName);
    }
    }

    Main Mod File
    package com.whichwaysup.minecraft;
    import com.whichwaysup.minecraft.items.Iron_Ore;
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.item.Item;
    import import cpw.mods.fml.common.Mod;
    import cpw.mods.fml.common.Mod.EventHandler;
    import cpw.mods.fml.common.Mod.Instance;
    import cpw.mods.fml.common.SidedProxy;
    import cpw.mods.fml.common.event.FMLInitializationEvent;
    import cpw.mods.fml.common.event.FMLPostInitializationEvent;
    import cpw.mods.fml.common.event.FMLPreInitializationEvent;
    import cpw.mods.fml.common.registry.GameRegistry;
    @Mod(modid = Config.MODID, name = Config.MODNAME, version = Config.VERSION)
    public class mod_WWUTest {
    
    @Instance(Config.MODID)
    public static mod_WWUTest instance;
    
    @SidedProxy(clientSide="com.whichwaysup.minecraft.ClientProxyAxeBlock", serverSide="com.whichwaysup.minecraft.WWUCommonProxy")
    public static WWUCommonProxy proxy;
    
    public static Item iron_ore;
    
    
    @EventHandler
    public void preInit(FMLPreInitializationEvent event){
    iron_ore = new Iron_Ore();
    iron_ore.setUnlocalizedName(Iron_Ore.unlocalizedName);
    iron_ore.setCreativeTab(CreativeTabs.tabMaterials);
    GameRegistry.registerItem(iron_ore,Iron_Ore.unlocalizedName);
    }
    
    @EventHandler
    public void init(FMLInitializationEvent event){
    }
    
    @EventHandler
    public void postInit(FMLPostInitializationEvent event){
    
    }
    }

    Config File
    package com.whichwaysup.minecraft;
    public class Config {
    public static final String MODID="WWUGeneralMod";
    public static final String MODNAME="General Mod";
    public static final String VERSION="1.0";
    }

    en_US.lang
    item.ironOre.name=Iron Ore

    Project Structure
    >Minecraft
    >src/main/java
    	 >com.whichwaysup.minecraft
    		 >Config.java
    		 >mod_WWUTest.java
    	 >com.whichwaysup.minecraft.items
    		 >Iron_Ore.java
    >src/main/resources
    	 >assets.wwugeneralmod.lang
    		 >en_US.lang
    	 >assets.wwugeneralmod.textures.items
    		 >ironOre.png
    Posted in: Modification Development
  • 0

    posted a message on [MC 1.12.x] Minecraft Comes Alive v6.0.0 (MILLIONS OF PLAYERS!)
    Hehehehe, Well, I guess I missed that part in the instructions. Thanks for the fast reply and for being psychic! 8D
    Posted in: Minecraft Mods
  • 0

    posted a message on [MC 1.12.x] Minecraft Comes Alive v6.0.0 (MILLIONS OF PLAYERS!)
    This mod looks awesome. I can't wait to try it out, but I'm having trouble installing. I've followed the video directions exactly but I'm getting some errors. It also looks like others are having this issue.

    http://www.minecraftforum.net/topic/2730890-i-need-help-with-minecraft-comes-alive-modmca/

    Please help! I'd love to use this mod in my game!
    Posted in: Minecraft Mods
  • 0

    posted a message on I need help with Minecraft comes Alive mod(MCA)
    Bump, I'm having the exact same issue.
    Posted in: Java Edition Support
  • To post a comment, please or register a new account.