use of net.minecraft.network.PacketByteBuf in project MCDoom by AzureDoom.
the class Chainsaw method inventoryTick.
@Override
public void inventoryTick(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
LivingEntity user = (LivingEntity) entityIn;
PlayerEntity player = (PlayerEntity) entityIn;
if (player.getMainHandStack().isItemEqualIgnoreDamage(stack) && stack.getDamage() < (stack.getMaxDamage() - 1)) {
final Box aabb = new Box(entityIn.getBlockPos().up()).expand(1D, 1D, 1D);
entityIn.getEntityWorld().getOtherEntities(user, aabb).forEach(e -> doDamage(user, e));
entityIn.getEntityWorld().getOtherEntities(user, aabb).forEach(e -> doDeathCheck(user, e, stack));
entityIn.getEntityWorld().getOtherEntities(user, aabb).forEach(e -> damageItem(user, stack));
entityIn.getEntityWorld().getOtherEntities(user, aabb).forEach(e -> addParticle(e));
}
if (isSelected && stack.getDamage() < (stack.getMaxDamage() - 1)) {
worldIn.playSound((PlayerEntity) null, user.getX(), user.getY(), user.getZ(), ModSoundEvents.CHAINSAW_IDLE, SoundCategory.PLAYERS, 0.05F, 1.0F / (worldIn.random.nextFloat() * 0.4F + 1.2F) + 0.25F * 0.5F);
}
if (worldIn.isClient) {
if (player.getMainHandStack().getItem() instanceof Chainsaw && ClientInit.reload.isPressed() && isSelected) {
PacketByteBuf passedData = new PacketByteBuf(Unpooled.buffer());
passedData.writeBoolean(true);
ClientPlayNetworking.send(DoomMod.CHAINSAW, passedData);
}
}
}
use of net.minecraft.network.PacketByteBuf in project MCDoom by AzureDoom.
the class DGauss 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 DGauss && ClientInit.reload.isPressed() && selected) {
PacketByteBuf passedData = new PacketByteBuf(Unpooled.buffer());
passedData.writeBoolean(true);
ClientPlayNetworking.send(DoomMod.DGAUSS, passedData);
}
}
}
use of net.minecraft.network.PacketByteBuf in project MCDoom by AzureDoom.
the class Shotgun 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 Shotgun && ClientInit.reload.isPressed() && selected) {
PacketByteBuf passedData = new PacketByteBuf(Unpooled.buffer());
passedData.writeBoolean(true);
ClientPlayNetworking.send(DoomMod.SHOTGUN, passedData);
}
}
}
use of net.minecraft.network.PacketByteBuf in project MCDoom by AzureDoom.
the class SuperShotgun 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 SuperShotgun && ClientInit.reload.isPressed() && selected) {
PacketByteBuf passedData = new PacketByteBuf(Unpooled.buffer());
passedData.writeBoolean(true);
ClientPlayNetworking.send(DoomMod.SUPERSHOTGUN, passedData);
}
}
if (((PlayerEntity) entity).getMainHandStack().getItem() instanceof SuperShotgun && selected && ((PlayerProperties) entity).hasMeatHook()) {
((PlayerProperties) entity).setHasMeatHook(false);
}
}
use of net.minecraft.network.PacketByteBuf in project MCDoom by AzureDoom.
the class Unmaykr 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 Unmaykr && ClientInit.reload.isPressed() && selected) {
PacketByteBuf passedData = new PacketByteBuf(Unpooled.buffer());
passedData.writeBoolean(true);
ClientPlayNetworking.send(DoomMod.UNMAYKR, passedData);
}
}
}
Aggregations