Search in sources :

Example 1 with ShotgunShellEntity

use of mod.azure.doom.entity.projectiles.ShotgunShellEntity in project MCDoom by AzureDoom.

the class Shotgun method createArrow.

public ShotgunShellEntity createArrow(World worldIn, ItemStack stack, LivingEntity shooter) {
    float j = EnchantmentHelper.getLevel(Enchantments.POWER, stack);
    ShotgunShellEntity arrowentity = new ShotgunShellEntity(worldIn, shooter, (DoomMod.config.weapons.shotgun_damage + (j * 2.0F)));
    return arrowentity;
}
Also used : ShotgunShellEntity(mod.azure.doom.entity.projectiles.ShotgunShellEntity)

Example 2 with ShotgunShellEntity

use of mod.azure.doom.entity.projectiles.ShotgunShellEntity in project MCDoom by AzureDoom.

the class SuperShotgun method onStoppedUsing.

@Override
public void onStoppedUsing(ItemStack stack, World worldIn, LivingEntity entityLiving, int remainingUseTicks) {
    if (entityLiving instanceof PlayerEntity) {
        PlayerEntity playerentity = (PlayerEntity) entityLiving;
        if (stack.getDamage() < (stack.getMaxDamage() - 2)) {
            if (playerentity.getMainHandStack().getItem() instanceof SuperShotgun) {
                playerentity.getItemCooldownManager().set(this, 24);
                if (!worldIn.isClient) {
                    ShotgunShellEntity abstractarrowentity = createArrow(worldIn, stack, playerentity);
                    abstractarrowentity.setVelocity(playerentity, playerentity.getPitch(), playerentity.getYaw() + 1, 0.0F, 1.0F * 3.0F, 1.0F);
                    worldIn.spawnEntity(abstractarrowentity);
                    ShotgunShellEntity abstractarrowentity1 = createArrow(worldIn, stack, playerentity);
                    abstractarrowentity1.setVelocity(playerentity, playerentity.getPitch(), playerentity.getYaw() - 1, 0.0F, 1.0F * 3.0F, 1.0F);
                    worldIn.spawnEntity(abstractarrowentity1);
                    stack.damage(2, entityLiving, p -> p.sendToolBreakStatus(entityLiving.getActiveHand()));
                    worldIn.playSound((PlayerEntity) null, playerentity.getX(), playerentity.getY(), playerentity.getZ(), ModSoundEvents.SUPER_SHOTGUN_SHOOT, SoundCategory.PLAYERS, 1.0F, 1.0F);
                    final int id = GeckoLibUtil.guaranteeIDForStack(stack, (ServerWorld) worldIn);
                    GeckoLibNetwork.syncAnimation(playerentity, this, id, ANIM_OPEN);
                    for (PlayerEntity otherPlayer : PlayerLookup.tracking(playerentity)) {
                        GeckoLibNetwork.syncAnimation(otherPlayer, this, id, ANIM_OPEN);
                    }
                    worldIn.setBlockState(playerentity.getCameraBlockPos(), DoomBlocks.TICKING_LIGHT_BLOCK.getDefaultState());
                }
            }
        } else {
            worldIn.playSound((PlayerEntity) null, playerentity.getX(), playerentity.getY(), playerentity.getZ(), ModSoundEvents.EMPTY, SoundCategory.PLAYERS, 1.0F, 1.5F);
            ((PlayerProperties) playerentity).setHasMeatHook(false);
        }
    }
}
Also used : ShotgunShellEntity(mod.azure.doom.entity.projectiles.ShotgunShellEntity) PlayerProperties(mod.azure.doom.util.PlayerProperties) PlayerEntity(net.minecraft.entity.player.PlayerEntity)

Example 3 with ShotgunShellEntity

use of mod.azure.doom.entity.projectiles.ShotgunShellEntity in project MCDoom by AzureDoom.

the class Shotgun method onStoppedUsing.

