use of ladysnake.gaspunk.entity.EntityGrenade in project Gaspunk by Ladysnake.
the class CommonProxy method init.
public void init() {
PacketHandler.initPackets();
if (GasPunkConfig.alternativeAshRecipe)
GameRegistry.addSmelting(Items.NETHER_WART, new ItemStack(ModItems.ASH), 0.8f);
else
GameRegistry.addSmelting(Items.ROTTEN_FLESH, new ItemStack(ModItems.ASH), 0.35f);
if (Loader.isModLoaded("baubles"))
MinecraftForge.EVENT_BUS.register(new BaublesCompatHandler());
new Thread(SpecialRewardChecker::retrieveSpecialRewards).start();
BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject(ModItems.GRENADE, new BehaviorProjectileDispense() {
@Nonnull
@Override
protected IProjectile getProjectileEntity(@Nonnull World worldIn, @Nonnull IPosition position, @Nonnull ItemStack stackIn) {
EntityGrenade grenade = new EntityGrenade(worldIn);
grenade.setItem(stackIn);
return grenade;
}
});
}
use of ladysnake.gaspunk.entity.EntityGrenade in project Gaspunk by Ladysnake.
the class ItemGrenade method onPlayerStoppedUsing.
@Override
public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityLivingBase entityLivingBase, int timeLeft) {
if (!worldIn.isRemote) {
worldIn.playSound(null, entityLivingBase.posX, entityLivingBase.posY, entityLivingBase.posZ, SoundEvents.ENTITY_SPLASH_POTION_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
ItemStack stack1;
// don't shrink the stack if the player is in creative
if (entityLivingBase instanceof EntityPlayer && ((EntityPlayer) entityLivingBase).isCreative())
stack1 = stack.copy();
else
stack1 = stack.splitStack(1);
EntityGrenade grenade = new EntityGrenade(worldIn, entityLivingBase, stack1);
grenade.setCountdown(timeLeft);
grenade.shoot(entityLivingBase, entityLivingBase.rotationPitch, entityLivingBase.rotationYaw, 0.0F, 1.5F, 1.0F);
worldIn.spawnEntity(grenade);
}
}
Aggregations