Some consistency cleanup

This commit is contained in:
FlorianMichael 2024-04-13 22:32:56 +02:00
parent 4e25549682
commit 2be190d152
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
4 changed files with 9 additions and 11 deletions

View File

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

View File

@ -58,7 +58,7 @@ public final class BlockPredicate {
private final StatePropertyMatcher[] propertyMatchers;
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.propertyMatchers = propertyMatchers;
this.tag = tag;
@ -68,7 +68,7 @@ public final class BlockPredicate {
return holderSet;
}
public StatePropertyMatcher @Nullable [] propertyMatchers() {
public @Nullable StatePropertyMatcher[] propertyMatchers() {
return propertyMatchers;
}

View File

@ -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.Type;
import com.viaversion.viaversion.api.type.types.ArrayType;
import io.netty.buffer.ByteBuf;
import org.checkerframework.checker.nullness.qual.Nullable;
@ -60,7 +59,7 @@ public final class PotionEffectData {
private final boolean ambient;
private final boolean showParticles;
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,
final boolean showIcon, @Nullable final PotionEffectData hiddenEffect) {

View File

@ -94,7 +94,7 @@ import java.util.logging.Level;
public class ComponentRewriter1_20_5 extends ComponentRewriter<ClientboundPacket1_20_3> {
@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) {
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());
} catch (Exception e) {
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;
}
@ -241,8 +241,8 @@ public class ComponentRewriter1_20_5 extends ComponentRewriter<ClientboundPacket
final CompoundTag tag = new CompoundTag();
for (final Map.Entry<StructuredDataKey<?>, StructuredData<?>> entry : data.entrySet()) {
final StructuredDataKey<?> key = entry.getKey();
if (!handlers.containsKey(key)) { // Should NOT happen
Via.getPlatform().getLogger().severe("No handler for " + key.identifier() + " found!");
if (!rewriters.containsKey(key)) { // Should NOT happen
Via.getPlatform().getLogger().severe("No converter for " + key.identifier() + " found!");
continue;
}
final StructuredData<?> value = entry.getValue();
@ -251,7 +251,7 @@ public class ComponentRewriter1_20_5 extends ComponentRewriter<ClientboundPacket
}
//noinspection unchecked
final Tag valueTag = handlers.get(key).convert(value.value());
final Tag valueTag = rewriters.get(key).convert(value.value());
if (valueTag == null) continue;
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) {
handlers.put(key, converter);
rewriters.put(key, converter);
}
public SerializerVersion serializerVersion() {