Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-20 06:50:08 +01:00
Rework logging inside protocols, add Protocol#getLogger() (#3843)
Dieser Commit ist enthalten in:
Ursprung
9149f12809
Commit
fcfea24b36
@ -42,6 +42,7 @@ import com.viaversion.viaversion.api.rewriter.MappingDataListener;
|
||||
import com.viaversion.viaversion.api.rewriter.Rewriter;
|
||||
import com.viaversion.viaversion.exception.CancelException;
|
||||
import com.viaversion.viaversion.exception.InformativeException;
|
||||
import com.viaversion.viaversion.util.ProtocolLogger;
|
||||
import com.viaversion.viaversion.util.ProtocolUtil;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -71,6 +72,7 @@ public abstract class AbstractProtocol<CU extends ClientboundPacketType, CM exte
|
||||
protected final PacketMappings serverboundMappings;
|
||||
private final Map<Class<?>, Object> storedObjects = new HashMap<>();
|
||||
private boolean initialized;
|
||||
private ProtocolLogger logger;
|
||||
|
||||
@Deprecated
|
||||
protected AbstractProtocol() {
|
||||
@ -97,6 +99,10 @@ public abstract class AbstractProtocol<CU extends ClientboundPacketType, CM exte
|
||||
Preconditions.checkArgument(!initialized, "Protocol has already been initialized");
|
||||
initialized = true;
|
||||
|
||||
// Create logger if protocol does not have one
|
||||
if (getLogger() == null) {
|
||||
logger = new ProtocolLogger(getClass());
|
||||
}
|
||||
registerPackets();
|
||||
registerConfigurationChangeHandlers();
|
||||
|
||||
@ -350,8 +356,8 @@ public abstract class AbstractProtocol<CU extends ClientboundPacketType, CM exte
|
||||
|
||||
PacketMapping packetMapping = PacketMapping.of(mappedPacketType, handler);
|
||||
if (!override && packetMappings.hasMapping(packetType)) {
|
||||
Via.getPlatform().getLogger().log(Level.WARNING, packetType + " already registered!" +
|
||||
" If override is intentional, set override to true. Stacktrace: ", new Exception());
|
||||
getLogger().log(Level.WARNING, packetType + " already registered!" +
|
||||
" If override is intentional, set override to true. Stacktrace: ", new Exception());
|
||||
}
|
||||
packetMappings.addMapping(packetType, packetMapping);
|
||||
}
|
||||
@ -415,6 +421,11 @@ public abstract class AbstractProtocol<CU extends ClientboundPacketType, CM exte
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProtocolLogger getLogger() {
|
||||
return logger;
|
||||
}
|
||||
|
||||
private void printRemapError(Direction direction, State state, int unmappedPacketId, int mappedPacketId, InformativeException e) {
|
||||
// Don't print errors during handshake/login/status
|
||||
if (state != State.PLAY && direction == Direction.SERVERBOUND && !Via.getManager().debugHandler().enabled()) {
|
||||
|
@ -39,6 +39,7 @@ import com.viaversion.viaversion.api.rewriter.TagRewriter;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.exception.CancelException;
|
||||
import com.viaversion.viaversion.exception.InformativeException;
|
||||
import com.viaversion.viaversion.util.ProtocolLogger;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
/**
|
||||
@ -347,6 +348,13 @@ public interface Protocol<CU extends ClientboundPacketType, CM extends Clientbou
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the protocol's logger.
|
||||
*
|
||||
* @return logger
|
||||
*/
|
||||
ProtocolLogger getLogger();
|
||||
|
||||
/**
|
||||
* Returns the protocol's entity rewriter if present.
|
||||
*
|
||||
|
@ -141,7 +141,7 @@ public abstract class PacketHandlers implements PacketHandler {
|
||||
try {
|
||||
handler.handle(h);
|
||||
} catch (Exception e) {
|
||||
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||
if (!Via.getConfig().isSuppressConversionWarnings()) {
|
||||
Via.getPlatform().getLogger().log(Level.WARNING, "Failed to handle packet", e);
|
||||
}
|
||||
h.cancel();
|
||||
|
66
api/src/main/java/com/viaversion/viaversion/util/ProtocolLogger.java
Normale Datei
66
api/src/main/java/com/viaversion/viaversion/util/ProtocolLogger.java
Normale Datei
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
|
||||
* Copyright (C) 2016-2024 ViaVersion and contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package com.viaversion.viaversion.util;
|
||||
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.protocol.Protocol;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* Wrapper class for logging messages with the protocol name. Should be created inside the {@link Protocol} implementation.
|
||||
*/
|
||||
public class ProtocolLogger {
|
||||
|
||||
private final Logger logger;
|
||||
private final String name;
|
||||
|
||||
public ProtocolLogger(final Class<? extends Protocol> protocol) {
|
||||
this(Via.getPlatform().getLogger(), protocol);
|
||||
}
|
||||
|
||||
public ProtocolLogger(final Logger logger, final Class<? extends Protocol> protocol) {
|
||||
this.logger = logger;
|
||||
this.name = ProtocolUtil.toNiceName(protocol);
|
||||
}
|
||||
|
||||
public void log(final Level level, final String msg) {
|
||||
logger.log(level, formatMessage(msg));
|
||||
}
|
||||
|
||||
public void log(final Level level, final String msg, final Throwable thrown) {
|
||||
logger.log(level, formatMessage(msg), thrown);
|
||||
}
|
||||
|
||||
public void warning(final String msg) {
|
||||
logger.warning(formatMessage(msg));
|
||||
}
|
||||
|
||||
public void severe(final String msg) {
|
||||
logger.severe(formatMessage(msg));
|
||||
}
|
||||
|
||||
private String formatMessage(final String msg) {
|
||||
return "(" + name + ") " + msg;
|
||||
}
|
||||
}
|
@ -23,6 +23,7 @@
|
||||
package com.viaversion.viaversion.util;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.viaversion.viaversion.api.protocol.Protocol;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
import com.viaversion.viaversion.api.protocol.packet.provider.PacketTypeMap;
|
||||
@ -70,4 +71,17 @@ public final class ProtocolUtil {
|
||||
final String hex = Integer.toHexString(id).toUpperCase(Locale.ROOT);
|
||||
return (hex.length() == 1 ? "0x0" : "0x") + hex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a readable name of a protocol. For example, "Protocol1_12_2To1_13" becomes "1.12.2->1.13".
|
||||
*
|
||||
* @param protocol protocol class
|
||||
* @return readable name of the protocol
|
||||
*/
|
||||
public static String toNiceName(Class<? extends Protocol> protocol) {
|
||||
return protocol.getSimpleName().
|
||||
replace("Protocol", "").
|
||||
replace("To", "->").
|
||||
replace("_", ".");
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
package com.viaversion.viaversion.configuration;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.configuration.ViaVersionConfig;
|
||||
import com.viaversion.viaversion.api.minecraft.WorldIdentifiers;
|
||||
import com.viaversion.viaversion.api.protocol.version.BlockedProtocolVersions;
|
||||
@ -412,7 +413,7 @@ public abstract class AbstractViaConfig extends Config implements ViaVersionConf
|
||||
|
||||
@Override
|
||||
public boolean isSuppressConversionWarnings() {
|
||||
return suppressConversionWarnings;
|
||||
return suppressConversionWarnings && !Via.getManager().isDebug(); // Debug mode overrules config
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,14 +23,12 @@ import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.ClientWorld;
|
||||
import com.viaversion.viaversion.api.minecraft.chunks.Chunk;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_11;
|
||||
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.ValueTransformer;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_9_3;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_9;
|
||||
import com.viaversion.viaversion.protocols.v1_10to1_11.data.PotionColors1_11;
|
||||
import com.viaversion.viaversion.protocols.v1_10to1_11.rewriter.EntityPacketRewriter1_11;
|
||||
import com.viaversion.viaversion.protocols.v1_10to1_11.data.BlockEntityNames1_11;
|
||||
@ -43,6 +41,7 @@ import com.viaversion.viaversion.rewriter.SoundRewriter;
|
||||
import com.viaversion.viaversion.util.Pair;
|
||||
|
||||
public class Protocol1_10To1_11 extends AbstractProtocol<ClientboundPackets1_9_3, ClientboundPackets1_9_3, ServerboundPackets1_9_3, ServerboundPackets1_9_3> {
|
||||
|
||||
private static final ValueTransformer<Float, Short> toOldByte = new ValueTransformer<>(Types.UNSIGNED_BYTE) {
|
||||
@Override
|
||||
public Short transform(PacketWrapper wrapper, Float inputValue) {
|
||||
@ -160,7 +159,7 @@ public class Protocol1_10To1_11 extends AbstractProtocol<ClientboundPackets1_9_3
|
||||
boolean isInstant = false;
|
||||
Pair<Integer, Boolean> newData = PotionColors1_11.getNewData(data);
|
||||
if (newData == null) {
|
||||
Via.getPlatform().getLogger().warning("Received unknown 1.11 -> 1.10.2 potion data (" + data + ")");
|
||||
getLogger().warning("Received unknown potion data: " + data);
|
||||
data = 0;
|
||||
} else {
|
||||
data = newData.key();
|
||||
|
@ -81,7 +81,7 @@ public class EntityPacketRewriter1_11 extends EntityRewriter<ClientboundPackets1
|
||||
// Change Type :)
|
||||
int type = wrapper.get(Types.VAR_INT, 1);
|
||||
|
||||
EntityTypes1_11.EntityType entType = EntityPacketRewriter1_11.rewriteEntityType(type, wrapper.get(Types1_9.METADATA_LIST, 0));
|
||||
EntityTypes1_11.EntityType entType = rewriteEntityType(type, wrapper.get(Types1_9.METADATA_LIST, 0));
|
||||
if (entType != null) {
|
||||
wrapper.set(Types.VAR_INT, 1, entType.getId());
|
||||
|
||||
@ -253,7 +253,7 @@ public class EntityPacketRewriter1_11 extends EntityRewriter<ClientboundPackets1
|
||||
return EntityTypes1_11.getTypeFromId(type, true);
|
||||
}
|
||||
|
||||
public static EntityType rewriteEntityType(int numType, List<Metadata> metadata) {
|
||||
public EntityType rewriteEntityType(int numType, List<Metadata> metadata) {
|
||||
Optional<EntityType> optType = EntityType.findById(numType);
|
||||
if (optType.isEmpty()) {
|
||||
Via.getManager().getPlatform().getLogger().severe("Error: could not find Entity type " + numType + " with metadata: " + metadata);
|
||||
@ -326,16 +326,16 @@ public class EntityPacketRewriter1_11 extends EntityRewriter<ClientboundPackets1
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (!Via.getConfig().isSuppressMetadataErrors() || Via.getManager().isDebug()) {
|
||||
Via.getPlatform().getLogger().warning("An error occurred with entity type rewriter");
|
||||
Via.getPlatform().getLogger().warning("Metadata: " + metadata);
|
||||
Via.getPlatform().getLogger().log(Level.WARNING, "Error: ", e);
|
||||
protocol.getLogger().warning("An error occurred with entity type rewriter");
|
||||
protocol.getLogger().warning("Metadata: " + metadata);
|
||||
protocol.getLogger().log(Level.WARNING, "Error: ", e);
|
||||
}
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
public static Optional<Metadata> getById(List<Metadata> metadatas, int id) {
|
||||
public Optional<Metadata> getById(List<Metadata> metadatas, int id) {
|
||||
for (Metadata metadata : metadatas) {
|
||||
if (metadata.id() == id) return Optional.of(metadata);
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.protocols.v1_11_1to1_12.Protocol1_11_1To1_12;
|
||||
import com.viaversion.viaversion.protocols.v1_9_1to1_9_3.packet.ClientboundPackets1_9_3;
|
||||
import com.viaversion.viaversion.rewriter.ComponentRewriter;
|
||||
import com.viaversion.viaversion.util.SerializerVersion;
|
||||
@ -86,8 +87,8 @@ public class TranslateRewriter {
|
||||
hoverEvent.addProperty("action", "show_text");
|
||||
hoverEvent.add("value", baseArray);
|
||||
} catch (Exception e) {
|
||||
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||
Via.getPlatform().getLogger().log(Level.WARNING, "Error rewriting show_achievement: " + hoverEvent, e);
|
||||
if (!Via.getConfig().isSuppressConversionWarnings()) {
|
||||
protocol.getLogger().log(Level.WARNING, "Error rewriting show_achievement: " + hoverEvent, e);
|
||||
}
|
||||
JsonObject invalidText = new JsonObject();
|
||||
invalidText.addProperty("text", "Invalid statistic/achievement!");
|
||||
|
@ -69,6 +69,7 @@ import com.viaversion.viaversion.util.ChatColorUtil;
|
||||
import com.viaversion.viaversion.util.ComponentUtil;
|
||||
import com.viaversion.viaversion.util.GsonUtil;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
import com.viaversion.viaversion.util.ProtocolLogger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -79,6 +80,7 @@ import java.util.logging.Level;
|
||||
public class Protocol1_12_2To1_13 extends AbstractProtocol<ClientboundPackets1_12_1, ClientboundPackets1_13, ServerboundPackets1_12_1, ServerboundPackets1_13> {
|
||||
|
||||
public static final MappingData1_13 MAPPINGS = new MappingData1_13();
|
||||
public static final ProtocolLogger LOGGER = new ProtocolLogger(Protocol1_12_2To1_13.class);
|
||||
// These are arbitrary rewrite values, it just needs an invalid color code character.
|
||||
private static final Map<Character, Character> SCOREBOARD_TEAM_NAME_REWRITE = new HashMap<>();
|
||||
private static final Set<Character> FORMATTING_CODES = Sets.newHashSet('k', 'l', 'm', 'n', 'o', 'r');
|
||||
@ -189,7 +191,7 @@ public class Protocol1_12_2To1_13 extends AbstractProtocol<ClientboundPackets1_1
|
||||
}
|
||||
wrapper.set(Types.STRING, 0, GsonUtil.getGson().toJson(json));
|
||||
} catch (JsonParseException e) {
|
||||
Via.getPlatform().getLogger().log(Level.SEVERE, "Error transforming status response", e);
|
||||
LOGGER.log(Level.SEVERE, "Error transforming status response", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -214,7 +216,7 @@ public class Protocol1_12_2To1_13 extends AbstractProtocol<ClientboundPackets1_1
|
||||
if (newIdRaw != null) {
|
||||
newId = newIdRaw;
|
||||
} else {
|
||||
Via.getPlatform().getLogger().warning("Could not find 1.13 -> 1.12.2 statistic mapping for " + name);
|
||||
LOGGER.warning("Could not find statistic mapping for " + name);
|
||||
}
|
||||
} else if (split.length > 2) {
|
||||
String category = split[1];
|
||||
@ -900,6 +902,11 @@ public class Protocol1_12_2To1_13 extends AbstractProtocol<ClientboundPackets1_1
|
||||
return MAPPINGS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProtocolLogger getLogger() {
|
||||
return LOGGER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityPacketRewriter1_13 getEntityRewriter() {
|
||||
return entityRewriter;
|
||||
|
@ -19,7 +19,7 @@ package com.viaversion.viaversion.protocols.v1_12_2to1_13.data;
|
||||
|
||||
import com.google.common.collect.ObjectArrays;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.protocols.v1_12_2to1_13.Protocol1_12_2To1_13;
|
||||
import com.viaversion.viaversion.util.GsonUtil;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
@ -54,7 +54,7 @@ public class BlockIdData {
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Via.getPlatform().getLogger().log(Level.SEVERE, "Failed to load block id mappings (1.12.2 -> 1.13)", e);
|
||||
Protocol1_12_2To1_13.LOGGER.log(Level.SEVERE, "Failed to load block id mappings", e);
|
||||
}
|
||||
|
||||
InputStream blockS = MappingData1_13.class.getClassLoader()
|
||||
@ -67,7 +67,7 @@ public class BlockIdData {
|
||||
);
|
||||
numberIdToString.putAll(map);
|
||||
} catch (IOException e) {
|
||||
Via.getPlatform().getLogger().log(Level.SEVERE, "Failed to load block number to string mappings (1.12.2)", e);
|
||||
Protocol1_12_2To1_13.LOGGER.log(Level.SEVERE, "Failed to load block number to string mappings", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
import com.viaversion.viaversion.protocols.v1_12_2to1_13.Protocol1_12_2To1_13;
|
||||
import com.viaversion.viaversion.rewriter.ComponentRewriter;
|
||||
import com.viaversion.viaversion.util.ComponentUtil;
|
||||
import com.viaversion.viaversion.util.ProtocolLogger;
|
||||
import com.viaversion.viaversion.util.SerializerVersion;
|
||||
import java.util.logging.Level;
|
||||
|
||||
@ -54,8 +55,8 @@ public class ComponentRewriter1_13<C extends ClientboundPacketType> extends Comp
|
||||
try {
|
||||
tag = ComponentUtil.deserializeLegacyShowItem(value, SerializerVersion.V1_12);
|
||||
} catch (Exception e) {
|
||||
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||
Via.getPlatform().getLogger().log(Level.WARNING, "Error reading 1.12.2 NBT in show_item: " + value, e);
|
||||
if (!Via.getConfig().isSuppressConversionWarnings()) {
|
||||
Protocol1_12_2To1_13.LOGGER.log(Level.WARNING, "Error reading NBT in show_item: " + value, e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -86,8 +87,8 @@ public class ComponentRewriter1_13<C extends ClientboundPacketType> extends Comp
|
||||
showItem.addProperty("text", SerializerVersion.V1_13.toSNBT(tag));
|
||||
hoverEvent.add("value", newValue);
|
||||
} catch (Exception e) {
|
||||
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||
Via.getPlatform().getLogger().log(Level.WARNING, "Error writing 1.13 NBT in show_item: " + value, e);
|
||||
if (!Via.getConfig().isSuppressConversionWarnings()) {
|
||||
Protocol1_12_2To1_13.LOGGER.log(Level.WARNING, "Error writing NBT in show_item: " + value, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ public class MappingData1_13 extends MappingDataBase {
|
||||
String oldChannel = entry.getKey();
|
||||
String newChannel = entry.getValue().getAsString();
|
||||
if (!Key.isValid(newChannel)) {
|
||||
Via.getPlatform().getLogger().warning("Channel '" + newChannel + "' is not a valid 1.13 plugin channel, please check your configuration!");
|
||||
getLogger().warning("Channel '" + newChannel + "' is not a valid 1.13 plugin channel, please check your configuration!");
|
||||
continue;
|
||||
}
|
||||
channelMappings.put(oldChannel, newChannel);
|
||||
|
@ -20,7 +20,6 @@ package com.viaversion.viaversion.protocols.v1_12_2to1_13.data;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.minecraft.item.DataItem;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viaversion.protocols.v1_12_2to1_13.Protocol1_12_2To1_13;
|
||||
import com.viaversion.viaversion.protocols.v1_12_2to1_13.rewriter.WorldPacketRewriter1_13;
|
||||
@ -96,7 +95,7 @@ public class ParticleRewriter {
|
||||
|
||||
public static Particle rewriteParticle(int particleId, Integer[] data) {
|
||||
if (particleId >= particles.size()) {
|
||||
Via.getPlatform().getLogger().severe("Failed to transform particles with id " + particleId + " and data " + Arrays.toString(data));
|
||||
Protocol1_12_2To1_13.LOGGER.severe("Failed to transform particles with id " + particleId + " and data " + Arrays.toString(data));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,6 @@ import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.Position;
|
||||
import com.viaversion.viaversion.api.platform.providers.Provider;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viaversion.protocols.v1_12_2to1_13.Protocol1_12_2To1_13;
|
||||
import com.viaversion.viaversion.protocols.v1_12_2to1_13.packet.ClientboundPackets1_13;
|
||||
@ -65,7 +64,7 @@ public class BlockEntityProvider implements Provider {
|
||||
BlockEntityHandler handler = handlers.get(idTag.getValue());
|
||||
if (handler == null) {
|
||||
if (Via.getManager().isDebug()) {
|
||||
Via.getPlatform().getLogger().warning("Unhandled BlockEntity " + idTag.getValue() + " full tag: " + tag);
|
||||
Protocol1_12_2To1_13.LOGGER.warning("Unhandled BlockEntity " + idTag.getValue() + " full tag: " + tag);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -21,9 +21,9 @@ import com.viaversion.nbt.tag.CompoundTag;
|
||||
import com.viaversion.nbt.tag.ListTag;
|
||||
import com.viaversion.nbt.tag.NumberTag;
|
||||
import com.viaversion.nbt.tag.StringTag;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.Position;
|
||||
import com.viaversion.viaversion.protocols.v1_12_2to1_13.Protocol1_12_2To1_13;
|
||||
import com.viaversion.viaversion.protocols.v1_12_2to1_13.provider.BlockEntityProvider;
|
||||
import com.viaversion.viaversion.protocols.v1_12_2to1_13.storage.BlockStorage;
|
||||
import com.viaversion.viaversion.util.ComponentUtil;
|
||||
@ -41,7 +41,7 @@ public class BannerHandler implements BlockEntityProvider.BlockEntityHandler {
|
||||
Position position = new Position(tag.getNumberTag("x").asInt(), tag.getNumberTag("y").asShort(), tag.getNumberTag("z").asInt());
|
||||
|
||||
if (!storage.contains(position)) {
|
||||
Via.getPlatform().getLogger().warning("Received an banner color update packet, but there is no banner! O_o " + tag);
|
||||
Protocol1_12_2To1_13.LOGGER.warning("Received an banner color update packet, but there is no banner! O_o " + tag);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ public class BannerHandler implements BlockEntityProvider.BlockEntityHandler {
|
||||
} else if (blockId >= WALL_BANNER_START && blockId <= WALL_BANNER_STOP) {
|
||||
blockId += ((15 - color) * 4);
|
||||
} else {
|
||||
Via.getPlatform().getLogger().warning("Why does this block have the banner block entity? :(" + tag);
|
||||
Protocol1_12_2To1_13.LOGGER.warning("Why does this block have the banner block entity? :(" + tag);
|
||||
}
|
||||
|
||||
ListTag<CompoundTag> patterns = tag.getListTag("Patterns", CompoundTag.class);
|
||||
|
@ -19,9 +19,9 @@ package com.viaversion.viaversion.protocols.v1_12_2to1_13.provider.blockentities
|
||||
|
||||
import com.viaversion.nbt.tag.CompoundTag;
|
||||
import com.viaversion.nbt.tag.NumberTag;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.Position;
|
||||
import com.viaversion.viaversion.protocols.v1_12_2to1_13.Protocol1_12_2To1_13;
|
||||
import com.viaversion.viaversion.protocols.v1_12_2to1_13.provider.BlockEntityProvider;
|
||||
import com.viaversion.viaversion.protocols.v1_12_2to1_13.storage.BlockStorage;
|
||||
|
||||
@ -33,7 +33,7 @@ public class BedHandler implements BlockEntityProvider.BlockEntityHandler {
|
||||
Position position = new Position(tag.getNumberTag("x").asInt(), tag.getNumberTag("y").asShort(), tag.getNumberTag("z").asInt());
|
||||
|
||||
if (!storage.contains(position)) {
|
||||
Via.getPlatform().getLogger().warning("Received an bed color update packet, but there is no bed! O_o " + tag);
|
||||
Protocol1_12_2To1_13.LOGGER.warning("Received an bed color update packet, but there is no bed! O_o " + tag);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -19,9 +19,9 @@ package com.viaversion.viaversion.protocols.v1_12_2to1_13.provider.blockentities
|
||||
|
||||
import com.viaversion.nbt.tag.CompoundTag;
|
||||
import com.viaversion.nbt.tag.NumberTag;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.Position;
|
||||
import com.viaversion.viaversion.protocols.v1_12_2to1_13.Protocol1_12_2To1_13;
|
||||
import com.viaversion.viaversion.protocols.v1_12_2to1_13.provider.BlockEntityProvider;
|
||||
import com.viaversion.viaversion.protocols.v1_12_2to1_13.storage.BlockStorage;
|
||||
|
||||
@ -35,7 +35,7 @@ public class SkullHandler implements BlockEntityProvider.BlockEntityHandler {
|
||||
Position position = new Position(tag.getNumberTag("x").asInt(), tag.getNumberTag("y").asShort(), tag.getNumberTag("z").asInt());
|
||||
|
||||
if (!storage.contains(position)) {
|
||||
Via.getPlatform().getLogger().warning("Received an head update packet, but there is no head! O_o " + tag);
|
||||
Protocol1_12_2To1_13.LOGGER.warning("Received an head update packet, but there is no head! O_o " + tag);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ public class SkullHandler implements BlockEntityProvider.BlockEntityHandler {
|
||||
id += rot.asInt();
|
||||
}
|
||||
} else {
|
||||
Via.getPlatform().getLogger().warning("Why does this block have the skull block entity? " + tag);
|
||||
Protocol1_12_2To1_13.LOGGER.warning("Why does this block have the skull block entity? " + tag);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -29,8 +29,8 @@ import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viaversion.protocols.v1_11_1to1_12.Protocol1_11_1To1_12;
|
||||
import com.viaversion.viaversion.protocols.v1_12_2to1_13.packet.ClientboundPackets1_13;
|
||||
import com.viaversion.viaversion.protocols.v1_12_2to1_13.packet.ServerboundPackets1_13;
|
||||
import com.viaversion.viaversion.protocols.v1_12to1_12_1.packet.ClientboundPackets1_12_1;
|
||||
@ -43,6 +43,7 @@ import com.viaversion.viaversion.rewriter.ItemRewriter;
|
||||
import com.viaversion.viaversion.util.ComponentUtil;
|
||||
import com.viaversion.viaversion.util.IdAndData;
|
||||
import com.viaversion.viaversion.util.Key;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -120,11 +121,10 @@ public class ItemPacketRewriter1_13 extends ItemRewriter<ClientboundPackets1_12_
|
||||
flags |= 1;
|
||||
Optional<SoundSource> finalSource = SoundSource.findBySource(originalSource);
|
||||
if (finalSource.isEmpty()) {
|
||||
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||
Via.getPlatform().getLogger().info("Could not handle unknown sound source " + originalSource + " falling back to default: master");
|
||||
if (!Via.getConfig().isSuppressConversionWarnings()) {
|
||||
Protocol1_12_2To1_13.LOGGER.warning("Could not handle unknown sound source " + originalSource + " falling back to default: master");
|
||||
}
|
||||
finalSource = Optional.of(SoundSource.MASTER);
|
||||
|
||||
}
|
||||
|
||||
wrapper.write(Types.VAR_INT, finalSource.get().getId());
|
||||
@ -167,8 +167,8 @@ public class ItemPacketRewriter1_13 extends ItemRewriter<ClientboundPackets1_12_
|
||||
String old = channel;
|
||||
channel = getNewPluginChannelId(channel);
|
||||
if (channel == null) {
|
||||
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||
Via.getPlatform().getLogger().warning("Ignoring clientbound plugin message with channel: " + old);
|
||||
if (!Via.getConfig().isSuppressConversionWarnings()) {
|
||||
protocol.getLogger().warning("Ignoring clientbound plugin message with channel: " + old);
|
||||
}
|
||||
wrapper.cancel();
|
||||
return;
|
||||
@ -179,8 +179,8 @@ public class ItemPacketRewriter1_13 extends ItemRewriter<ClientboundPackets1_12_
|
||||
String rewritten = getNewPluginChannelId(s);
|
||||
if (rewritten != null) {
|
||||
rewrittenChannels.add(rewritten);
|
||||
} else if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||
Via.getPlatform().getLogger().warning("Ignoring plugin channel in clientbound " + Key.stripMinecraftNamespace(channel).toUpperCase(Locale.ROOT) + ": " + s);
|
||||
} else if (!Via.getConfig().isSuppressConversionWarnings()) {
|
||||
protocol.getLogger().warning("Ignoring plugin channel in clientbound " + Key.stripMinecraftNamespace(channel).toUpperCase(Locale.ROOT) + ": " + s);
|
||||
}
|
||||
}
|
||||
if (!rewrittenChannels.isEmpty()) {
|
||||
@ -231,8 +231,8 @@ public class ItemPacketRewriter1_13 extends ItemRewriter<ClientboundPackets1_12_
|
||||
String old = channel;
|
||||
channel = getOldPluginChannelId(channel);
|
||||
if (channel == null) {
|
||||
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||
Via.getPlatform().getLogger().warning("Ignoring serverbound plugin message with channel: " + old);
|
||||
if (!Via.getConfig().isSuppressConversionWarnings()) {
|
||||
protocol.getLogger().warning("Ignoring serverbound plugin message with channel: " + old);
|
||||
}
|
||||
wrapper.cancel();
|
||||
return;
|
||||
@ -243,8 +243,8 @@ public class ItemPacketRewriter1_13 extends ItemRewriter<ClientboundPackets1_12_
|
||||
String rewritten = getOldPluginChannelId(s);
|
||||
if (rewritten != null) {
|
||||
rewrittenChannels.add(rewritten);
|
||||
} else if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||
Via.getPlatform().getLogger().warning("Ignoring plugin channel in serverbound " + channel + ": " + s);
|
||||
} else if (!Via.getConfig().isSuppressConversionWarnings()) {
|
||||
protocol.getLogger().warning("Ignoring plugin channel in serverbound " + channel + ": " + s);
|
||||
}
|
||||
}
|
||||
wrapper.write(Types.REMAINING_BYTES, Joiner.on('\0').join(rewrittenChannels).getBytes(StandardCharsets.UTF_8));
|
||||
@ -465,8 +465,8 @@ public class ItemPacketRewriter1_13 extends ItemRewriter<ClientboundPackets1_12_
|
||||
} else if (Protocol1_12_2To1_13.MAPPINGS.getItemMappings().getNewId(IdAndData.removeData(rawId)) != -1) {
|
||||
rawId = IdAndData.removeData(rawId);
|
||||
} else {
|
||||
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||
Via.getPlatform().getLogger().warning("Failed to get 1.13 item for " + item.identifier());
|
||||
if (!Via.getConfig().isSuppressConversionWarnings()) {
|
||||
protocol.getLogger().warning("Failed to get new item for " + item.identifier());
|
||||
}
|
||||
rawId = 16; // Stone
|
||||
}
|
||||
@ -547,8 +547,8 @@ public class ItemPacketRewriter1_13 extends ItemRewriter<ClientboundPackets1_12_
|
||||
}
|
||||
|
||||
if (rawId == null) {
|
||||
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||
Via.getPlatform().getLogger().warning("Failed to get 1.12 item for " + item.identifier());
|
||||
if (!Via.getConfig().isSuppressConversionWarnings()) {
|
||||
protocol.getLogger().warning("Failed to get old item for " + item.identifier());
|
||||
}
|
||||
rawId = 0x10000; // Stone
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ import com.viaversion.viaversion.api.minecraft.chunks.DataPalette;
|
||||
import com.viaversion.viaversion.api.minecraft.chunks.PaletteType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_13;
|
||||
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_9_3;
|
||||
@ -89,9 +88,8 @@ public class WorldPacketRewriter1_13 {
|
||||
String motive = wrapper.read(Types.STRING);
|
||||
|
||||
Optional<Integer> id = provider.getIntByIdentifier(motive);
|
||||
|
||||
if (id.isEmpty() && (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug())) {
|
||||
Via.getPlatform().getLogger().warning("Could not find painting motive: " + motive + " falling back to default (0)");
|
||||
if (id.isEmpty() && !Via.getConfig().isSuppressConversionWarnings()) {
|
||||
Protocol1_12_2To1_13.LOGGER.warning("Could not find painting motive: " + motive + " falling back to default (0)");
|
||||
}
|
||||
wrapper.write(Types.VAR_INT, id.orElse(0));
|
||||
});
|
||||
@ -410,8 +408,8 @@ public class WorldPacketRewriter1_13 {
|
||||
if (!VALID_BIOMES.contains(biome)) {
|
||||
if (biome != 255 // is it generated naturally? *shrug*
|
||||
&& latestBiomeWarn != biome) {
|
||||
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||
Via.getPlatform().getLogger().warning("Received invalid biome id " + biome);
|
||||
if (!Via.getConfig().isSuppressConversionWarnings()) {
|
||||
Protocol1_12_2To1_13.LOGGER.warning("Received invalid biome id: " + biome);
|
||||
}
|
||||
latestBiomeWarn = biome;
|
||||
}
|
||||
@ -573,13 +571,13 @@ public class WorldPacketRewriter1_13 {
|
||||
}
|
||||
newId = Protocol1_12_2To1_13.MAPPINGS.getBlockMappings().getNewId(IdAndData.removeData(oldId)); // Remove data
|
||||
if (newId != -1) {
|
||||
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||
Via.getPlatform().getLogger().warning("Missing block " + oldId);
|
||||
if (!Via.getConfig().isSuppressConversionWarnings()) {
|
||||
Protocol1_12_2To1_13.LOGGER.warning("Missing block " + oldId);
|
||||
}
|
||||
return newId;
|
||||
}
|
||||
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||
Via.getPlatform().getLogger().warning("Missing block completely " + oldId);
|
||||
if (!Via.getConfig().isSuppressConversionWarnings()) {
|
||||
Protocol1_12_2To1_13.LOGGER.warning("Missing block completely " + oldId);
|
||||
}
|
||||
// Default air
|
||||
return 0;
|
||||
|
@ -25,13 +25,11 @@ import com.viaversion.nbt.tag.Tag;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.item.DataItem;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viaversion.protocols.v1_12_2to1_13.packet.ClientboundPackets1_13;
|
||||
import com.viaversion.viaversion.protocols.v1_12_2to1_13.packet.ServerboundPackets1_13;
|
||||
@ -44,6 +42,7 @@ import com.viaversion.viaversion.rewriter.ItemRewriter;
|
||||
import com.viaversion.viaversion.rewriter.RecipeRewriter;
|
||||
import com.viaversion.viaversion.util.ComponentUtil;
|
||||
import com.viaversion.viaversion.util.Key;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
@ -127,7 +126,7 @@ public class ItemPacketRewriter1_14 extends ItemRewriter<ClientboundPackets1_13,
|
||||
}
|
||||
|
||||
if (typeId == -1) {
|
||||
Via.getPlatform().getLogger().warning("Can't open inventory for 1.14 player! Type: " + type + " Size: " + slots);
|
||||
protocol.getLogger().warning("Can't open inventory for player! Type: " + type + " Size: " + slots);
|
||||
}
|
||||
|
||||
wrapper.write(Types.VAR_INT, typeId);
|
||||
|
@ -52,6 +52,7 @@ import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
||||
import com.viaversion.viaversion.rewriter.TagRewriter;
|
||||
import com.viaversion.viaversion.util.GsonUtil;
|
||||
import com.viaversion.viaversion.util.Key;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -170,7 +171,7 @@ public class Protocol1_15_2To1_16 extends AbstractProtocol<ClientboundPackets1_1
|
||||
final String namespacedChannel = Key.namespaced(channel);
|
||||
if (channel.length() > 32) {
|
||||
if (!Via.getConfig().isSuppressConversionWarnings()) {
|
||||
Via.getPlatform().getLogger().warning("Ignoring serverbound plugin channel, as it is longer than 32 characters: " + channel);
|
||||
getLogger().warning("Ignoring serverbound plugin channel, as it is longer than 32 characters: " + channel);
|
||||
}
|
||||
wrapper.cancel();
|
||||
} else if (namespacedChannel.equals("minecraft:register") || namespacedChannel.equals("minecraft:unregister")) {
|
||||
@ -179,8 +180,7 @@ public class Protocol1_15_2To1_16 extends AbstractProtocol<ClientboundPackets1_1
|
||||
for (String registeredChannel : channels) {
|
||||
if (registeredChannel.length() > 32) {
|
||||
if (!Via.getConfig().isSuppressConversionWarnings()) {
|
||||
Via.getPlatform().getLogger().warning("Ignoring serverbound plugin channel register of '"
|
||||
+ registeredChannel + "', as it is longer than 32 characters");
|
||||
getLogger().warning("Ignoring serverbound plugin channel register of '" + registeredChannel + "', as it is longer than 32 characters");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -36,11 +36,12 @@ import com.viaversion.viaversion.protocols.v1_15_2to1_16.packet.ServerboundPacke
|
||||
import com.viaversion.viaversion.protocols.v1_15_2to1_16.storage.InventoryTracker1_16;
|
||||
import com.viaversion.viaversion.rewriter.EntityRewriter;
|
||||
import com.viaversion.viaversion.util.Key;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class EntityPacketRewriter1_16 extends EntityRewriter<ClientboundPackets1_15, Protocol1_15_2To1_16> {
|
||||
|
||||
private static final PacketHandler DIMENSION_HANDLER = wrapper -> {
|
||||
private final PacketHandler DIMENSION_HANDLER = wrapper -> {
|
||||
WorldIdentifiers map = Via.getConfig().get1_16WorldNamesMap();
|
||||
WorldIdentifiers userMap = wrapper.user().get(WorldIdentifiers.class);
|
||||
if (userMap != null) {
|
||||
@ -63,7 +64,7 @@ public class EntityPacketRewriter1_16 extends EntityRewriter<ClientboundPackets1
|
||||
outputName = map.end();
|
||||
break;
|
||||
default:
|
||||
Via.getPlatform().getLogger().warning("Invalid dimension id: " + dimension);
|
||||
protocol.getLogger().warning("Invalid dimension id: " + dimension);
|
||||
dimensionName = "minecraft:overworld";
|
||||
outputName = map.overworld();
|
||||
}
|
||||
@ -166,7 +167,7 @@ public class EntityPacketRewriter1_16 extends EntityRewriter<ClientboundPackets1
|
||||
attributeIdentifier = Key.namespaced(key);
|
||||
if (!Key.isValid(attributeIdentifier)) {
|
||||
if (!Via.getConfig().isSuppressConversionWarnings()) {
|
||||
Via.getPlatform().getLogger().warning("Invalid attribute: " + key);
|
||||
protocol.getLogger().warning("Invalid attribute: " + key);
|
||||
}
|
||||
actualSize--;
|
||||
wrapper.read(Types.DOUBLE);
|
||||
|
@ -18,7 +18,6 @@
|
||||
package com.viaversion.viaversion.protocols.v1_16_1to1_16_2.rewriter;
|
||||
|
||||
import com.viaversion.nbt.tag.CompoundTag;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_16_2;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
@ -106,7 +105,7 @@ public class EntityPacketRewriter1_16_2 extends EntityRewriter<ClientboundPacket
|
||||
private CompoundTag getDimensionData(String dimensionType) {
|
||||
CompoundTag tag = Protocol1_16_1To1_16_2.MAPPINGS.getDimensionDataMap().get(dimensionType);
|
||||
if (tag == null) {
|
||||
Via.getPlatform().getLogger().severe("Could not get dimension data of " + dimensionType);
|
||||
protocol.getLogger().severe("Could not get dimension data of " + dimensionType);
|
||||
throw new NullPointerException("Dimension data for " + dimensionType + " is null!");
|
||||
}
|
||||
return tag.copy();
|
||||
|
@ -24,7 +24,6 @@ import com.viaversion.viaversion.api.minecraft.RegistryType;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_17;
|
||||
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viaversion.api.type.types.misc.ParticleType;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_18;
|
||||
@ -39,10 +38,12 @@ import com.viaversion.viaversion.protocols.v1_17to1_17_1.packet.ClientboundPacke
|
||||
import com.viaversion.viaversion.rewriter.SoundRewriter;
|
||||
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
||||
import com.viaversion.viaversion.rewriter.TagRewriter;
|
||||
import com.viaversion.viaversion.util.ProtocolLogger;
|
||||
|
||||
public final class Protocol1_17_1To1_18 extends AbstractProtocol<ClientboundPackets1_17_1, ClientboundPackets1_18, ServerboundPackets1_17, ServerboundPackets1_17> {
|
||||
|
||||
public static final MappingData MAPPINGS = new MappingDataBase("1.17", "1.18");
|
||||
public static final ProtocolLogger LOGGER = new ProtocolLogger(Protocol1_17_1To1_18.class);
|
||||
private final EntityPacketRewriter1_18 entityRewriter = new EntityPacketRewriter1_18(this);
|
||||
private final ItemPacketRewriter1_18 itemRewriter = new ItemPacketRewriter1_18(this);
|
||||
private final TagRewriter<ClientboundPackets1_17_1> tagRewriter = new TagRewriter<>(this);
|
||||
@ -104,6 +105,11 @@ public final class Protocol1_17_1To1_18 extends AbstractProtocol<ClientboundPack
|
||||
return MAPPINGS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProtocolLogger getLogger() {
|
||||
return LOGGER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(final UserConnection connection) {
|
||||
addEntityTracker(connection, new EntityTrackerBase(connection, EntityTypes1_17.PLAYER));
|
||||
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
package com.viaversion.viaversion.protocols.v1_17_1to1_18.data;
|
||||
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.protocols.v1_17_1to1_18.Protocol1_17_1To1_18;
|
||||
import java.util.Arrays;
|
||||
|
||||
public final class BlockEntityIds1_18 {
|
||||
@ -45,7 +45,7 @@ public final class BlockEntityIds1_18 {
|
||||
public static int newId(final int id) {
|
||||
final int newId;
|
||||
if (id < 0 || id > IDS.length || (newId = IDS[id]) == -1) {
|
||||
Via.getPlatform().getLogger().warning("Received out of bounds block entity id: " + id);
|
||||
Protocol1_17_1To1_18.LOGGER.warning("Received out of bounds block entity id: " + id);
|
||||
return -1;
|
||||
}
|
||||
return newId;
|
||||
|
@ -119,7 +119,7 @@ public final class WorldPacketRewriter1_18 {
|
||||
final String id = idTag.getValue();
|
||||
final int typeId = BlockEntities1_18.blockEntityIds().getInt(Key.stripMinecraftNamespace(id));
|
||||
if (typeId == -1) {
|
||||
Via.getPlatform().getLogger().warning("Unknown block entity: " + id);
|
||||
protocol.getLogger().warning("Unknown block entity: " + id);
|
||||
}
|
||||
|
||||
handleSpawners(typeId, tag);
|
||||
@ -167,7 +167,7 @@ public final class WorldPacketRewriter1_18 {
|
||||
final ChunkLightStorage.ChunkLight light = Via.getConfig().cache1_17Light() ?
|
||||
lightStorage.getLight(chunk.getX(), chunk.getZ()) : lightStorage.removeLight(chunk.getX(), chunk.getZ());
|
||||
if (light == null) {
|
||||
Via.getPlatform().getLogger().warning("No light data found for chunk at " + chunk.getX() + ", " + chunk.getZ() + ". Chunk was already loaded: " + alreadyLoaded);
|
||||
protocol.getLogger().warning("No light data found for chunk at " + chunk.getX() + ", " + chunk.getZ() + ". Chunk was already loaded: " + alreadyLoaded);
|
||||
|
||||
final BitSet emptyLightMask = new BitSet();
|
||||
emptyLightMask.set(0, tracker.currentWorldSectionHeight() + 2);
|
||||
|
@ -18,7 +18,6 @@
|
||||
package com.viaversion.viaversion.protocols.v1_18_2to1_19;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_19;
|
||||
import com.viaversion.viaversion.api.platform.providers.ViaProviders;
|
||||
@ -50,6 +49,7 @@ import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
||||
import com.viaversion.viaversion.rewriter.TagRewriter;
|
||||
import com.viaversion.viaversion.util.CipherUtil;
|
||||
import com.viaversion.viaversion.util.ComponentUtil;
|
||||
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
public final class Protocol1_18_2To1_19 extends AbstractProtocol<ClientboundPackets1_18, ClientboundPackets1_19, ServerboundPackets1_17, ServerboundPackets1_19> {
|
||||
@ -172,7 +172,7 @@ public final class Protocol1_18_2To1_19 extends AbstractProtocol<ClientboundPack
|
||||
final String argumentType = wrapper.read(Types.STRING);
|
||||
final int argumentTypeId = MAPPINGS.getArgumentTypeMappings().mappedId(argumentType);
|
||||
if (argumentTypeId == -1) {
|
||||
Via.getPlatform().getLogger().warning("Unknown command argument type: " + argumentType);
|
||||
getLogger().warning("Unknown command argument type: " + argumentType);
|
||||
}
|
||||
|
||||
wrapper.write(Types.VAR_INT, argumentTypeId);
|
||||
|
@ -33,7 +33,6 @@ import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_19;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_18;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_19;
|
||||
@ -274,16 +273,16 @@ public final class EntityPacketRewriter1_19 extends EntityRewriter<ClientboundPa
|
||||
});
|
||||
}
|
||||
|
||||
private static void writeDimensionKey(final PacketWrapper wrapper, final DimensionRegistryStorage registryStorage) {
|
||||
private void writeDimensionKey(final PacketWrapper wrapper, final DimensionRegistryStorage registryStorage) {
|
||||
// Find dimension key by data
|
||||
final CompoundTag currentDimension = wrapper.read(Types.NAMED_COMPOUND_TAG);
|
||||
addMonsterSpawnData(currentDimension);
|
||||
String dimensionKey = registryStorage.dimensionKey(currentDimension);
|
||||
if (dimensionKey == null) {
|
||||
if (!Via.getConfig().isSuppressConversionWarnings()) {
|
||||
Via.getPlatform().getLogger().warning("The server tried to send dimension data from a dimension the client wasn't told about on join. " +
|
||||
"Plugins and mods have to make sure they are not creating new dimension types while players are online, and proxies need to make sure they don't scramble dimension data." +
|
||||
" Received dimension: " + currentDimension + ". Known dimensions: " + registryStorage.dimensions());
|
||||
protocol.getLogger().warning("The server tried to send dimension data from a dimension the client wasn't told about on join. " +
|
||||
"Plugins and mods have to make sure they are not creating new dimension types while players are online, and proxies need to make sure they don't scramble dimension data." +
|
||||
" Received dimension: " + currentDimension + ". Known dimensions: " + registryStorage.dimensions());
|
||||
}
|
||||
|
||||
// Try to find the most similar dimension
|
||||
@ -298,7 +297,7 @@ public final class EntityPacketRewriter1_19 extends EntityRewriter<ClientboundPa
|
||||
wrapper.write(Types.STRING, dimensionKey);
|
||||
}
|
||||
|
||||
private static int to3dId(final int id) {
|
||||
private int to3dId(final int id) {
|
||||
return switch (id) {
|
||||
case -1 -> 1; // Up/down -> Up
|
||||
case 2 -> 2; // North
|
||||
@ -309,7 +308,7 @@ public final class EntityPacketRewriter1_19 extends EntityRewriter<ClientboundPa
|
||||
};
|
||||
}
|
||||
|
||||
private static void addMonsterSpawnData(final CompoundTag dimension) {
|
||||
private void addMonsterSpawnData(final CompoundTag dimension) {
|
||||
// The actual values here don't matter
|
||||
dimension.put("monster_spawn_block_light_limit", new IntTag(0));
|
||||
dimension.put("monster_spawn_light_level", new IntTag(11));
|
||||
|
@ -47,6 +47,7 @@ import com.viaversion.viaversion.protocols.v1_19to1_19_1.storage.ChatTypeStorage
|
||||
import com.viaversion.viaversion.protocols.v1_19to1_19_1.storage.NonceStorage1_19_1;
|
||||
import com.viaversion.viaversion.util.CipherUtil;
|
||||
import com.viaversion.viaversion.util.Pair;
|
||||
import com.viaversion.viaversion.util.ProtocolLogger;
|
||||
import com.viaversion.viaversion.util.TagUtil;
|
||||
import java.security.SignatureException;
|
||||
import java.util.ArrayList;
|
||||
@ -62,6 +63,8 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public final class Protocol1_19To1_19_1 extends AbstractProtocol<ClientboundPackets1_19, ClientboundPackets1_19_1, ServerboundPackets1_19, ServerboundPackets1_19_1> {
|
||||
|
||||
public static final ProtocolLogger LOGGER = new ProtocolLogger(Protocol1_19To1_19_1.class);
|
||||
|
||||
public Protocol1_19To1_19_1() {
|
||||
super(ClientboundPackets1_19.class, ClientboundPackets1_19_1.class, ServerboundPackets1_19.class, ServerboundPackets1_19_1.class);
|
||||
}
|
||||
@ -297,7 +300,7 @@ public final class Protocol1_19To1_19_1 extends AbstractProtocol<ClientboundPack
|
||||
data = new byte[]{1};
|
||||
wrapper.set(Types.REMAINING_BYTES, 0, data);
|
||||
} else {
|
||||
Via.getPlatform().getLogger().warning("Received unexpected data in velocity:player_info (length=" + data.length + ")");
|
||||
LOGGER.warning("Received unexpected data in velocity:player_info (length=" + data.length + ")");
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -310,6 +313,11 @@ public final class Protocol1_19To1_19_1 extends AbstractProtocol<ClientboundPack
|
||||
connection.put(new ChatTypeStorage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProtocolLogger getLogger() {
|
||||
return LOGGER;
|
||||
}
|
||||
|
||||
public static @Nullable ChatDecorationResult decorateChatMessage(
|
||||
final CompoundTag chatType,
|
||||
final int chatTypeId,
|
||||
@ -318,7 +326,7 @@ public final class Protocol1_19To1_19_1 extends AbstractProtocol<ClientboundPack
|
||||
final JsonElement message
|
||||
) {
|
||||
if (chatType == null) {
|
||||
Via.getPlatform().getLogger().warning("Chat message has unknown chat type id " + chatTypeId + ". Message: " + message);
|
||||
LOGGER.warning("Chat message has unknown chat type id " + chatTypeId + ". Message: " + message);
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -403,7 +411,7 @@ public final class Protocol1_19To1_19_1 extends AbstractProtocol<ClientboundPack
|
||||
argument = targetName;
|
||||
break;
|
||||
default:
|
||||
Via.getPlatform().getLogger().warning("Unknown parameter for chat decoration: " + element.getValue());
|
||||
LOGGER.warning("Unknown parameter for chat decoration: " + element.getValue());
|
||||
}
|
||||
if (argument != null) {
|
||||
arguments.add(SerializerVersion.V1_18.toComponent(argument));
|
||||
|
@ -27,7 +27,6 @@ import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
import com.viaversion.viaversion.api.protocol.packet.provider.PacketTypesProvider;
|
||||
import com.viaversion.viaversion.api.protocol.packet.provider.SimplePacketTypesProvider;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viaversion.api.type.types.misc.ParticleType;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_20_5;
|
||||
@ -56,6 +55,7 @@ import com.viaversion.viaversion.rewriter.ComponentRewriter;
|
||||
import com.viaversion.viaversion.rewriter.SoundRewriter;
|
||||
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
|
||||
import com.viaversion.viaversion.rewriter.TagRewriter;
|
||||
import com.viaversion.viaversion.util.ProtocolLogger;
|
||||
import java.util.UUID;
|
||||
|
||||
import static com.viaversion.viaversion.util.ProtocolUtil.packetTypeMap;
|
||||
@ -63,6 +63,7 @@ import static com.viaversion.viaversion.util.ProtocolUtil.packetTypeMap;
|
||||
public final class Protocol1_20_3To1_20_5 extends AbstractProtocol<ClientboundPacket1_20_3, ClientboundPacket1_20_5, ServerboundPacket1_20_3, ServerboundPacket1_20_5> {
|
||||
|
||||
public static final MappingData1_20_5 MAPPINGS = new MappingData1_20_5();
|
||||
public static final ProtocolLogger LOGGER = new ProtocolLogger(Protocol1_20_3To1_20_5.class);
|
||||
// Mojang will remove this in the next release, so if we were to set this to false,
|
||||
// people would miss the changes and not fix their plugins before forcefully running into the errors then
|
||||
public static boolean strictErrorHandling = System.getProperty("viaversion.strict-error-handling1_20_5", "true").equalsIgnoreCase("true");
|
||||
@ -294,6 +295,11 @@ public final class Protocol1_20_3To1_20_5 extends AbstractProtocol<ClientboundPa
|
||||
return MAPPINGS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProtocolLogger getLogger() {
|
||||
return LOGGER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityPacketRewriter1_20_5 getEntityRewriter() {
|
||||
return entityRewriter;
|
||||
|
@ -75,7 +75,6 @@ import com.viaversion.viaversion.api.minecraft.item.data.ToolProperties;
|
||||
import com.viaversion.viaversion.api.minecraft.item.data.ToolRule;
|
||||
import com.viaversion.viaversion.api.minecraft.item.data.Unbreakable;
|
||||
import com.viaversion.viaversion.api.minecraft.item.data.WrittenBook;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_20_2;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_20_3;
|
||||
@ -264,7 +263,7 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<Clientboun
|
||||
particle.add(Types.VAR_INT, wrapper.read(Types.VAR_INT)); // Target entity
|
||||
particle.add(Types.FLOAT, wrapper.read(Types.FLOAT)); // Y offset
|
||||
} else {
|
||||
Via.getPlatform().getLogger().warning("Unknown vibration path position source type: " + sourceTypeId);
|
||||
protocol.getLogger().warning("Unknown vibration path position source type: " + sourceTypeId);
|
||||
}
|
||||
particle.add(Types.VAR_INT, wrapper.read(Types.VAR_INT)); // Arrival in ticks
|
||||
} else if (particleId == mappings.id("sculk_charge")) {
|
||||
@ -804,7 +803,7 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<Clientboun
|
||||
tag = SNBT.deserializeCompoundTag(rawPredicate.substring(tagStartIndex, tagEndIndex + 1));
|
||||
} catch (final Exception e) {
|
||||
if (Via.getManager().isDebug()) {
|
||||
Via.getPlatform().getLogger().log(Level.SEVERE, "Failed to parse block predicate tag: " + rawPredicate.substring(tagStartIndex, tagEndIndex + 1), e);
|
||||
Protocol1_20_3To1_20_5.LOGGER.log(Level.SEVERE, "Failed to parse block predicate tag: " + rawPredicate.substring(tagStartIndex, tagEndIndex + 1), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -215,8 +215,8 @@ public class ComponentRewriter1_20_5<C extends ClientboundPacketType> extends Co
|
||||
try {
|
||||
tagTag = tag != null ? (CompoundTag) SerializerVersion.V1_20_3.toTag(tag.getValue()) : null;
|
||||
} catch (final Exception e) {
|
||||
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||
Via.getPlatform().getLogger().log(Level.WARNING, "Error reading 1.20.3 NBT in show_item: " + contentsTag, e);
|
||||
if (!Via.getConfig().isSuppressConversionWarnings()) {
|
||||
protocol.getLogger().log(Level.WARNING, "Error reading NBT in show_item: " + contentsTag, e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -249,8 +249,8 @@ public class ComponentRewriter1_20_5<C extends ClientboundPacketType> extends Co
|
||||
try {
|
||||
components = toTag(data, false);
|
||||
} catch (final Exception e) {
|
||||
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||
Via.getPlatform().getLogger().log(Level.WARNING, "Error writing 1.20.5 components in show_item!", e);
|
||||
if (!Via.getConfig().isSuppressConversionWarnings()) {
|
||||
protocol.getLogger().log(Level.WARNING, "Error writing components in show_item!", e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
*/
|
||||
package com.viaversion.viaversion.protocols.v1_8to1_9.rewriter;
|
||||
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.data.entity.EntityTracker;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_10;
|
||||
import com.viaversion.viaversion.api.minecraft.item.DataItem;
|
||||
@ -199,7 +198,7 @@ public class SpawnPacketRewriter1_9 {
|
||||
if (tracker.hasEntity(entityId)) {
|
||||
protocol.getEntityRewriter().handleMetadata(entityId, metadataList, wrapper.user());
|
||||
} else {
|
||||
Via.getPlatform().getLogger().warning("Unable to find entity for metadata, entity ID: " + entityId);
|
||||
protocol.getLogger().warning("Unable to find entity for metadata, entity ID: " + entityId);
|
||||
metadataList.clear();
|
||||
}
|
||||
});
|
||||
@ -277,7 +276,7 @@ public class SpawnPacketRewriter1_9 {
|
||||
if (tracker.hasEntity(entityId)) {
|
||||
protocol.getEntityRewriter().handleMetadata(entityId, metadataList, wrapper.user());
|
||||
} else {
|
||||
Via.getPlatform().getLogger().warning("Unable to find entity for metadata, entity ID: " + entityId);
|
||||
protocol.getLogger().warning("Unable to find entity for metadata, entity ID: " + entityId);
|
||||
metadataList.clear();
|
||||
}
|
||||
});
|
||||
|
@ -34,7 +34,6 @@ import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viaversion.protocols.base.ClientboundLoginPackets;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
@ -176,7 +175,7 @@ public class ComponentRewriter<C extends ClientboundPacketType> {
|
||||
return root;
|
||||
} catch (final JsonSyntaxException e) {
|
||||
if (Via.getManager().isDebug()) {
|
||||
Via.getPlatform().getLogger().severe("Error when trying to parse json: " + value);
|
||||
protocol.getLogger().severe("Error when trying to parse json: " + value);
|
||||
throw e;
|
||||
}
|
||||
// Yay to malformed json being accepted
|
||||
|
@ -56,7 +56,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.stream.Collectors;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
@ -395,14 +394,14 @@ public abstract class EntityRewriter<C extends ClientboundPacketType, T extends
|
||||
int blockHeight = height.asInt();
|
||||
tracker.setCurrentWorldSectionHeight(blockHeight >> 4);
|
||||
} else {
|
||||
Via.getPlatform().getLogger().warning("Height missing in dimension data: " + registryData);
|
||||
protocol.getLogger().warning("Height missing in dimension data: " + registryData);
|
||||
}
|
||||
|
||||
NumberTag minY = registryData.getNumberTag("min_y");
|
||||
if (minY != null) {
|
||||
tracker.setCurrentMinY(minY.asInt());
|
||||
} else {
|
||||
Via.getPlatform().getLogger().warning("Min Y missing in dimension data: " + registryData);
|
||||
protocol.getLogger().warning("Min Y missing in dimension data: " + registryData);
|
||||
}
|
||||
|
||||
String world = wrapper.get(Types.STRING, 0);
|
||||
@ -420,7 +419,7 @@ public abstract class EntityRewriter<C extends ClientboundPacketType, T extends
|
||||
String dimensionKey = wrapper.get(Types.STRING, 0);
|
||||
DimensionData dimensionData = tracker.dimensionData(dimensionKey);
|
||||
if (dimensionData == null) {
|
||||
Via.getPlatform().getLogger().severe("Dimension data missing for dimension: " + dimensionKey + ", falling back to overworld");
|
||||
protocol.getLogger().severe("Dimension data missing for dimension: " + dimensionKey + ", falling back to overworld");
|
||||
dimensionData = tracker.dimensionData("minecraft:overworld");
|
||||
Preconditions.checkNotNull(dimensionData, "Overworld data missing");
|
||||
}
|
||||
@ -443,7 +442,7 @@ public abstract class EntityRewriter<C extends ClientboundPacketType, T extends
|
||||
int dimensionId = wrapper.get(Types.VAR_INT, dimensionIdIndex);
|
||||
DimensionData dimensionData = tracker.dimensionData(dimensionId);
|
||||
if (dimensionData == null) {
|
||||
Via.getPlatform().getLogger().severe("Dimension data missing for dimension: " + dimensionId + ", falling back to overworld");
|
||||
protocol.getLogger().severe("Dimension data missing for dimension: " + dimensionId + ", falling back to overworld");
|
||||
dimensionData = tracker.dimensionData("minecraft:overworld");
|
||||
Preconditions.checkNotNull(dimensionData, "Overworld data missing");
|
||||
}
|
||||
@ -602,12 +601,11 @@ public abstract class EntityRewriter<C extends ClientboundPacketType, T extends
|
||||
|
||||
private void logException(Exception e, @Nullable EntityType type, List<Metadata> metadataList, Metadata metadata) {
|
||||
if (!Via.getConfig().isSuppressMetadataErrors() || Via.getManager().isDebug()) {
|
||||
Logger logger = Via.getPlatform().getLogger();
|
||||
logger.severe("An error occurred in metadata handler " + this.getClass().getSimpleName()
|
||||
protocol.getLogger().severe("An error occurred in metadata handler " + this.getClass().getSimpleName()
|
||||
+ " for " + (type != null ? type.name() : "untracked") + " entity type: " + metadata);
|
||||
logger.severe(metadataList.stream().sorted(Comparator.comparingInt(Metadata::id))
|
||||
protocol.getLogger().severe(metadataList.stream().sorted(Comparator.comparingInt(Metadata::id))
|
||||
.map(Metadata::toString).collect(Collectors.joining("\n", "Full metadata: ", "")));
|
||||
logger.log(Level.SEVERE, "Error: ", e);
|
||||
protocol.getLogger().log(Level.SEVERE, "Error: ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren