Showing with 24 additions and 2 deletions.
  1. +24 −2 src/main/java/org/spongepowered/common/data/SpongeManipulatorRegistry.java
@@ -179,6 +179,13 @@ public <M extends DataManipulator<M, I>, I extends ImmutableDataManipulator<I, M
public DataRegistration<?, ?> getRegistrationFor(DataManipulator<?, ?> manipulator) {
final DataRegistration<?, ?> dataRegistration = this.manipulatorRegistrationMap.get(manipulator.getClass());
if (dataRegistration == null) {
if (this.tempRegistry != null) {
for (SpongeDataRegistration<?, ?> registration : this.tempRegistry.registrations) {
if (registration.getManipulatorClass() == manipulator.getClass()) {
return registration;
}
}
}
throw new DataRegistrationNotFoundException("Could not locate a DataRegistration for class " + manipulator.getClass());
}
return dataRegistration;
@@ -187,6 +194,13 @@ public <M extends DataManipulator<M, I>, I extends ImmutableDataManipulator<I, M
public DataRegistration<?, ?> getRegistrationFor(ImmutableDataManipulator<?, ?> immutable) {
final DataRegistration<?, ?> dataRegistration = this.immutableRegistrationMap.get(immutable.getClass());
if (dataRegistration == null) {
if (this.tempRegistry != null) {
for (SpongeDataRegistration<?, ?> registration : this.tempRegistry.registrations) {
if (registration.getImmutableManipulatorClass() == immutable.getClass()) {
return registration;
}
}
}
throw new DataRegistrationNotFoundException("Could not locate a DataRegistration for class " + immutable.getClass());
}
return dataRegistration;
@@ -291,9 +305,17 @@ public <E, V extends BaseValue<E>> void registerValueProcessor(Key<V> key, Value
if (this.tempRegistry != null) {
// During soft registrations
if (DataManipulator.class.isAssignableFrom(mClass)) {
return new DataProcessorDelegate(ImmutableList.copyOf(this.tempRegistry.processorMap.get(mClass)));
List<DataProcessor<?, ?>> dataProcessors = this.tempRegistry.processorMap.get(mClass);
if (dataProcessors == null) {
return null;
}
return new DataProcessorDelegate(ImmutableList.copyOf(dataProcessors));
} else {
return new DataProcessorDelegate(ImmutableList.copyOf(this.tempRegistry.immutableProcessorMap.get(mClass)));
List<DataProcessor<?, ?>> dataProcessors = this.tempRegistry.immutableProcessorMap.get(mClass);
if (dataProcessors == null) {
return null;
}
return new DataProcessorDelegate(ImmutableList.copyOf(dataProcessors));
}
}
return DataManipulator.class.isAssignableFrom(mClass)