Search in sources :

Example 1 with HWGEntity

use of mod.azure.hwg.entity.HWGEntity in project HWG by cybercat-mods.

the class BalrogItem method inventoryTick.

@Override
public void inventoryTick(ItemStack stack, World world, Entity entity, int slot, boolean selected) {
    if (world.isClient) {
        if (((PlayerEntity) entity).getMainHandStack().getItem() instanceof BalrogItem && ClientInit.reload.isPressed() && selected) {
            PacketByteBuf passedData = new PacketByteBuf(Unpooled.buffer());
            passedData.writeBoolean(true);
            ClientPlayNetworking.send(HWGMod.BALROG, passedData);
            world.playSound((PlayerEntity) null, entity.getX(), entity.getY(), entity.getZ(), SoundEvents.ITEM_FIRECHARGE_USE, SoundCategory.PLAYERS, 1.0F, 1.5F);
        }
    }
    if (!(entity instanceof HWGEntity) && selected) {
        ((LivingEntity) entity).addStatusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, 1, 1, false, false, false));
    }
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) PacketByteBuf(net.minecraft.network.PacketByteBuf) StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance) HWGEntity(mod.azure.hwg.entity.HWGEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity)

Example 2 with HWGEntity

use of mod.azure.hwg.entity.HWGEntity in project HWG by cybercat-mods.

the class Minigun method inventoryTick.

@Override
public void inventoryTick(ItemStack stack, World world, Entity entity, int slot, boolean selected) {
    if (world.isClient) {
        if (((PlayerEntity) entity).getMainHandStack().getItem() instanceof Minigun && ClientInit.reload.isPressed() && selected) {
            PacketByteBuf passedData = new PacketByteBuf(Unpooled.buffer());
            passedData.writeBoolean(true);
            ClientPlayNetworking.send(HWGMod.MINIGUN, passedData);
        }
    }
    if (!(entity instanceof HWGEntity) && selected) {
        ((LivingEntity) entity).addStatusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, 1, 1, false, false, false));
    }
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) PacketByteBuf(net.minecraft.network.PacketByteBuf) StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance) HWGEntity(mod.azure.hwg.entity.HWGEntity) PlayerEntity(net.minecraft.entity.player.PlayerEntity)

Aggregations

HWGEntity (mod.azure.hwg.entity.HWGEntity)2 LivingEntity (net.minecraft.entity.LivingEntity)2 StatusEffectInstance (net.minecraft.entity.effect.StatusEffectInstance)2 PlayerEntity (net.minecraft.entity.player.PlayerEntity)2 PacketByteBuf (net.minecraft.network.PacketByteBuf)2