use of org.spongepowered.common.bridge.RegistryBackedTrackableBridge in project SpongeCommon by SpongePowered.
the class BlocksMixin_Tracker method impl$initializeTrackerState.
@Redirect(method = "register", at = @At(value = "INVOKE", target = "Lnet/minecraft/core/Registry;register(Lnet/minecraft/core/Registry;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;"))
private static Object impl$initializeTrackerState(final Registry<Object> registry, final String key, final Object toRegister) {
final Object registered = Registry.register(registry, key, toRegister);
final Block block = (Block) toRegister;
final boolean randomlyTicking = block.isRandomlyTicking(block.defaultBlockState());
// TODO Not the best check but the tracker options only matter during block ticks...
if (randomlyTicking) {
final RegistryBackedTrackableBridge<Block> trackableBridge = (RegistryBackedTrackableBridge<Block>) toRegister;
trackableBridge.bridge$refreshTrackerStates();
}
return registered;
}
Aggregations