Fabric API

Fabric API

108M Downloads

FAPI needs transitive AW for PointOfInterestType

frqnny opened this issue · 6 comments

commented

self explanatory

commented

I could but why would I? I am sorry but I still don’t get the impl difference. I am asking for a TAW not for the constructor but for the register methods in it.

commented

Ahhh hmmm right. Usually we don't expose these static register methods in Fabric API. It's also annoying that they only take String and not Identifier... I think that would be an easy mistake to make.

commented

Why not use PointOfInterestHelper? Making methods in PointOfInterestType directly accessible is a bit error-prone due to the required setup call.

commented

We already call setup with (look at what i highlighted with **)
https://github.com/FabricMC/fabric/blob/1.18.2/fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/mixin/object/builder/PointOfInterestTypeAccessor.java

  private static PointOfInterestType register(Identifier id, int ticketCount, int searchDistance, Set<BlockState> states) {
	return Registry.register(Registry.POINT_OF_INTEREST_TYPE, id, PointOfInterestTypeAccessor.**callSetup**(
			PointOfInterestTypeAccessor.callCreate(id.toString(), states, ticketCount, searchDistance)));
}

private static PointOfInterestType register(Identifier id, int ticketCount, Predicate<PointOfInterestType> typePredicate, int searchDistance, Set<BlockState> states) {
	return Registry.register(Registry.POINT_OF_INTEREST_TYPE, id, PointOfInterestTypeAccessor.**callSetup**(
			PointOfInterestTypeAccessor.callCreate(id.toString(), states, ticketCount, typePredicate, searchDistance)));
}

`

commented

Yes but why don't you use PointOfInterestHelper? It's too easy to forget about the setup call for this to be a TAW, imo.

commented

Closing this for now since we usually don't expose registration methods that take a String, if you disagree we can reopen.