use of net.minecraft.network.PacketByteBuf in project Biome-Makeover by Lemonszz.
the class DirectionalDataScreen method done.
private void done() {
PacketByteBuf buf = PacketByteBufs.create();
buf.writeBlockPos(block.getPos());
buf.writeString(inputMetadata.getText());
ClientPlayNetworking.send(BMNetwork.CL_UPDATE_DIR_DATA, buf);
this.client.openScreen(null);
}
use of net.minecraft.network.PacketByteBuf in project Biome-Makeover by Lemonszz.
the class RootlingEntity method interactMob.
@Override
public ActionResult interactMob(PlayerEntity player, Hand hand) {
ItemStack itemStack = player.getStackInHand(hand);
if (itemStack.getItem() == Items.SHEARS) {
if (!this.world.isClient && this.isShearable()) {
this.sheared(SoundCategory.PLAYERS);
itemStack.damage(1, player, (p) -> p.sendToolBreakStatus(hand));
return ActionResult.SUCCESS;
} else {
return ActionResult.CONSUME;
}
} else if (itemStack.getItem() == Items.BONE_MEAL) {
if (!hasFlower()) {
if (world.isClient()) {
return ActionResult.CONSUME;
} else {
PacketByteBuf buf = PacketByteBufs.create();
buf.writeDouble(getX());
buf.writeDouble(getY());
buf.writeDouble(getZ());
NetworkUtil.serverSendTracking(world, getBlockPos(), BMNetwork.SPAWN_BONEMEAL_ENTITY_PARTICLES, buf);
if (random.nextInt(3) == 0) {
setFlowered(true);
}
if (!player.isCreative())
itemStack.decrement(1);
return ActionResult.SUCCESS;
}
}
}
return super.interactMob(player, hand);
}
use of net.minecraft.network.PacketByteBuf in project Biome-Makeover by Lemonszz.
the class NetworkUtil method doEnderParticles.
public static void doEnderParticles(World world, Entity entity, int count) {
if (world.isClient)
return;
PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
buf.writeInt(entity.getEntityId());
buf.writeInt(count);
serverSendTracking(world, entity.getBlockPos(), BMNetwork.SPAWN_ENDER_PARTICLES, buf);
}
use of net.minecraft.network.PacketByteBuf in project Biome-Makeover by Lemonszz.
the class NetworkUtil method doCenteredEntityParticle.
public static void doCenteredEntityParticle(World world, ParticleEffect effect, Entity e, int count, boolean varyY) {
if (world.isClient)
return;
PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
buf.writeInt(e.getEntityId());
buf.writeInt(Registry.PARTICLE_TYPE.getRawId((ParticleType<?>) effect));
buf.writeInt(count);
buf.writeBoolean(varyY);
buf.writeDouble(world.random.nextGaussian() * 0.02D);
buf.writeDouble(world.random.nextGaussian() * 0.02D);
buf.writeDouble(world.random.nextGaussian() * 0.02D);
serverSendTracking(world, e.getBlockPos(), BMNetwork.ENTITY_PARTICLE_CENTERED, buf);
}
use of net.minecraft.network.PacketByteBuf in project Biome-Makeover by Lemonszz.
the class NetworkUtil method doBlockEnderParticles.
public static void doBlockEnderParticles(World world, BlockPos pos, int count) {
if (world.isClient)
return;
PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
buf.writeBlockPos(pos);
buf.writeInt(count);
serverSendTracking(world, pos, BMNetwork.SPAWN_BLOCK_ENDER_PARTICLES, buf);
}
Aggregations