11package net .modfest .fireblanket .client .render ;
22
3+ import com .mojang .logging .LogUtils ;
34import net .minecraft .SharedConstants ;
45import net .minecraft .client .Minecraft ;
56import net .minecraft .client .multiplayer .ClientLevel ;
1617import net .minecraft .world .phys .Vec3 ;
1718import net .modfest .fireblanket .mixin .accessor .AccessorLevel ;
1819import net .modfest .fireblanket .mixinsupport .ObservableTicks ;
20+ import org .slf4j .Logger ;
21+
22+ import java .util .Collections ;
23+ import java .util .Set ;
24+ import java .util .WeakHashMap ;
1925
2026/**
2127 * @author Ampflower
2228 **/
2329public final class BlockTimingRenderer implements DebugRenderer .SimpleDebugRenderer {
30+ private static final Logger logger = LogUtils .getLogger ();
31+
32+ private static final Set <Object > witnesses = Collections .newSetFromMap (new WeakHashMap <>());
2433
2534 private final Minecraft minecraft ;
2635
@@ -46,6 +55,18 @@ public void emitGizmos(
4655 for (final TickingBlockEntity ticker : ((AccessorLevel ) level ).getBlockEntityTickers ()) {
4756 final BlockPos pos = ticker .getPos ();
4857
58+ if (pos == null ) {
59+ // TODO: implement recursive object dumper in forbidden stack walker
60+ // This needs to be fixed properly but this is a debugger,
61+ // it can have a lil' bit of jank as a treat.
62+ // Disable the snitch call because it's utterly useless with Lithium,
63+ // as it wraps all objects, without providing a toString.
64+ // if (witnesses.add(ticker)) {
65+ // logger.warn("Ticker {} ({}) has a missing block position?!?!?!", ticker, ticker.getClass().getSimpleName());
66+ // }
67+ continue ;
68+ }
69+
4970 if (!frustum .isVisible (new AABB (pos ))) {
5071 continue ;
5172 }
0 commit comments