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

public class LeadJetpack extends ItemArmor implements IEnergyContainerItem {

    public EnergyStorage storage = new EnergyStorage(100000);

    ModelLeadJetpack pack;


    public LeadJetpack(ArmorMaterial materialIn, int renderIndexIn, EntityEquipmentSlot equipmentSlotIn) {
        super(materialIn, renderIndexIn, equipmentSlotIn);
        this.setCreativeTab(TechExpansion.TechExpansion);
        this.setMaxStackSize(1);
        this.setUnlocalizedName("lead_jetpack");
    }

    @SideOnly(Side.CLIENT)
    public net.minecraft.client.model.ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, net.minecraft.client.model.ModelBiped _default)
    {
        return ModelLeadJetpack.INSTANCE;
    }

    @Nullable
    @Override
    public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) {
        return super.getArmorTexture(stack, entity, slot, type);
    }

    @Override
    public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
        if(KeybindHandler.keybind.isKeyDown() && storage.getEnergyStored() > 200) {
            storage.setEnergyStored(storage.getEnergyStored() - 50);
            player.addVelocity(0, 0.1, 0);
            player.fallDistance = 0;
        }
        super.onArmorTick(world, player, itemStack);
    }

    @Override
    public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) {
        return storage.receiveEnergy(maxReceive, simulate);
    }

    @Override
    public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
        return 0;
    }

    @Override
    public int getEnergyStored(ItemStack container) {
        return storage.getEnergyStored();
    }

    @Override
    public int getMaxEnergyStored(ItemStack container) {
        return storage.getMaxEnergyStored();
    }

    @Nullable
    @Override
    public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt) {
        return super.initCapabilities(stack, nbt);
    }
}

I think you will want to create a new one and then in the methods you need to call the super if it doesn't match yours. IE

@Override
public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) {
	ICapabilityProvider superProvider = super.initCapabilities(stack, nbt);
	return new ICapabilityProvider() {

		@Override
		public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
			return capability == yourCapability ? true : superProvider.hasCapability(capability, facing);
		}

		@Override
		public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
			return capability == yourCapability ? yourCapability : superProvider.getCapability(capability, facing);
		}
	};
}

I don't see how you could incorporate facing into an Item, but...ehh.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

yourCapability? do i have to create my own capability? and if so how?

Yes you will have to create your own capability. The forge documentation is a little low, but there are examples out there Choonster has some example on his github. There is also this which helped me understand what I need for a capability specifically.

https://github.com/Choonster?tab=repositories

http://www.planetminecraft.com/blog/forge-tutorial-capability-system/

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

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.