public override bool TryPlaceBlock(IWorldAccessor aworld, IPlayer byPlayer, ItemStack itemstack, BlockSelection blockSel, ref EnumHandling handling) { pos = blockSel.Position; world = aworld; //idunno, becomes null and breaks if I don't do this listenerId = world.RegisterGameTickListener(ticker, 5000); return(true); }
public override bool TryPlaceBlock(IWorldAccessor world, IPlayer byPlayer, ItemStack itemstack, BlockSelection blockSel, ref EnumHandling handling, ref string failureCode) { Pos = blockSel.Position; this.world = world; listenerId = world.RegisterGameTickListener(ticker, 5000); return(true); }
private void DrawGrid(IWorldAccessor world, AStarSearch astar, BlockPos pos, int sR) { for (int x = pos.X - sR; x < pos.X + sR; x++) { for (int y = pos.Y - sR; y < pos.Y + sR; y++) { for (int z = pos.Z - sR; z < pos.Z + sR; z++) { BlockPos id = new BlockPos(x, y, z); if (!astar.cameFrom.TryGetValue(id, out BlockPos ptr)) { ptr = id; } else { world.BlockAccessor.SetBlock(2277, ptr); testBlockPos.Add(ptr); } } } } listenerId = world.RegisterGameTickListener(Ticker, 2500); }