use of net.minecraft.network.PacketByteBuf in project MCDoom by AzureDoom.
the class PlasmaGun 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 PlasmaGun && ClientInit.reload.isPressed() && selected) {
PacketByteBuf passedData = new PacketByteBuf(Unpooled.buffer());
passedData.writeBoolean(true);
ClientPlayNetworking.send(DoomMod.PLASMA, passedData);
}
}
}
use of net.minecraft.network.PacketByteBuf in project MCDoom by AzureDoom.
the class RocketLauncher 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 RocketLauncher && ClientInit.reload.isPressed() && selected) {
PacketByteBuf passedData = new PacketByteBuf(Unpooled.buffer());
passedData.writeBoolean(true);
ClientPlayNetworking.send(DoomMod.ROCKETLAUNCHER, passedData);
}
}
}
use of net.minecraft.network.PacketByteBuf in project MCDoom by AzureDoom.
the class SentinelHammerItem method inventoryTick.
@Override
public void inventoryTick(ItemStack stack, World world, Entity entity, int slot, boolean selected) {
PlayerEntity playerentity = (PlayerEntity) entity;
if (world.isClient) {
if (playerentity.getMainHandStack().getItem() instanceof AxeMarauderItem && ClientInit.reload.isPressed() && selected) {
PacketByteBuf passedData = new PacketByteBuf(Unpooled.buffer());
passedData.writeBoolean(true);
ClientPlayNetworking.send(DoomMod.SENTINELHAMMER, passedData);
}
}
}
use of net.minecraft.network.PacketByteBuf in project MCDoom by AzureDoom.
the class ChainsawAnimated 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 ChainsawAnimated && ClientInit.reload.isPressed() && isSelected) {
PacketByteBuf passedData = new PacketByteBuf(Unpooled.buffer());
passedData.writeBoolean(true);
ClientPlayNetworking.send(DoomMod.CHAINSAW_ETERNAL, passedData);
}
}
}
use of net.minecraft.network.PacketByteBuf in project MCDoom by AzureDoom.
the class DPlasmaRifle 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 DPlasmaRifle && ClientInit.reload.isPressed() && selected) {
PacketByteBuf passedData = new PacketByteBuf(Unpooled.buffer());
passedData.writeBoolean(true);
ClientPlayNetworking.send(DoomMod.DPLASMARIFLE, passedData);
}
}
}
Aggregations