ForgePatch/patches/minecraft/net/minecraft/village/PointOfInterestType.java.patch

42 lines
2.2 KiB
Diff

--- a/net/minecraft/village/PointOfInterestType.java
+++ b/net/minecraft/village/PointOfInterestType.java
@@ -21,7 +21,7 @@
import net.minecraft.util.Util;
import net.minecraft.util.registry.Registry;
-public class PointOfInterestType {
+public class PointOfInterestType extends net.minecraftforge.registries.ForgeRegistryEntry<PointOfInterestType> {
private static final Supplier<Set<PointOfInterestType>> field_234168_y_ = Suppliers.memoize(() -> {
return Registry.field_218370_L.func_201756_e().map(VillagerProfession::func_221149_b).collect(Collectors.toSet());
});
@@ -36,7 +36,7 @@
}).filter((p_234173_0_) -> {
return p_234173_0_.func_177229_b(BedBlock.field_176472_a) == BedPart.HEAD;
}).collect(ImmutableSet.toImmutableSet());
- private static final Map<BlockState, PointOfInterestType> field_221073_u = Maps.newHashMap();
+ private static final Map<BlockState, PointOfInterestType> field_221073_u = net.minecraftforge.registries.GameData.getBlockStatePointOfInterestTypeMap();
public static final PointOfInterestType field_221054_b = func_226360_a_("unemployed", ImmutableSet.of(), 1, field_221071_s, 1);
public static final PointOfInterestType field_221055_c = func_226359_a_("armorer", func_221042_a(Blocks.field_222424_lM), 1, 1);
public static final PointOfInterestType field_221056_d = func_226359_a_("butcher", func_221042_a(Blocks.field_222423_lL), 1, 1);
@@ -112,16 +112,14 @@
}
private static PointOfInterestType func_221052_a(PointOfInterestType p_221052_0_) {
- p_221052_0_.field_221075_w.forEach((p_234169_1_) -> {
- PointOfInterestType pointofinteresttype = field_221073_u.put(p_234169_1_, p_221052_0_);
- if (pointofinteresttype != null) {
- throw (IllegalStateException)Util.func_229757_c_(new IllegalStateException(String.format("%s is defined in too many tags", p_234169_1_)));
- }
- });
return p_221052_0_;
}
public static Optional<PointOfInterestType> func_221047_b(BlockState p_221047_0_) {
return Optional.ofNullable(field_221073_u.get(p_221047_0_));
}
+
+ public ImmutableSet<BlockState> getBlockStates() {
+ return ImmutableSet.copyOf(this.field_221075_w);
+ }
}