Message

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

@SubscribeEvent

public void onTick(TickEvent.PlayerTickEvent event) {


if (NukerEnabled) {
if (getBlocksMain() != null) {
BlockPos gardenBlock = getBlocksMain();

MovingObjectPosition fake = mc.objectMouseOver;


fake.hitVec = new Vec3(gardenBlock);
EnumFacing enumFacing = fake.sideHit;

if (nextTick) {
mc.thePlayer.sendQueue.addToSendQueue(new
C07PacketPlayerDigging(C07PacketPlayerDigging.Action.STOP_DESTROY_BLOCK, tickPos,
enumFacing));
nextTick = false;
}

if (destroyedBlocks.size() > 10) {


destroyedBlocks.clear();
}

if (!destroyedBlocks.contains(gardenBlock) ||
canReachBlock(gardenBlock, nukerRange) || event.phase == TickEvent.Phase.END) {
IBlockState getBlockState =
mc.theWorld.getBlockState(gardenBlock);

if (getBlockState.getBlock() == Blocks.tallgrass ||
getBlockState.getBlock() == Blocks.double_plant || getBlockState.getBlock() ==
Blocks.red_flower || getBlockState.getBlock() == Blocks.yellow_flower ||
getBlockState.getBlock() == Blocks.leaves) {
swapToSlot(Items.wooden_hoe);
} else {
swapToSlot(Items.golden_axe);
}

mc.thePlayer.sendQueue.addToSendQueue(new
C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK,
gardenBlock, enumFacing));
mc.thePlayer.swingItem();

nextTick = true;
tickPos = gardenBlock;

destroyedBlocks.add(gardenBlock);
}
}
}
}

You might also like