Jump to content

Flockshot

Members
  • Posts

    22
  • Joined

  • Last visited

Posts posted by Flockshot

  1. Okay sorry i fixed that.

    If anyone is having the same problem he can do what i did.

     

    When i built my mod it give me a .jar file.

     

    I just changed the .jar file to .zip file and it worked.

     

    Now how to change .jar to .zip. It is simple

     

    Extract the files form .jar and then archive it.

     

    Well sorry for disturbing guys.

  2. I am facing a very strange problem

     

    I created a armor and it worked perfectly in eclipse.

    But when i built that the texture of the armors were not loading.

     

    Here is my armor class

     

    
    public class BlazeArmor extends ItemArmor {
    
    
    public String TexturePath = Refrence.MODID + ":" + "/textures/armors/" ;
    
    public BlazeArmor(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int part4, String type) {
    
    	super(par1, par2EnumArmorMaterial, par3, part4);
    
    	this.setCreativeTab(CreativeTabs.tabCombat);
    	this.setMaxStackSize(1);
    	this.setTextureName(type, part4);
    
    
    }
    
    
    public void setTextureName( String Type, int part ){
    
    	if( armorType == 0 || armorType == 1 || armorType == 3 ){
    
    		this.TexturePath += "Armor_1.png";
    	}
    
    	else{
    
    		this.TexturePath += "Armor_2.png";
    	}
    
    }
    
    
    
    
    //
    
    public String getArmorTexture( ItemStack itemstack, Entity entity, int slot, int layer){
    
    
    
             return this.TexturePath;
    }
    
    
    @SideOnly(Side.CLIENT)
    
    public void registerIcons(IconRegister register){
    
    	this.itemIcon = register.registerIcon( Refrence.MODID + ":" + this.getUnlocalizedName().substring( 5 ) );
    
    
    }
    
    
    }
    
    
    

  3. To get the data from the ItemStack you need to get the ItemStack first of course. Where do you want that to be? In the players inventory? Somewhere else?

    Well as it is a food item so i wanna check if player has ever eaten this which i am storing in the nbt then on tickhandler i wanna check that if the player has ever eaten that and if true then the process carry on if false than break.

     

    Actually i am trying to make an infinite potioneffect for the food. That can last even after the player die or close the game or drink milk. I will add a new item which will break this process.

  4. As always: It depends™.

    Where does that variable belong to?

    To a Block? Use a TileEntity or metadata (only 4 bits, most likely not enough if you say "variable").

    To an Item? Use the NBTTagCompound attached to every ItemStack.

    To an Entity? Use writeToNBT / readFromNBT or IExtendedEntityProperties in case it is not your entity.

    To a specific world (=dimension)? Use WorldSavedData with World#perWorldStorage.

    To a save file? Use WorldSavedData with World.mapStorage.

    To the Mod in general? Use the Configuration class provided by forge, or just a normal file for more complex data (you can use the normal Java file writing mechanics here).

     

    I want to do it on an food item.

    Can you give an example on how can i do this.

  5. Here is an example well it will add potion effect ressisstence for some seconds when you are holding the specific item.The seconds will not decrease until you dont have that specific item in hand

    Its using ClientTickHandler

     

    see here how to make 1. 

     

    In the video he is using server proxy if you are using client proxy change do it in client proxy.

     

    Then in TickHandler Class add this

     

    
    package com.Flockshot.UltraDaimond.Proxy;
    
    import java.util.EnumSet;
    
    import net.minecraft.block.Block;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.item.ItemStack;
    import net.minecraft.potion.Potion;
    import net.minecraft.potion.PotionEffect;
    import net.minecraft.world.World;
    import cpw.mods.fml.common.ITickHandler;
    import cpw.mods.fml.common.TickType;
    
    public class ClientTickHandler implements ITickHandler {
    
    @Override
    public void tickStart(EnumSet<TickType> type, Object... tickData) {
    
    if(type.equals(EnumSet.of(TickType.PLAYER)))
    {
    
    	onPlayerTick((EntityPlayer) tickData[0]);
    
    }
    
    @Override
    public void tickEnd(EnumSet<TickType> type, Object... tickData) {
    
    
    }
    
    @Override
    public EnumSet<TickType> ticks() {
    
    	return EnumSet.of(TickType.PLAYER, TickType.CLIENT);
    
    }
    
    
    @Override
    public String getLabel() {
    
    	return null;
    }
    
    
    private void onPlayerTick(EntityPlayer player){
    
    	if(player.getCurrentItemOrArmor(0) != null){
    
    		ItemStack hand = player.getCurrentItemOrArmor(0);
    
    		if(hand.getItem() == Your item here ){ //Your item here
    
    			player.addPotionEffect(new PotionEffect(Potion.resistance.getId(), 10, 0 ) );
    
    		}
    
    
    
    	}
    
    }
    
    
    
    }
    
    
    

  6. Thanks i have found the solution

     

    @Override
    public void onEntityCollidedWithBlock( World world, int x, int y, int z, Entity entity ) {
    
    	entity.attackEntityFrom(DamageSource.magic, 3);
    		//((EntityLiving)entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200, 1));
    
    }
    

  7. Try to change the -1 in maxuses

     

    public static EnumToolMaterial onyxEnum = EnumHelper.addToolMaterial("onyxEnum", 3 ,  -1  , 6.0F, 3.0F, 22);  //-1 here

     

    Give it a positive number and then try.

     

    Edit: I was right, I tried it. Give the maxuses a positive number

    Because the maxuses is the amount of time it can be used.

    So it cant be negetive.

  8. Do you get any error in console .Please post it .

     

    And this is the method to add a material

    EnumHelper.addToolMaterial(String name, int harvestLevel, int maxUses, float efficiency, float damage, int enchantability);

     

    You have done it right in your code but if the last integer in stater which is of enchantability is set to 0 it cant be enchanted.

×
×
  • Create New...

Important Information

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