mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-12-23 00:47:39 +01:00
Use raw data filler in 1.12->1.13
This commit is contained in:
parent
798b70cbe6
commit
c9733948b3
@ -22,6 +22,7 @@
|
||||
*/
|
||||
package com.viaversion.viaversion.api.type.types.misc;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.viaversion.viaversion.api.data.FullMappings;
|
||||
import com.viaversion.viaversion.api.protocol.Protocol;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
@ -58,6 +59,10 @@ public abstract class DynamicType<T extends IdHolder> extends Type<T> {
|
||||
}
|
||||
}
|
||||
|
||||
public RawDataFiller rawFiller() {
|
||||
return new RawDataFiller();
|
||||
}
|
||||
|
||||
public final class DataFiller {
|
||||
|
||||
private final FullMappings mappings;
|
||||
@ -65,6 +70,7 @@ public abstract class DynamicType<T extends IdHolder> extends Type<T> {
|
||||
|
||||
private DataFiller(final Protocol<?, ?, ?, ?> protocol, final boolean useMappedNames) {
|
||||
this.mappings = mappings(protocol);
|
||||
Preconditions.checkNotNull(mappings, "Mappings for %s are null", protocol.getClass());
|
||||
this.useMappedNames = useMappedNames;
|
||||
}
|
||||
|
||||
@ -72,8 +78,11 @@ public abstract class DynamicType<T extends IdHolder> extends Type<T> {
|
||||
readers.put(useMappedNames ? mappings.mappedId(identifier) : mappings.id(identifier), reader);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public DataFiller reader(final int id, final DataReader<T> reader) {
|
||||
public final class RawDataFiller {
|
||||
|
||||
public RawDataFiller reader(final int id, final DataReader<T> reader) {
|
||||
readers.put(id, reader);
|
||||
return this;
|
||||
}
|
||||
|
@ -845,7 +845,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
|
||||
RecipeData.init();
|
||||
BlockIdData.init();
|
||||
|
||||
Types1_13.PARTICLE.filler(this)
|
||||
Types1_13.PARTICLE.rawFiller()
|
||||
.reader(3, ParticleType.Readers.BLOCK)
|
||||
.reader(20, ParticleType.Readers.DUST)
|
||||
.reader(11, ParticleType.Readers.DUST)
|
||||
|
Loading…
Reference in New Issue
Block a user