Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Ive got a issue with my Cloud Capsule, ive got it to fill up when u go above Y:128 but when its been filling up and you drop it, it gives you back the first metadata item instead of 1,2,3,4,5,6,7,8,9,10.

 

Heres my CloudCapsule Code:

 

 

package skycraft.items;

 

import java.util.List;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import skycraft.SkyCraft;

import skycraft.core.common.CommonProxySkyCraft;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.util.MathHelper;

 

public class ItemCloudCapsule extends Item

{

public static final String[] cloudCapsule = new String[] {"", " : 1", " : 2", " : 3", " : 4", " : 5", " : 6", " : 7", " : 8", " : 9", " : 10"};

 

public ItemCloudCapsule(int id)

{

super(id);

this.setCreativeTab(SkyCraft.tabSkyCraftItems);

this.setMaxDamage(0);

this.setHasSubtypes(true);

this.setIconCoord(3, 0);

this.setItemName("Cloud Capsules");

}

 

@SideOnly(Side.CLIENT)

    public int getIconFromDamage(int par1)

    {

        int var2 = MathHelper.clamp_int(par1, 0, 10);

        return this.iconIndex + var2 % 1 * 1 + var2 / 1;

    }

 

@Override

public String getItemNameIS(ItemStack itemstack) {

return getItemName() + "." + cloudCapsule[itemstack.getItemDamage()];

}

 

@SideOnly(Side.CLIENT)

public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)

{

    for (int var2 = 0; var2 < 11; ++var2)

    {

        par3List.add(new ItemStack(par1, 1, var2));

        }

}

 

public String getTextureFile()

    {

            return CommonProxySkyCraft.Items_PNG;

    }

}

 

 

 

And also heres my tickupdate for this item:

 

 

package skycraft.core.client;

 

import java.util.EnumSet;

 

import net.minecraft.client.Minecraft;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.item.ItemStack;

import skycraft.SkyCraftItems;

import cpw.mods.fml.client.FMLClientHandler;

import cpw.mods.fml.common.ITickHandler;

import cpw.mods.fml.common.TickType;

 

public class CloudCollecterHandler implements ITickHandler {

 

@Override

public void tickStart(EnumSet<TickType> type, Object... tickData)

{

 

}

 

int ticker = 0;

@Override

public void tickEnd(EnumSet<TickType> type, Object... tickData)

{

Minecraft minecraft = FMLClientHandler.instance().getClient();

        EntityPlayer player = minecraft.thePlayer;

        ItemStack itemStack = null;

       

        if(player!= null)

        {

        itemStack = player.inventory.getCurrentItem();

        if(itemStack != null)

        {

        if(player.posY >= 128 && minecraft.inGameHasFocus && itemStack.getItem() == SkyCraftItems.cloudCapsule)

            {

        if(itemStack.getItemDamage() < 10 && ticker == 80)

        {

        itemStack.setItemDamage(itemStack.getItemDamage() + 1);

        ticker = 0;

        }

        else

        ticker++;

            }

        else

        ticker = 0;

        }

        }

}

 

@Override

public EnumSet<TickType> ticks()

{

return EnumSet.of(TickType.CLIENT, TickType.CLIENTGUI, TickType.RENDER);

}

 

@Override

public String getLabel()

{

return null;

}

 

}

 

 

 

thanks in advance

because if the player drops the block from inventory, the first metadata will be dropped, also damage dropped its for items too :).

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.