Make registry type less specific in 1.19.4 to try and be more compatible with arclight

This commit is contained in:
fullwall 2023-06-08 21:09:15 +08:00
parent f6f946fcf8
commit f164494cde
2 changed files with 4 additions and 6 deletions

View File

@ -154,17 +154,17 @@ import net.minecraft.world.entity.vehicle.MinecartTNT;
@SuppressWarnings("rawtypes")
public class CustomEntityRegistry extends DefaultedMappedRegistry<EntityType<?>>
implements Supplier<DefaultedMappedRegistry<EntityType<?>>> {
implements Supplier<MappedRegistry<EntityType<?>>> {
private final BiMap<ResourceLocation, EntityType> entities = HashBiMap.create();
private final BiMap<EntityType, ResourceLocation> entityClasses = this.entities.inverse();
private final Map<EntityType, Integer> entityIds = Maps.newHashMap();
private final DefaultedMappedRegistry<EntityType<?>> wrapped;
private final MappedRegistry<EntityType<?>> wrapped;
public CustomEntityRegistry(DefaultedRegistry<EntityType<?>> original) throws Throwable {
super(original.getDefaultKey().getNamespace(),
(ResourceKey<? extends Registry<EntityType<?>>>) IREGISTRY_RESOURCE_KEY.invoke(original),
(Lifecycle) IREGISTRY_LIFECYCLE.invoke(original), true);
this.wrapped = (DefaultedMappedRegistry<EntityType<?>>) original;
this.wrapped = (MappedRegistry<EntityType<?>>) original;
}
@Override
@ -212,7 +212,7 @@ public class CustomEntityRegistry extends DefaultedMappedRegistry<EntityType<?>>
}
@Override
public DefaultedMappedRegistry<EntityType<?>> get() {
public MappedRegistry<EntityType<?>> get() {
return wrapped;
}

View File

@ -2526,9 +2526,7 @@ public class NMSImpl implements NMSBridge {
private static final MethodHandle ADVANCEMENTS_PLAYER_SETTER = NMS.getFirstFinalSetter(ServerPlayer.class,
PlayerAdvancements.class);
private static final MethodHandle ATTRIBUTE_PROVIDER_MAP = NMS.getFirstGetter(AttributeSupplier.class, Map.class);
private static final MethodHandle ATTRIBUTE_PROVIDER_MAP_SETTER = NMS.getFirstFinalSetter(AttributeSupplier.class,
Map.class);
private static final MethodHandle ATTRIBUTE_SUPPLIER = NMS.getFirstGetter(AttributeMap.class,