Search in sources :

Example 1 with ItemGrenade

use of ladysnake.gaspunk.item.ItemGrenade in project Gaspunk by Ladysnake.

the class ThaumcraftCompat method registerGasAspect.

private static void registerGasAspect(IGas gas, AspectList aspects) {
    ItemStack gasTube = ((ItemGasTube) ModItems.GAS_TUBE).getItemStackFor(gas);
    aspects.add(divide(generateAspectsFromBrewing(gasTube), 1.1));
    ThaumcraftApi.registerObjectTag(gasTube, aspects.copy());
    ItemStack grenade = ((ItemGrenade) ModItems.GRENADE).getItemStackFor(gas);
    // aspects = divide(aspects, 1.2);
    aspects.add(divide(AspectHelper.getObjectAspects(new ItemStack(ModItems.GRENADE)), 1.8));
    for (GrenadeSkins skin : GrenadeSkins.VALUES) {
        // need to register for every skin as thaumcraft counts an itemstack with different nbt as unique
        ((ItemGrenade) ModItems.GRENADE).setSkin(grenade, skin);
        ThaumcraftApi.registerObjectTag(grenade, aspects.copy());
    }
}
Also used : ItemGasTube(ladysnake.gaspunk.item.ItemGasTube) GrenadeSkins(ladysnake.gaspunk.api.customization.GrenadeSkins) ItemGrenade(ladysnake.gaspunk.item.ItemGrenade) ItemStack(net.minecraft.item.ItemStack)

Example 2 with ItemGrenade

use of ladysnake.gaspunk.item.ItemGrenade in project Gaspunk by Ladysnake.

the class EntityGrenade method onUpdate.

@Override
public void onUpdate() {
    super.onUpdate();
    if (world.isRemote)
        return;
    int countdown = getCountdown();
    if (countdown == 1)
        explode();
    setCountdown(getCountdown() - 1);
    // after exploding, the countdown is used to track the time before cloud expiration
    if (countdown <= -cloudMaxLifeSpan) {
        if (canPickup) {
            ItemStack stack = getGrenade();
            ItemGrenade grenadeItem = (ItemGrenade) stack.getItem();
            ItemStack emptyGrenade = new ItemStack(ModItems.EMPTY_GRENADE);
            ((SkinItem) ModItems.EMPTY_GRENADE).setSkin(emptyGrenade, grenadeItem.getSkin(stack));
            world.spawnEntity(new EntityItem(world, posX, posY, posZ, emptyGrenade));
        }
        setDead();
    }
}
Also used : ItemGrenade(ladysnake.gaspunk.item.ItemGrenade) SkinItem(ladysnake.gaspunk.item.SkinItem) ItemStack(net.minecraft.item.ItemStack) EntityItem(net.minecraft.entity.item.EntityItem)

Aggregations

ItemGrenade (ladysnake.gaspunk.item.ItemGrenade)2 ItemStack (net.minecraft.item.ItemStack)2 GrenadeSkins (ladysnake.gaspunk.api.customization.GrenadeSkins)1 ItemGasTube (ladysnake.gaspunk.item.ItemGasTube)1 SkinItem (ladysnake.gaspunk.item.SkinItem)1 EntityItem (net.minecraft.entity.item.EntityItem)1