@Override
public void onStoppedUsing(ItemStack stack, World worldIn, LivingEntity entityLiving, int remainingUseTicks) {
    if (entityLiving instanceof PlayerEntity) {
        PlayerEntity playerentity = (PlayerEntity) entityLiving;
        if (stack.getDamage() < (stack.getMaxDamage() - 1)) {
            playerentity.getItemCooldownManager().set(this, 10);
            if (!worldIn.isClient) {
                ShotgunShellEntity abstractarrowentity = createArrow(worldIn, stack, playerentity);
                abstractarrowentity.setVelocity(playerentity, playerentity.getPitch(), playerentity.getYaw(), 0.0F, 1.0F * 3.0F, 1.0F);
                stack.damage(1, entityLiving, p -> p.sendToolBreakStatus(entityLiving.getActiveHand()));
                worldIn.spawnEntity(abstractarrowentity);
                worldIn.playSound((PlayerEntity) null, playerentity.getX(), playerentity.getY(), playerentity.getZ(), ModSoundEvents.SHOTGUN_SHOOT, SoundCategory.PLAYERS, 1.0F, 1.5F);
                if (!worldIn.isClient) {
                    final int id = GeckoLibUtil.guaranteeIDForStack(stack, (ServerWorld) worldIn);
                    GeckoLibNetwork.syncAnimation(playerentity, this, id, ANIM_OPEN);
                    for (PlayerEntity otherPlayer : PlayerLookup.tracking(playerentity)) {
                        GeckoLibNetwork.syncAnimation(otherPlayer, this, id, ANIM_OPEN);
                    }
                }
                worldIn.setBlockState(playerentity.getCameraBlockPos(), DoomBlocks.TICKING_LIGHT_BLOCK.getDefaultState());
            }
        } else {
            worldIn.playSound((PlayerEntity) null, playerentity.getX(), playerentity.getY(), playerentity.getZ(), ModSoundEvents.EMPTY, SoundCategory.PLAYERS, 1.0F, 1.5F);
        }
    }
}
Also used : ShotgunShellEntity(mod.azure.doom.entity.projectiles.ShotgunShellEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity)

Example 4 with ShotgunShellEntity

use of mod.azure.doom.entity.projectiles.ShotgunShellEntity in project MCDoom by AzureDoom.

the class SuperShotgun method createArrow.

public ShotgunShellEntity createArrow(World worldIn, ItemStack stack, LivingEntity shooter) {
    float j = EnchantmentHelper.getLevel(Enchantments.POWER, stack);
    ShotgunShellEntity arrowentity = new ShotgunShellEntity(worldIn, shooter, (DoomMod.config.weapons.shotgun_damage + (j * 2.0F)));
    return arrowentity;
}
Also used : ShotgunShellEntity(mod.azure.doom.entity.projectiles.ShotgunShellEntity)

Example 5 with ShotgunShellEntity

use of mod.azure.doom.entity.projectiles.ShotgunShellEntity in project MCDoom by AzureDoom.

the class DShotgun method onStoppedUsing.

@Override
public void onStoppedUsing(ItemStack stack, World worldIn, LivingEntity entityLiving, int remainingUseTicks) {
    if (entityLiving instanceof PlayerEntity) {
        PlayerEntity playerentity = (PlayerEntity) entityLiving;
        if (stack.getDamage() < (stack.getMaxDamage() - 1)) {
            playerentity.getItemCooldownManager().set(this, 10);
            if (!worldIn.isClient) {
                ShotgunShellEntity abstractarrowentity = createArrow(worldIn, stack, playerentity);
                abstractarrowentity.setVelocity(playerentity, playerentity.getPitch(), playerentity.getYaw(), 0.0F, 1.0F * 3.0F, 1.0F);
                stack.damage(1, entityLiving, p -> p.sendToolBreakStatus(entityLiving.getActiveHand()));
                worldIn.spawnEntity(abstractarrowentity);
                worldIn.playSound((PlayerEntity) null, playerentity.getX(), playerentity.getY(), playerentity.getZ(), ModSoundEvents.SHOTGUN_SHOOT, SoundCategory.PLAYERS, 1.0F, 1.5F);
                if (!worldIn.isClient) {
                    final int id = GeckoLibUtil.guaranteeIDForStack(stack, (ServerWorld) worldIn);
                    GeckoLibNetwork.syncAnimation(playerentity, this, id, ANIM_OPEN);
                    for (PlayerEntity otherPlayer : PlayerLookup.tracking(playerentity)) {
                        GeckoLibNetwork.syncAnimation(otherPlayer, this, id, ANIM_OPEN);
                    }
                }
                worldIn.setBlockState(playerentity.getCameraBlockPos(), DoomBlocks.TICKING_LIGHT_BLOCK.getDefaultState());
            }
        } else {
            worldIn.playSound((PlayerEntity) null, playerentity.getX(), playerentity.getY(), playerentity.getZ(), ModSoundEvents.EMPTY, SoundCategory.PLAYERS, 1.0F, 1.5F);
        }
    }
}
Also used : ShotgunShellEntity(mod.azure.doom.entity.projectiles.ShotgunShellEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity)

Aggregations

ShotgunShellEntity (mod.azure.doom.entity.projectiles.ShotgunShellEntity)6 PlayerEntity (net.minecraft.entity.player.PlayerEntity)3 PlayerProperties (mod.azure.doom.util.PlayerProperties)1