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());
}
}
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();
}
}
Aggregations