use of net.minecraft.network.packet.c2s.play.PlayerInteractBlockC2SPacket in project Client by MatHax.
the class Notebot method tuneBlock.
private boolean tuneBlock(BlockPos pos, int note) {
if (mc.world == null || mc.player == null)
return false;
BlockState block = mc.world.getBlockState(pos);
if (block.getBlock() != Blocks.NOTE_BLOCK) {
offset++;
stage = Stage.Set_Up;
return true;
}
if (block.get(NoteBlock.NOTE).equals(note)) {
currentNote++;
stage = Stage.Set_Up;
return true;
}
mc.player.networkHandler.sendPacket(new PlayerInteractBlockC2SPacket(Hand.MAIN_HAND, new BlockHitResult(mc.player.getPos(), rayTraceCheck(pos), pos, true)));
mc.player.swingHand(Hand.MAIN_HAND);
return true;
}
use of net.minecraft.network.packet.c2s.play.PlayerInteractBlockC2SPacket in project Client by MatHax.
the class AntiSpawnpoint method onSendPacket.
@EventHandler
private void onSendPacket(PacketEvent.Send event) {
if (mc.world == null)
return;
if (!(event.packet instanceof PlayerInteractBlockC2SPacket))
return;
BlockPos blockPos = ((PlayerInteractBlockC2SPacket) event.packet).getBlockHitResult().getBlockPos();
boolean IsOverWorld = mc.world.getDimension().isBedWorking();
boolean IsNetherWorld = mc.world.getDimension().isRespawnAnchorWorking();
boolean BlockIsBed = mc.world.getBlockState(blockPos).getBlock() instanceof BedBlock;
boolean BlockIsAnchor = mc.world.getBlockState(blockPos).getBlock().equals(Blocks.RESPAWN_ANCHOR);
if (fakeUse.get()) {
if (BlockIsBed && IsOverWorld) {
mc.player.swingHand(Hand.MAIN_HAND);
mc.player.updatePosition(blockPos.getX(), blockPos.up().getY(), blockPos.getZ());
} else if (BlockIsAnchor && IsNetherWorld)
mc.player.swingHand(Hand.MAIN_HAND);
}
if ((BlockIsBed && IsOverWorld) || (BlockIsAnchor && IsNetherWorld))
event.cancel();
}
use of net.minecraft.network.packet.c2s.play.PlayerInteractBlockC2SPacket in project Hypnotic-Client by Hypnotic-Development.
the class ServerCrasher method onTick.
@Override
public void onTick() {
for (int i = 0; i < 10; i++) {
Random random = new Random();
Vec3d pos = new Vec3d(random.nextInt(1000000 - 100000) + 100000, 255, random.nextInt(1000000 - 100000) + 100000);
mc.player.networkHandler.sendPacket(new PlayerInteractBlockC2SPacket(Hand.MAIN_HAND, new BlockHitResult(pos, Direction.UP, new BlockPos(pos), false)));
}
super.onTick();
}
use of net.minecraft.network.packet.c2s.play.PlayerInteractBlockC2SPacket in project orion by AntiCope.
the class AutoCityPlus method placeCrystal.
private void placeCrystal(BlockPos placePos) {
FindItemResult crystalSlot = InvUtils.findInHotbar(Items.END_CRYSTAL);
Hand hand;
if (mc.player.getOffHandStack().getItem() == Items.END_CRYSTAL) {
hand = Hand.OFF_HAND;
} else {
hand = Hand.MAIN_HAND;
}
if (hand == Hand.MAIN_HAND && !crystalSlot.found())
return;
if (hand == Hand.MAIN_HAND)
Wrapper.updateSlot(crystalSlot.slot());
mc.player.networkHandler.sendPacket(new PlayerInteractBlockC2SPacket(hand, new BlockHitResult(mc.player.getPos(), getDirection(placePos), placePos, false)));
Wrapper.swingHand(hand != Hand.MAIN_HAND);
}
use of net.minecraft.network.packet.c2s.play.PlayerInteractBlockC2SPacket in project meteor-client by MeteorDevelopment.
the class Notebot method tuneBlock.
private boolean tuneBlock(BlockPos pos, int note) {
if (mc.world == null || mc.player == null)
return false;
BlockState block = mc.world.getBlockState(pos);
if (block.getBlock() != Blocks.NOTE_BLOCK) {
offset++;
stage = Stage.SetUp;
return true;
}
if (block.get(NoteBlock.NOTE).equals(note)) {
currentNote++;
stage = Stage.SetUp;
return true;
}
mc.player.networkHandler.sendPacket(new PlayerInteractBlockC2SPacket(Hand.MAIN_HAND, new BlockHitResult(mc.player.getPos(), rayTraceCheck(pos), pos, true)));
mc.player.swingHand(Hand.MAIN_HAND);
return true;
}
Aggregations