Jump to content

MrJPGames

Members
  • Posts

    31
  • Joined

  • Last visited

Posts posted by MrJPGames

  1. Well, you would only call them from your Block class anyways, so there is no problem.

    I don't quite understand what you mean. I could add them to my own block class but I think that wouldn't work correctly, if that is the way could you try to be a little more specific on how to do so!

     

    Here is the code I use for the adding the block:

    public static final Block SapphireBlock = new MT_Block (235, 7).setHardness(2F).setResistance(4F).setStepSound(Block.soundTypeStone).setUnlocalizedName("SapphireBlock").setBlockTextureName("moretools:SapphireBlock");

    Here is the MT_Block file:

    package MoreTools;
    
    import java.util.Random;
    
    import net.minecraftforge.*;
    import net.minecraft.block.Block;
    import net.minecraft.block.material.Material;
    import net.minecraft.creativetab.CreativeTabs;
    public class MT_Block extends Block
    {
        public MT_Block(int par1, int par2)
        {
            super(Material.iron);
            this.setCreativeTab(CreativeTabs.tabBlock);
        }
        
    
    }
    

  2. I was trying to install the SRC for FML 1.8 (FML 7.10.93.1001). But I keep getting this error.

     

    Note: This time I was trying build 1000 just to see if that made a difference but it didn't!

     

    Edit: I used the command "gradlew setupDecompWorkspace" and also tried "gradlew setupDecompWorkspace --refresh-dependencies"

     

    Here is the error (in image form)

    glciF6w.png

  3. I say you have to override getDrops when you extend BlockCrops. That is because BlockCrops overrides getDrops itself to drop the seeds at a random chance. If you want to change that, you HAVE to override getDrops.

    That is true but if you want "true" full control over the block you wouldn't extend BlockCrops now would you?

     

    OK maybe that was the No True Scotsman fallacy... (http://en.wikipedia.org/wiki/No_true_Scotsman)

  4. K thanks for the reply that does seem more useful! I don't have any code for that so I can't send it but I would advice using this method if you need more than 1 type of items to drop though in the case of paprika's you might want only the paprika to drop as the seeds should be simmular to a melon where you can use the crafting table to get them! If you want you can use this code I wrote to test (otherwhise ask the others for further help if needed!):

    public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
        {
                return customGetDropFunction(p_149650_1_);
        }
        
        private Item itemdropped;
        public Item customGetDropFunction(int p_149650_1_){
                //switch statment for the metadata
        switch (p_149650_1_) {
    	    case 5:
                            //sets itemdropped so quantity can be changed latter
    	    	 itemdropped = MT_mod.greenpaprika; //Has to be an Item!
                            //sets the item to drop
    	      	return itemdropped;
    	    case 6:
    	    	 itemdropped = MT_mod.greenpaprika;
    	    	 return itemdropped;
    	    case 7:
    	    	 itemdropped = MT_mod.greenpaprika;
    	    	 return itemdropped;
    	     default:
    	    	 itemdropped = MT_mod.PaprikaSeeds;
    	    	 return itemdropped;
        }
        }
    
        /**
         * Returns the quantity of items to drop on block destruction.
         */
        
        public int quantityDropped(Random p_149745_1_)
        {
        	int quant;
            if (itemdropped == MT_mod.PaprikaSeeds){
                    //Gives only 1 seed (no dupe glitches that way!)
            	quant = 1;
            }else{
                    //Gives min of 1 Paprika and max of 4. Min can be changed by the number before the + the max can be controlled by the number inbetween te () (Which it adds to the number before the + but thats basic math)
            	quant = 1 + p_149745_1_.nextInt(3);
            }
            return quant;
        }
    

  5. That only works if you want it to drop 1 item. If you want more control about your drops, you should override

    getDrops(params)

    .

     

    this only call the functions getDrops (this.func_149865_P() in the case of BlockCrops)

    BTW, I know Java. I atleast know that

    getDrops(params)

    isn't called

    this.func_149865_P()

    in the BlockCrops class...

     

    Good you know such a complicated function name!

     

    But the amount of items is controlled by:

    public int quantityDropped(Random p_149745_1_)

        {

            return 1;

        }

     

    and can easliy be manipulated (depending on metadata!) So that shouldn't be a problem!

     

    Also i could not find a way to specify a drop amount in the getDrops() function I will asume you're right and it is possible with it but just for my informaition could you tell me how to specify such a thing?

  6. As I said. You need to override getDrops.

     

    Just tested the code I sent and it works! YOU DO NOT HAVE TO OVERRIDE getDrops!

     

    If you're stupid enought to still belive so please get of the internet. If you want prove I can post the code I used so you could test it.

     

    Here's reason you don't need getDrops:

    getDrops is a function called within the getItemDropped. the function getItemDropped can not be repleaced as it´s a function Minecraft uses to see which item/block has to be dropped getDrops is a "easy" way of chaning the drop!

     

    If you look at the getItemDropped of the minecraft block BlockCrops:

    public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)

        {

            return p_149650_1_ == 7 ? this.func_149865_P() : this.func_149866_i();

        }

     

    As you can see if you know ANYTHING about java this only call the functions getDrop (this.func_149865_P() in the case of BlockCrops) and this.func_149866_i() is the drop of the seed this function only returns this item, thus it could be used if you want but in this specific case it would only call getDrop() if the metadata was 7 which would be useless this statment could either be changed in the "if statment" in getItemDropped or be replaced with a custom getDrops (which is easier in this case!).

     

    Sorry if you got offended but please check your facts before telling that something will not work is necessary if it's not!

  7. public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)

    {

            return customGetDropFunction(p_149650_1_);

    }

     

    public Item customGetDropFunction(int p_149650_1_){

    if (p_149650_1_ == 5){

      return modfile.greenpaprika;

    }else if (p_149650_1_ == 6){

      return modfile.yellowpaprika;

    }else if (p_149650_1_ == 7){

      return modfile.redpaprika

    }else{

      return modfile.paprikaseeds;

    }

    }

     

    This should work if you replace the Items. What the others are saying is correct as long as the getItemDropped is refering to those functions, this changes that so these functions are in theory not requered anymore.

     

    You should also know how it works from the code but basicly what it does is if the user breaks the crop block it will run the getItemDropped function this function has the metadata as the variable  "p_149650_1_" which you pass to your custom getDrop function which than has if else statements to check the metadata and drop the correct item.

     

    NOTE untested!

  8. Is it just the armor bar rendering, or does the armor not function? If it's just the bar, you can try implementing ISpecialArmor to customize it.

     

    I think that ISpecialArmor should be able to fix it. The armor seems to function as it should it's just the armor bar. After implementing ISpecialArmor I get 3 functions I haven't used before. The bar doesn't show at all (first it only showed with the helmet and incorectly) I think it has to do with everything returning null, or 0 but as I don't know what they should return I can't fix it.

     

    The three functions are:

    ArmorProperties, getArmorDisplay and damageArmor

     

    I think getArmorDisplay should be it so now I would like to know how to implemt this (along side the other one as they make the original function of the armor not work as I have yet to test this after the changes!)

  9. First to Mecblader this is about modding. You CAN NOT do this any more but if you make changes in the code where on startup or world launching you check for an update people can manuly install that update which you made it gives notifications. You can not magicly do this without updating the mod.

     

    And I don't know how to do this as I (like most) add things along side the update to support the newer versions of minecraft! But it can be done and some have done it (though if you can go for auto update not the notifications!)

  10. Not sure but I think you'll actualy have to use something like this:

    public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)

        {

            return p_149650_1_ == 7 ? this.func_149865_P() : item;

        }

     

    where 7 is the metadata of the block and item is the item it should give. Just expland that for the 4 states (not grown, green, yellow, red)

  11. You could try to read the MODINFO file to check for which MC version its for and what mods dependicies it has, that way the tool will be a way noobs (which this is aimed at) can not screw it up to bad!

  12. You should move this to Mod Support!

     

    In eclipse (which I am assuming you use) create a package in the src folder called "src/main/resources" and call it "assets.YOURMODID.textures.blocks" where you replace YOURMODID with suprise your modid! Just add the meteorblock.png file in this package and it shoud load!

     

    (PS If any mod can move this to mod support please DO!)

  13. Thanks for the fast reply, and yes I could make the code simpler but I was only updating (from 1.4.7) to 1.7.10 to play with some friends somewhere next week so I probably will make it work however dirty the code (I didn't do a great job with clean code 1.5 years ago!).

     

    So I changed the Enum code slightly (now uses EnumHelper instead of EnumHelperClient). But it still doesn't work! Here is the code:

    static ArmorMaterial armorOBSIDIAN = EnumHelper.addArmorMaterial("OBSIDIAN",66, new int[]{3, 8, 6, 3}, 30);

     

    Which doesn't look/function much diffrent from your (as far as i can see):

    armorMaterialIMC = EnumHelper.addArmorMaterial("IMC", 33, new int[]{3, 8, 6, 3}, 10);

     

    Yet it still doesn't work properly. I couldn't find any other causes (though maybe I'm just missing them). If you/anyone else needs another more code I would love to suply those. Direct help would be empriciated. FYI I'm curently using MCF : 1.7.10-10.13.0.1179

  14. What he means is that in the getDrops you can check in which state the plant curently is. Somthing like:

     

    public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
    {
    if (p_149650_1_ == stateofgreen){
      return modfile.greenpaprikaitem;
    }
    return null;
    }

    this code will probably not quite work but I hope you can figure it out yourself from here (haven't worked with crops since 1.3)

  15. Ok, so as of recentry I started updating this mod I made about 1 1/2 years ago. It took quite a bit of time but I am incapable of making the armor function. It renders correctly but the little armor icons above the health only show 1 armor piece and only from the helmet!

     

    The Material:

    public static ArmorMaterial armorOBSIDIAN = EnumHelperClient.addArmorMaterial("OBSIDIAN",66, new int[]{3, 8, 6, 3}, 30);

     

    The items in mod file:

    public static final Item helmetObsidian = (new MT_ItemArmor(armorOBSIDIAN, 0, helmetOID)).setUnlocalizedName("helmetObsidian");
        public static final Item plateObsidian = (new MT_ItemArmor(armorOBSIDIAN, 1, chestplateOID)).setUnlocalizedName("chestplateObsidian");
        public static final Item legsObsidian = (new MT_ItemArmor(armorOBSIDIAN, 2, legsOID)).setUnlocalizedName("leggingsObsidian");
        public static final Item bootsObsidian = (new MT_ItemArmor(armorOBSIDIAN, 3, bootsOID)).setUnlocalizedName("bootsObsidian");
        

     

    MT_ItemArmor:

    package MoreTools;
    
    import net.minecraft.client.renderer.texture.IIconRegister;
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.entity.Entity;
    import net.minecraft.item.ItemArmor;
    import net.minecraft.item.ItemStack;
    
    public class MT_ItemArmor extends ItemArmor{
    
    public MT_ItemArmor(ArmorMaterial material, int placement, int id) {
    	super(MT_mod.armorCOPPER, id, placement);
    	setCreativeTab(CreativeTabs.tabCombat);
    }
    
    public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type){
    	if (stack.getItem() == MT_mod.helmetCopper || stack.getItem() == MT_mod.plateCopper || stack.getItem() == MT_mod.bootsCopper){
    		return "moretools:textures/models/armor/Copper_1.png";
    	}
    	if (stack.getItem() == MT_mod.legsCopper){
    		return "moretools:textures/models/armor/Copper_2.png";
    	}
    	if (stack.getItem() == MT_mod.helmetEmerald || stack.getItem() == MT_mod.plateEmerald || stack.getItem() == MT_mod.bootEmerald){
    		return "moretools:textures/models/armor/Emerald_1.png";
    	}
    	if (stack.getItem() == MT_mod.legsEmerald){
    		return "moretools:textures/models/armor/Emerald_2.png";
    	}
    	if (stack.getItem() == MT_mod.helmetNetherDiamond || stack.getItem() == MT_mod.plateNetherDiamond || stack.getItem() == MT_mod.bootNetherDiamond){
    		return "moretools:textures/models/armor/NetherDiamond_1.png";
    	}
    	if (stack.getItem() == MT_mod.legsNetherDiamond){
    		return "moretools:textures/models/armor/NetherDiamond_2.png";
    	}
    	if (stack.getItem() == MT_mod.helmetObsidian || stack.getItem() == MT_mod.plateObsidian || stack.getItem() == MT_mod.bootsObsidian){
    		return "moretools:textures/models/armor/Obsidian_1.png";
    	}
    	if (stack.getItem() == MT_mod.legsObsidian){
    		return "moretools:textures/models/armor/Obsidian_2.png";
    	}
    	if (stack.getItem() == MT_mod.helmetRuby || stack.getItem() == MT_mod.plateRuby || stack.getItem() == MT_mod.bootsRuby){
    		return "moretools:textures/models/armor/Ruby_1.png";
    	}
    	if (stack.getItem() == MT_mod.legsRuby){
    		return "moretools:textures/models/armor/Ruby_2.png";
    	}
    	if (stack.getItem() == MT_mod.helmetSandstone || stack.getItem() == MT_mod.plateSandstone || stack.getItem() == MT_mod.bootSandstone){
    		return "moretools:textures/models/armor/Sandstone_1.png";
    	}
    	if (stack.getItem() == MT_mod.legsSandstone){
    		return "moretools:textures/models/armor/Sandstone_2.png";
    	}
    	if (stack.getItem() == MT_mod.helmetSapphire || stack.getItem() == MT_mod.plateSapphire || stack.getItem() == MT_mod.bootSapphire){
    		return "moretools:textures/models/armor/Sapphire_1.png";
    	}
    	if (stack.getItem() == MT_mod.legsSapphire){
    		return "moretools:textures/models/armor/Sapphire_2.png";
    	}
    	if (stack.getItem() == MT_mod.helmetSteel || stack.getItem() == MT_mod.plateSteel || stack.getItem() == MT_mod.bootsSteel){
    		return "moretools:textures/models/armor/Steel_1.png";
    	}
    	if (stack.getItem() == MT_mod.legsSteel){
    		return "moretools:textures/models/armor/Steel_2.png";
    	}
    	return null;
    }
    @Override
        public void registerIcons(IIconRegister par1IconRegister)
        {
        	this.itemIcon = par1IconRegister.registerIcon("moretools:" + this.getUnlocalizedName().substring(5));
        }
    }

     

    Does someone know how to make the armor function properly?!

  16. He, I am trying to make a biome and evrything is fine but I can't find a way to use the biomedecorator. There all made private wich is not the case with modloader from wich are good tutorials on how to use this. I wanted to know how I could use the biomedecorator in forge. Or if that even exsists.

     

    Code from MFL_BiomeGenFlowerForest:

     

     

    package MoreFlowers;
    
    import java.util.Random;
    import net.minecraft.src.*;
    
    public class MFL_BiomeGenFlowerForest extends BiomeGenBase
    {
        public MFL_BiomeGenFlowerForest(int par1)
        {
            super(par1);
            this.spawnableCreatureList.add(new SpawnListEntry(EntityWolf.class, 5, 4, 4));
            this.theBiomeDecorator.treesPerChunk = 10;// this is blocked because of a protect statment in BiomeGenBase that is only on forge
            this.theBiomeDecorator.grassPerChunk = 2;// this is blocked because of a protect statment in BiomeGenBase that is only on forge
            this.theBiomeDecorator.flowersPerChunk = 35; // this is blocked because of a protect statment in BiomeGenBase that is only on forge
        }
    
        public WorldGenerator getRandomWorldGenForTrees(Random par1Random)
        {
            return (WorldGenerator)(par1Random.nextInt(5) == 0 ? this.worldGeneratorForest : (par1Random.nextInt(10) == 0 ? this.worldGeneratorBigTree : this.worldGeneratorTrees));
        }
    }
    
    

     

     

×
×
  • Create New...

Important Information

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