Jump to content

Help with registry of a new TrunkPlacerType on 1.17.1


Vicale200

Recommended Posts

Hello I tried to registry my custom trunk placer but when I try to register it I can't because TrunkPlacerType(Codec<P>) has private access. Anyone knows how I can use reflection on it? Or any other method :((

// I can't use super because the private access

public class KratTrunkPlacerType <P extends TrunkPlacer> extends TrunkPlacerType<P> {
    public static KratTrunkPlacerType<LargeTrunkPlacer> LARGE_TRUNK = register("large_trunk",LargeTrunkPlacer.CODEC);

    private final Codec<P> codec;


    private static <P extends TrunkPlacer> KratTrunkPlacerType<P> register(String pKey, Codec<P> pCodec){
        return Registry.register(Registry.TRUNK_PLACER_TYPES, pKey, new KratTrunkPlacerType<>(pCodec));
    }

    private KratTrunkPlacerType(Codec<P> pCodec) {
        super(pCodec);
        this.codec = pCodec;
    }

    public Codec<P> codec() {
        return this.codec;
    }
}

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.