3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 16:40:10 +01:00

Some consistency cleanup

Dieser Commit ist enthalten in:
FlorianMichael 2024-04-13 22:32:56 +02:00
Ursprung 4e25549682
Commit 2be190d152
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: C2FB87E71C425126
4 geänderte Dateien mit 9 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -25,7 +25,6 @@ package com.viaversion.viaversion.api.minecraft.item.data;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
// This goes DEEEP
public final class AdventureModePredicate { public final class AdventureModePredicate {
public static final Type<AdventureModePredicate> TYPE = new Type<AdventureModePredicate>(AdventureModePredicate.class) { public static final Type<AdventureModePredicate> TYPE = new Type<AdventureModePredicate>(AdventureModePredicate.class) {

Datei anzeigen

@ -58,7 +58,7 @@ public final class BlockPredicate {
private final StatePropertyMatcher[] propertyMatchers; private final StatePropertyMatcher[] propertyMatchers;
private final CompoundTag tag; private final CompoundTag tag;
public BlockPredicate(@Nullable final HolderSet holderSet, final StatePropertyMatcher @Nullable [] propertyMatchers, @Nullable final CompoundTag tag) { public BlockPredicate(@Nullable final HolderSet holderSet, @Nullable final StatePropertyMatcher[] propertyMatchers, @Nullable final CompoundTag tag) {
this.holderSet = holderSet; this.holderSet = holderSet;
this.propertyMatchers = propertyMatchers; this.propertyMatchers = propertyMatchers;
this.tag = tag; this.tag = tag;
@ -68,7 +68,7 @@ public final class BlockPredicate {
return holderSet; return holderSet;
} }
public StatePropertyMatcher @Nullable [] propertyMatchers() { public @Nullable StatePropertyMatcher[] propertyMatchers() {
return propertyMatchers; return propertyMatchers;
} }

Datei anzeigen

@ -24,7 +24,6 @@ package com.viaversion.viaversion.api.minecraft.item.data;
import com.viaversion.viaversion.api.type.OptionalType; import com.viaversion.viaversion.api.type.OptionalType;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.api.type.types.ArrayType;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
@ -60,7 +59,7 @@ public final class PotionEffectData {
private final boolean ambient; private final boolean ambient;
private final boolean showParticles; private final boolean showParticles;
private final boolean showIcon; private final boolean showIcon;
private final PotionEffectData hiddenEffect; // RECURSIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVESIVE private final PotionEffectData hiddenEffect;
public PotionEffectData(final int amplifier, final int duration, final boolean ambient, final boolean showParticles, public PotionEffectData(final int amplifier, final int duration, final boolean ambient, final boolean showParticles,
final boolean showIcon, @Nullable final PotionEffectData hiddenEffect) { final boolean showIcon, @Nullable final PotionEffectData hiddenEffect) {

Datei anzeigen

@ -94,7 +94,7 @@ import java.util.logging.Level;
public class ComponentRewriter1_20_5 extends ComponentRewriter<ClientboundPacket1_20_3> { public class ComponentRewriter1_20_5 extends ComponentRewriter<ClientboundPacket1_20_3> {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
protected final Map<StructuredDataKey, DataConverter> handlers = new HashMap<>(); protected final Map<StructuredDataKey, DataConverter> rewriters = new HashMap<>();
public ComponentRewriter1_20_5(final Protocol<ClientboundPacket1_20_3, ?, ?, ?> protocol) { public ComponentRewriter1_20_5(final Protocol<ClientboundPacket1_20_3, ?, ?, ?> protocol) {
super(protocol, ReadType.NBT); super(protocol, ReadType.NBT);
@ -201,7 +201,7 @@ public class ComponentRewriter1_20_5 extends ComponentRewriter<ClientboundPacket
tagTag = (CompoundTag) SerializerVersion.V1_20_3.toTag(tag.getValue()); tagTag = (CompoundTag) SerializerVersion.V1_20_3.toTag(tag.getValue());
} catch (Exception e) { } catch (Exception e) {
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) { if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
Via.getPlatform().getLogger().log(Level.WARNING, "Error reading 1.30.3 NBT in show_item: " + contentsTag, e); Via.getPlatform().getLogger().log(Level.WARNING, "Error reading 1.20.3 NBT in show_item: " + contentsTag, e);
} }
return; return;
} }
@ -241,8 +241,8 @@ public class ComponentRewriter1_20_5 extends ComponentRewriter<ClientboundPacket
final CompoundTag tag = new CompoundTag(); final CompoundTag tag = new CompoundTag();
for (final Map.Entry<StructuredDataKey<?>, StructuredData<?>> entry : data.entrySet()) { for (final Map.Entry<StructuredDataKey<?>, StructuredData<?>> entry : data.entrySet()) {
final StructuredDataKey<?> key = entry.getKey(); final StructuredDataKey<?> key = entry.getKey();
if (!handlers.containsKey(key)) { // Should NOT happen if (!rewriters.containsKey(key)) { // Should NOT happen
Via.getPlatform().getLogger().severe("No handler for " + key.identifier() + " found!"); Via.getPlatform().getLogger().severe("No converter for " + key.identifier() + " found!");
continue; continue;
} }
final StructuredData<?> value = entry.getValue(); final StructuredData<?> value = entry.getValue();
@ -251,7 +251,7 @@ public class ComponentRewriter1_20_5 extends ComponentRewriter<ClientboundPacket
} }
//noinspection unchecked //noinspection unchecked
final Tag valueTag = handlers.get(key).convert(value.value()); final Tag valueTag = rewriters.get(key).convert(value.value());
if (valueTag == null) continue; if (valueTag == null) continue;
tag.put(key.identifier(), valueTag); tag.put(key.identifier(), valueTag);
@ -1016,7 +1016,7 @@ public class ComponentRewriter1_20_5 extends ComponentRewriter<ClientboundPacket
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
private <T> void register(final StructuredDataKey<T> key, final DataConverter<T> converter) { private <T> void register(final StructuredDataKey<T> key, final DataConverter<T> converter) {
handlers.put(key, converter); rewriters.put(key, converter);
} }
public SerializerVersion serializerVersion() { public SerializerVersion serializerVersion() {