Skip to content

Instantly share code, notes, and snippets.

@sjl
Created August 31, 2011 16:13
Show Gist options
  • Save sjl/1183917 to your computer and use it in GitHub Desktop.
Save sjl/1183917 to your computer and use it in GitHub Desktop.
diff --git a/src/clojurecraft/in.clj b/src/clojurecraft/in.clj
--- a/src/clojurecraft/in.clj
+++ b/src/clojurecraft/in.clj
@@ -461,11 +461,12 @@
is-full-chunk (= FULL-CHUNK chunk-size)
chunk-coords (coords-of-chunk-containing (:x postdata) (:z postdata))]
(dosync (alter (:chunks (:world bot))
assoc chunk-coords (if is-full-chunk
(ref (delay (-chunk-from-full-data postdata)))
- (ref (-chunk-from-partial-data bot postdata))))))))
+ (ref (-chunk-from-partial-data bot postdata)))))
+ predata)))
(defn update-delayed [chunk index type meta]
(let [chunk (force chunk)]
@ssoriche
Copy link

...
"Elapsed time: 41.042 msecs"
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
UNKNOWN PACKET TYPE: 7c 124
THREE-AGO: [:mapchunk {:compressedsize 3041, :sizez 16, :sizey 128, :sizex 16, :z -80, :y 0, :x -32}]
TWO-AGO: [:entityrelativemove {:dz 0, :dy 0, :dx 0, :eid 30575}]
ONE-AGO: [:mapchunk {:compressedsize 4743, :sizez 16, :sizey 128, :sizex 16, :z -80, :y 0, :x -16}]
Exception in thread "Thread-4" java.lang.RuntimeException: java.lang.ArithmeticException: Divide by zero
at clojure.lang.AFn.run(AFn.java:28)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.ArithmeticException: Divide by zero
at clojure.lang.Numbers.divide(Numbers.java:138)
at clojurecraft.in$read_packet.invoke(in.clj:710)
at clojurecraft.core$input_handler.invoke(core.clj:54)
at clojurecraft.core$connect$fn__1969.invoke(core.clj:143)
at clojure.lang.AFn.run(AFn.java:24)
... 1 more

@ssoriche
Copy link

user=> (println @(:packet-counts-in giver-bot))
{nil 1, :entityvelocity 134, :prechunk 441, :playerpositionlook 1, :mobspawn 43, :mapchunk 47, :entitymetadata 1, :setslot 1, :entitydestroy 9, :entitylookandrelativemove 238, :updatehealth 1, :timeupdate 5, :entityrelativemove 385, :login 1, :windowitems 1, :handshake 1, :spawnposition 1}
nil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment