Jump to content

[1.6.2]Minecraft Item Animations


Tsiumi
 Share

Recommended Posts

Hello ^_^

I have made a Sword with animations but it not works  :'(

without animation (16x16) it works, but with animation(64x2048(HD))

it doesn't work!

if i rename it to apple.png and put it in the temp folder the apple has the animation but my items doesn't have it ;(

can you help me?

LG Tsiumi

Link to comment
Share on other sites

both twillight(twillight.png and twillight.txt)

Here is the Code:

package GW2.item;

import java.awt.Dimension;

import GW2.GW2;
import GW2.creativetab.Gw2Tabs;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.util.Icon;

public class ItemTwillight extends Item
{
    private int weaponDamage;
    private final EnumToolMaterialGW2 toolMaterial;

    public ItemTwillight(int par1, EnumToolMaterialGW2 par2EnumToolMaterialGW2)
    {
        super(par1);
        this.toolMaterial = par2EnumToolMaterialGW2;
        this.maxStackSize = 1;
        this.setMaxDamage(par2EnumToolMaterialGW2.getMaxUses());
        this.setCreativeTab(Gw2Tabs.tabGW2);
        this.weaponDamage = 6 + par2EnumToolMaterialGW2.getDamageVsEntity();
    }

    public int func_82803_g()
    {
        return this.toolMaterial.getDamageVsEntity();
    }

    @SideOnly(Side.CLIENT)
    public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
    {
        if (par2Block.blockID == Block.web.blockID)
        {
            return 15.0F;
        }
        else
        {
            Material material = par2Block.blockMaterial;
            return material != Material.plants && material != Material.vine && material != Material.coral && material != Material.leaves && material != Material.pumpkin ? 1.0F : 1.5F;
        }
    }

    /**
     * Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
     * the damage on the stack.
     */
    public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving, World par4World)
    {
        par4World.setWorldTime(+100);
        return true;
    }

    public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLiving par7EntityLiving)
    {
        if ((double)Block.blocksList[par3].getBlockHardness(par2World, par4, par5, par6) != 0.0D)
        {
            par1ItemStack.damageItem(2, par7EntityLiving);
        }

        return true;
    }

    /**
     * Returns the damage against a given entity.
     */
    public int getDamageVsEntity(Entity par1Entity)
    {
        return this.weaponDamage;
    }

    @SideOnly(Side.CLIENT)

    /**
     * Returns True is the item is renderer in full 3D when hold.
     */
    public boolean isFull3D()
    {
        return true;
    }

    /**
     * returns the action that specifies what animation to play when the items is being used
     */
    public EnumAction getItemUseAction(ItemStack par1ItemStack)
    {
        return EnumAction.block;
    }

    /**
     * How long it takes to use or consume an item
     */
    public int getMaxItemUseDuration(ItemStack par1ItemStack)
    {
        return 72000;
    }

    /**
     * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
     */
    public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
    {
    	par2World.setWorldTime(24000);
        par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
        return par1ItemStack;
    }

    /**
     * Returns if the item (tool) can harvest results from the block type.
     */
    public boolean canHarvestBlock(Block par1Block)
    {
        return par1Block.blockID == Block.web.blockID;
    }

    /**
     * Return the enchantability factor of the item, most of the time is based on material.
     */
    public int getItemEnchantability()
    {
        return this.toolMaterial.getEnchantability();
    }

    /**
     * Return the name for this tool's material.
     */
    public String getToolMaterialName()
    {
        return this.toolMaterial.toString();
    }

    /**
     * Return whether this item is repairable in an anvil.
     */
    public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack)
    {
        return this.toolMaterial.getToolCraftingMaterial() == par2ItemStack.itemID ? true : super.getIsRepairable(par1ItemStack, par2ItemStack);
    }
}

The Texture path is in the Main Class:

.func_111206_d("gw2:twillight")

btw :D

    public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving, World par4World)
    {
        par4World.setWorldTime(+100);
        return true;
    }

I want to make if i hit a entity the Worldtime increased +100 ticks... how can i make that?

Link to comment
Share on other sites

public boolean isFull3D()
    {
        return true;
    }

Might conflict. Don't know if 3Dified items can have animated textures yet.

Try with false, see if that fix it.

 

To add time, I would use

for (int j = 0; j < MinecraftServer.getServer().worldServers.length; ++j)
        {
            WorldServer worldserver = MinecraftServer.getServer().worldServers[j];
            worldserver.setWorldTime(worldserver.getWorldTime() + (long)timeAdded);
        }

Link to comment
Share on other sites

both don't work... :(

    public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving, World par4World)
    {
    	for (int j = 0; j < MinecraftServer.getServer().worldServers.length; ++j)
        {
            WorldServer worldserver = MinecraftServer.getServer().worldServers[j];
            worldserver.setWorldTime(worldserver.getWorldTime() + (long)100);
        }
    	return true;
    }

The Time don't increased :( if i hit a enemy its the same time :(

 

MinecraftForge says again

Unable to parse animation metadata from gw2:textures/items/twillight.png: broken aspect ratio and not an animation

:(

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share



×
×
  • Create New...

Important Information

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