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") @SuppressWarnings("rawtypes")
public class CustomEntityRegistry extends DefaultedMappedRegistry<EntityType<?>> 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<ResourceLocation, EntityType> entities = HashBiMap.create();
private final BiMap<EntityType, ResourceLocation> entityClasses = this.entities.inverse(); private final BiMap<EntityType, ResourceLocation> entityClasses = this.entities.inverse();
private final Map<EntityType, Integer> entityIds = Maps.newHashMap(); 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 { public CustomEntityRegistry(DefaultedRegistry<EntityType<?>> original) throws Throwable {
super(original.getDefaultKey().getNamespace(), super(original.getDefaultKey().getNamespace(),
(ResourceKey<? extends Registry<EntityType<?>>>) IREGISTRY_RESOURCE_KEY.invoke(original), (ResourceKey<? extends Registry<EntityType<?>>>) IREGISTRY_RESOURCE_KEY.invoke(original),
(Lifecycle) IREGISTRY_LIFECYCLE.invoke(original), true); (Lifecycle) IREGISTRY_LIFECYCLE.invoke(original), true);
this.wrapped = (DefaultedMappedRegistry<EntityType<?>>) original; this.wrapped = (MappedRegistry<EntityType<?>>) original;
} }
@Override @Override
@ -212,7 +212,7 @@ public class CustomEntityRegistry extends DefaultedMappedRegistry<EntityType<?>>
} }
@Override @Override
public DefaultedMappedRegistry<EntityType<?>> get() { public MappedRegistry<EntityType<?>> get() {
return wrapped; return wrapped;
} }

View File

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