Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 16:12:42 +01:00
Merge remote-tracking branch 'upstream/abstraction' into primitive_types
Dieser Commit ist enthalten in:
Commit
d6b52bcc54
@ -1,4 +1,4 @@
|
|||||||
# ViaVersion 2.1.3 - Spigot, Sponge, BungeeCord, Velocity
|
# ViaVersion 2.2.0 - Spigot, Sponge, BungeeCord, Velocity
|
||||||
[![Build Status](https://travis-ci.com/ViaVersion/ViaVersion.svg?branch=master)](https://travis-ci.com/ViaVersion/ViaVersion)
|
[![Build Status](https://travis-ci.com/ViaVersion/ViaVersion.svg?branch=master)](https://travis-ci.com/ViaVersion/ViaVersion)
|
||||||
[![Discord](https://img.shields.io/badge/chat-on%20discord-blue.svg)](https://viaversion.com/discord)
|
[![Discord](https://img.shields.io/badge/chat-on%20discord-blue.svg)](https://viaversion.com/discord)
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package us.myles.ViaVersion.bukkit.platform;
|
package us.myles.ViaVersion.bukkit.platform;
|
||||||
|
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
import us.myles.ViaVersion.AbstractViaConfig;
|
import us.myles.ViaVersion.AbstractViaConfig;
|
||||||
import us.myles.ViaVersion.ViaVersionPlugin;
|
|
||||||
import us.myles.ViaVersion.api.Via;
|
import us.myles.ViaVersion.api.Via;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -12,13 +12,27 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class BukkitViaConfig extends AbstractViaConfig {
|
public class BukkitViaConfig extends AbstractViaConfig {
|
||||||
private static final List<String> UNSUPPORTED = Arrays.asList("bungee-ping-interval", "bungee-ping-save", "bungee-servers", "velocity-ping-interval", "velocity-ping-save", "velocity-servers");
|
private static final List<String> UNSUPPORTED = Arrays.asList("bungee-ping-interval", "bungee-ping-save", "bungee-servers", "velocity-ping-interval", "velocity-ping-save", "velocity-servers");
|
||||||
|
private boolean antiXRay;
|
||||||
|
private boolean quickMoveActionFix;
|
||||||
|
private boolean hitboxFix1_9;
|
||||||
|
private boolean hitboxFix1_14;
|
||||||
|
private String blockConnectionMethod;
|
||||||
|
|
||||||
public BukkitViaConfig() {
|
public BukkitViaConfig() {
|
||||||
super(new File(((ViaVersionPlugin) Via.getPlatform()).getDataFolder(), "config.yml"));
|
super(new File(((Plugin) Via.getPlatform()).getDataFolder(), "config.yml"));
|
||||||
// Load config
|
|
||||||
reloadConfig();
|
reloadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void loadFields() {
|
||||||
|
super.loadFields();
|
||||||
|
antiXRay = getBoolean("anti-xray-patch", true);
|
||||||
|
quickMoveActionFix = getBoolean("quick-move-action-fix", false);
|
||||||
|
hitboxFix1_9 = getBoolean("change-1_9-hitbox", false);
|
||||||
|
hitboxFix1_14 = getBoolean("change-1_14-hitbox", false);
|
||||||
|
blockConnectionMethod = getString("blockconnection-method", "packet");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public URL getDefaultConfigURL() {
|
public URL getDefaultConfigURL() {
|
||||||
return BukkitViaConfig.class.getClassLoader().getResource("assets/viaversion/config.yml");
|
return BukkitViaConfig.class.getClassLoader().getResource("assets/viaversion/config.yml");
|
||||||
@ -28,6 +42,31 @@ public class BukkitViaConfig extends AbstractViaConfig {
|
|||||||
protected void handleConfig(Map<String, Object> config) {
|
protected void handleConfig(Map<String, Object> config) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAntiXRay() {
|
||||||
|
return antiXRay;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean is1_12QuickMoveActionFix() {
|
||||||
|
return quickMoveActionFix;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean is1_9HitboxFix() {
|
||||||
|
return hitboxFix1_9;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean is1_14HitboxFix() {
|
||||||
|
return hitboxFix1_14;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getBlockConnectionMethod() {
|
||||||
|
return blockConnectionMethod;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getUnsupportedOptions() {
|
public List<String> getUnsupportedOptions() {
|
||||||
return UNSUPPORTED;
|
return UNSUPPORTED;
|
||||||
|
@ -10,13 +10,23 @@ import java.util.*;
|
|||||||
|
|
||||||
public class BungeeViaConfig extends AbstractViaConfig {
|
public class BungeeViaConfig extends AbstractViaConfig {
|
||||||
private static final List<String> UNSUPPORTED = Arrays.asList("nms-player-ticking", "item-cache", "anti-xray-patch", "quick-move-action-fix", "velocity-ping-interval", "velocity-ping-save", "velocity-servers", "blockconnection-method", "change-1_9-hitbox", "change-1_14-hitbox");
|
private static final List<String> UNSUPPORTED = Arrays.asList("nms-player-ticking", "item-cache", "anti-xray-patch", "quick-move-action-fix", "velocity-ping-interval", "velocity-ping-save", "velocity-servers", "blockconnection-method", "change-1_9-hitbox", "change-1_14-hitbox");
|
||||||
|
private int bungeePingInterval;
|
||||||
|
private boolean bungeePingSave;
|
||||||
|
private Map<String, Integer> bungeeServerProtocols;
|
||||||
|
|
||||||
public BungeeViaConfig(File configFile) {
|
public BungeeViaConfig(File configFile) {
|
||||||
super(new File(configFile, "config.yml"));
|
super(new File(configFile, "config.yml"));
|
||||||
// Load config
|
|
||||||
reloadConfig();
|
reloadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void loadFields() {
|
||||||
|
super.loadFields();
|
||||||
|
bungeePingInterval = getInt("bungee-ping-interval", 60);
|
||||||
|
bungeePingSave = getBoolean("bungee-ping-save", true);
|
||||||
|
bungeeServerProtocols = get("bungee-servers", Map.class, new HashMap<>());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public URL getDefaultConfigURL() {
|
public URL getDefaultConfigURL() {
|
||||||
return BungeeViaConfig.class.getClassLoader().getResource("assets/viaversion/config.yml");
|
return BungeeViaConfig.class.getClassLoader().getResource("assets/viaversion/config.yml");
|
||||||
@ -59,11 +69,6 @@ public class BungeeViaConfig extends AbstractViaConfig {
|
|||||||
return UNSUPPORTED;
|
return UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAntiXRay() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemCache() {
|
public boolean isItemCache() {
|
||||||
return false;
|
return false;
|
||||||
@ -74,26 +79,6 @@ public class BungeeViaConfig extends AbstractViaConfig {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean is1_12QuickMoveActionFix() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getBlockConnectionMethod() {
|
|
||||||
return "packet";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean is1_9HitboxFix() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean is1_14HitboxFix() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* What is the interval for checking servers via ping
|
* What is the interval for checking servers via ping
|
||||||
* -1 for disabled
|
* -1 for disabled
|
||||||
@ -101,7 +86,7 @@ public class BungeeViaConfig extends AbstractViaConfig {
|
|||||||
* @return Ping interval in seconds
|
* @return Ping interval in seconds
|
||||||
*/
|
*/
|
||||||
public int getBungeePingInterval() {
|
public int getBungeePingInterval() {
|
||||||
return getInt("bungee-ping-interval", 60);
|
return bungeePingInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -110,7 +95,7 @@ public class BungeeViaConfig extends AbstractViaConfig {
|
|||||||
* @return True if it should save
|
* @return True if it should save
|
||||||
*/
|
*/
|
||||||
public boolean isBungeePingSave() {
|
public boolean isBungeePingSave() {
|
||||||
return getBoolean("bungee-ping-save", true);
|
return bungeePingSave;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -120,6 +105,6 @@ public class BungeeViaConfig extends AbstractViaConfig {
|
|||||||
* @return Map of String, Integer
|
* @return Map of String, Integer
|
||||||
*/
|
*/
|
||||||
public Map<String, Integer> getBungeeServerProtocols() {
|
public Map<String, Integer> getBungeeServerProtocols() {
|
||||||
return get("bungee-servers", Map.class, new HashMap<>());
|
return bungeeServerProtocols;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,252 +4,349 @@ import us.myles.ViaVersion.api.ViaVersionConfig;
|
|||||||
import us.myles.ViaVersion.util.Config;
|
import us.myles.ViaVersion.util.Config;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public abstract class AbstractViaConfig extends Config implements ViaVersionConfig {
|
public abstract class AbstractViaConfig extends Config implements ViaVersionConfig {
|
||||||
|
|
||||||
|
private boolean checkForUpdates;
|
||||||
|
private boolean preventCollision;
|
||||||
|
private boolean useNewEffectIndicator;
|
||||||
|
private boolean useNewDeathmessages;
|
||||||
|
private boolean suppressMetadataErrors;
|
||||||
|
private boolean shieldBlocking;
|
||||||
|
private boolean hologramPatch;
|
||||||
|
private boolean pistonAnimationPatch;
|
||||||
|
private boolean bossbarPatch;
|
||||||
|
private boolean bossbarAntiFlicker;
|
||||||
|
private double hologramOffset;
|
||||||
|
private int maxPPS;
|
||||||
|
private String maxPPSKickMessage;
|
||||||
|
private int trackingPeriod;
|
||||||
|
private int warningPPS;
|
||||||
|
private int maxPPSWarnings;
|
||||||
|
private String maxPPSWarningsKickMessage;
|
||||||
|
private boolean sendSupportedVersions;
|
||||||
|
private boolean simulatePlayerTick;
|
||||||
|
private boolean itemCache;
|
||||||
|
private boolean nmsPlayerTicking;
|
||||||
|
private boolean replacePistons;
|
||||||
|
private int pistonReplacementId;
|
||||||
|
private boolean autoTeam;
|
||||||
|
private boolean forceJsonTransform;
|
||||||
|
private boolean nbtArrayFix;
|
||||||
|
private Set<Integer> blockedProtocols;
|
||||||
|
private String blockedDisconnectMessage;
|
||||||
|
private String reloadDisconnectMessage;
|
||||||
|
private boolean suppressConversionWarnings;
|
||||||
|
private boolean disable1_13TabComplete;
|
||||||
|
private boolean minimizeCooldown;
|
||||||
|
private boolean teamColourFix;
|
||||||
|
private boolean serversideBlockConnections;
|
||||||
|
private boolean reduceBlockStorageMemory;
|
||||||
|
private boolean flowerStemWhenBlockAbove;
|
||||||
|
private boolean snowCollisionFix;
|
||||||
|
private int tabCompleteDelay;
|
||||||
|
private boolean truncate1_14Books;
|
||||||
|
private boolean leftHandedHandling;
|
||||||
|
private boolean fullBlockLightFix;
|
||||||
|
private boolean healthNaNFix;
|
||||||
|
private boolean instantRespawn;
|
||||||
|
|
||||||
protected AbstractViaConfig(File configFile) {
|
protected AbstractViaConfig(File configFile) {
|
||||||
super(configFile);
|
super(configFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reloadConfig() {
|
||||||
|
super.reloadConfig();
|
||||||
|
loadFields();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void loadFields() {
|
||||||
|
checkForUpdates = getBoolean("checkforupdates", true);
|
||||||
|
preventCollision = getBoolean("prevent-collision", true);
|
||||||
|
useNewEffectIndicator = getBoolean("use-new-effect-indicator", true);
|
||||||
|
useNewDeathmessages = getBoolean("use-new-deathmessages", true);
|
||||||
|
suppressMetadataErrors = getBoolean("suppress-metadata-errors", false);
|
||||||
|
shieldBlocking = getBoolean("shield-blocking", true);
|
||||||
|
hologramPatch = getBoolean("hologram-patch", false);
|
||||||
|
pistonAnimationPatch = getBoolean("piston-animation-patch", false);
|
||||||
|
bossbarPatch = getBoolean("bossbar-patch", true);
|
||||||
|
bossbarAntiFlicker = getBoolean("bossbar-anti-flicker", false);
|
||||||
|
hologramOffset = getDouble("hologram-y", -0.96D);
|
||||||
|
maxPPS = getInt("max-pps", 800);
|
||||||
|
maxPPSKickMessage = getString("max-pps-kick-msg", "Sending packets too fast? lag?");
|
||||||
|
trackingPeriod = getInt("tracking-period", 6);
|
||||||
|
warningPPS = getInt("tracking-warning-pps", 120);
|
||||||
|
maxPPSWarnings = getInt("tracking-max-warnings", 3);
|
||||||
|
maxPPSWarningsKickMessage = getString("tracking-max-kick-msg", "You are sending too many packets, :(");
|
||||||
|
sendSupportedVersions = getBoolean("send-supported-versions", false);
|
||||||
|
simulatePlayerTick = getBoolean("simulate-pt", true);
|
||||||
|
itemCache = getBoolean("item-cache", true);
|
||||||
|
nmsPlayerTicking = getBoolean("nms-player-ticking", true);
|
||||||
|
replacePistons = getBoolean("replace-pistons", false);
|
||||||
|
pistonReplacementId = getInt("replacement-piston-id", 0);
|
||||||
|
autoTeam = getBoolean("auto-team", true);
|
||||||
|
forceJsonTransform = getBoolean("force-json-transform", false);
|
||||||
|
nbtArrayFix = getBoolean("chat-nbt-fix", true);
|
||||||
|
blockedProtocols = new HashSet<>(getIntegerList("block-protocols"));
|
||||||
|
blockedDisconnectMessage = getString("block-disconnect-msg", "You are using an unsupported Minecraft version!");
|
||||||
|
reloadDisconnectMessage = getString("reload-disconnect-msg", "Server reload, please rejoin!");
|
||||||
|
minimizeCooldown = getBoolean("minimize-cooldown", true);
|
||||||
|
teamColourFix = getBoolean("team-colour-fix", true);
|
||||||
|
suppressConversionWarnings = getBoolean("suppress-conversion-warnings", false);
|
||||||
|
disable1_13TabComplete = getBoolean("disable-1_13-auto-complete", false);
|
||||||
|
serversideBlockConnections = getBoolean("serverside-blockconnections", false);
|
||||||
|
reduceBlockStorageMemory = getBoolean("reduce-blockstorage-memory", false);
|
||||||
|
flowerStemWhenBlockAbove = getBoolean("flowerstem-when-block-above", false);
|
||||||
|
snowCollisionFix = getBoolean("fix-low-snow-collision", false);
|
||||||
|
tabCompleteDelay = getInt("1_13-tab-complete-delay", 0);
|
||||||
|
truncate1_14Books = getBoolean("truncate-1_14-books", false);
|
||||||
|
leftHandedHandling = getBoolean("left-handed-handling", true);
|
||||||
|
fullBlockLightFix = getBoolean("fix-non-full-blocklight", false);
|
||||||
|
healthNaNFix = getBoolean("fix-1_14-health-nan", true);
|
||||||
|
instantRespawn = getBoolean("use-1_15-instant-respawn", false);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCheckForUpdates() {
|
public boolean isCheckForUpdates() {
|
||||||
return getBoolean("checkforupdates", true);
|
return checkForUpdates;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPreventCollision() {
|
public boolean isPreventCollision() {
|
||||||
return getBoolean("prevent-collision", true);
|
return preventCollision;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNewEffectIndicator() {
|
public boolean isNewEffectIndicator() {
|
||||||
return getBoolean("use-new-effect-indicator", true);
|
return useNewEffectIndicator;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isShowNewDeathMessages() {
|
public boolean isShowNewDeathMessages() {
|
||||||
return getBoolean("use-new-deathmessages", true);
|
return useNewDeathmessages;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSuppressMetadataErrors() {
|
public boolean isSuppressMetadataErrors() {
|
||||||
return getBoolean("suppress-metadata-errors", false);
|
return suppressMetadataErrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isShieldBlocking() {
|
public boolean isShieldBlocking() {
|
||||||
return getBoolean("shield-blocking", true);
|
return shieldBlocking;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isHologramPatch() {
|
public boolean isHologramPatch() {
|
||||||
return getBoolean("hologram-patch", false);
|
return hologramPatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPistonAnimationPatch() {
|
public boolean isPistonAnimationPatch() {
|
||||||
return getBoolean("piston-animation-patch", false);
|
return pistonAnimationPatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isBossbarPatch() {
|
public boolean isBossbarPatch() {
|
||||||
return getBoolean("bossbar-patch", true);
|
return bossbarPatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isBossbarAntiflicker() {
|
public boolean isBossbarAntiflicker() {
|
||||||
return getBoolean("bossbar-anti-flicker", false);
|
return bossbarAntiFlicker;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getHologramYOffset() {
|
public double getHologramYOffset() {
|
||||||
return getDouble("hologram-y", -0.96D);
|
return hologramOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxPPS() {
|
public int getMaxPPS() {
|
||||||
return getInt("max-pps", 800);
|
return maxPPS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMaxPPSKickMessage() {
|
public String getMaxPPSKickMessage() {
|
||||||
return getString("max-pps-kick-msg", "Sending packets too fast? lag?");
|
return maxPPSKickMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTrackingPeriod() {
|
public int getTrackingPeriod() {
|
||||||
return getInt("tracking-period", 6);
|
return trackingPeriod;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getWarningPPS() {
|
public int getWarningPPS() {
|
||||||
return getInt("tracking-warning-pps", 120);
|
return warningPPS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxWarnings() {
|
public int getMaxWarnings() {
|
||||||
return getInt("tracking-max-warnings", 3);
|
return maxPPSWarnings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMaxWarningsKickMessage() {
|
public String getMaxWarningsKickMessage() {
|
||||||
return getString("tracking-max-kick-msg", "You are sending too many packets, :(");
|
return maxPPSWarningsKickMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAntiXRay() {
|
public boolean isAntiXRay() {
|
||||||
return getBoolean("anti-xray-patch", true);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSendSupportedVersions() {
|
public boolean isSendSupportedVersions() {
|
||||||
return getBoolean("send-supported-versions", false);
|
return sendSupportedVersions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isStimulatePlayerTick() {
|
public boolean isSimulatePlayerTick() {
|
||||||
return getBoolean("simulate-pt", true);
|
return simulatePlayerTick;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemCache() {
|
public boolean isItemCache() {
|
||||||
return getBoolean("item-cache", true);
|
return itemCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNMSPlayerTicking() {
|
public boolean isNMSPlayerTicking() {
|
||||||
return getBoolean("nms-player-ticking", true);
|
return nmsPlayerTicking;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isReplacePistons() {
|
public boolean isReplacePistons() {
|
||||||
return getBoolean("replace-pistons", false);
|
return replacePistons;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getPistonReplacementId() {
|
public int getPistonReplacementId() {
|
||||||
return getInt("replacement-piston-id", 0);
|
return pistonReplacementId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAutoTeam() {
|
public boolean isAutoTeam() {
|
||||||
// Collision has to be enabled first
|
// Collision has to be enabled first
|
||||||
return isPreventCollision() && getBoolean("auto-team", true);
|
return isPreventCollision() && autoTeam;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isForceJsonTransform() {
|
public boolean isForceJsonTransform() {
|
||||||
return getBoolean("force-json-transform", false);
|
return forceJsonTransform;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean is1_12NBTArrayFix() {
|
public boolean is1_12NBTArrayFix() {
|
||||||
return getBoolean("chat-nbt-fix", true);
|
return nbtArrayFix;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean is1_12QuickMoveActionFix() {
|
public boolean is1_12QuickMoveActionFix() {
|
||||||
return getBoolean("quick-move-action-fix", false);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Integer> getBlockedProtocols() {
|
public Set<Integer> getBlockedProtocols() {
|
||||||
return getIntegerList("block-protocols");
|
return blockedProtocols;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getBlockedDisconnectMsg() {
|
public String getBlockedDisconnectMsg() {
|
||||||
return getString("block-disconnect-msg", "You are using an unsupported Minecraft version!");
|
return blockedDisconnectMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getReloadDisconnectMsg() {
|
public String getReloadDisconnectMsg() {
|
||||||
return getString("reload-disconnect-msg", "Server reload, please rejoin!");
|
return reloadDisconnectMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMinimizeCooldown() {
|
public boolean isMinimizeCooldown() {
|
||||||
return getBoolean("minimize-cooldown", true);
|
return minimizeCooldown;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean is1_13TeamColourFix() {
|
public boolean is1_13TeamColourFix() {
|
||||||
return getBoolean("team-colour-fix", true);
|
return teamColourFix;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSuppress1_13ConversionErrors() {
|
public boolean isSuppressConversionWarnings() {
|
||||||
return getBoolean("suppress-1_13-conversion-errors", false);
|
return suppressConversionWarnings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDisable1_13AutoComplete() {
|
public boolean isDisable1_13AutoComplete() {
|
||||||
return getBoolean("disable-1_13-auto-complete", false);
|
return disable1_13TabComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isServersideBlockConnections() {
|
public boolean isServersideBlockConnections() {
|
||||||
return getBoolean("serverside-blockconnections", false);
|
return serversideBlockConnections;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getBlockConnectionMethod() {
|
public String getBlockConnectionMethod() {
|
||||||
return getString("blockconnection-method", "packet");
|
return "packet";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isReduceBlockStorageMemory() {
|
public boolean isReduceBlockStorageMemory() {
|
||||||
return getBoolean("reduce-blockstorage-memory", false);
|
return reduceBlockStorageMemory;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isStemWhenBlockAbove() {
|
public boolean isStemWhenBlockAbove() {
|
||||||
return getBoolean("flowerstem-when-block-above", false);
|
return flowerStemWhenBlockAbove;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSnowCollisionFix() {
|
public boolean isSnowCollisionFix() {
|
||||||
return getBoolean("fix-low-snow-collision", false);
|
return snowCollisionFix;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int get1_13TabCompleteDelay() {
|
public int get1_13TabCompleteDelay() {
|
||||||
return getInt("1_13-tab-complete-delay", 0);
|
return tabCompleteDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTruncate1_14Books() {
|
public boolean isTruncate1_14Books() {
|
||||||
return getBoolean("truncate-1_14-books", false);
|
return truncate1_14Books;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLeftHandedHandling() {
|
public boolean isLeftHandedHandling() {
|
||||||
return getBoolean("left-handed-handling", true);
|
return leftHandedHandling;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean is1_9HitboxFix() {
|
public boolean is1_9HitboxFix() {
|
||||||
return getBoolean("change-1_9-hitbox", false);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean is1_14HitboxFix() {
|
public boolean is1_14HitboxFix() {
|
||||||
return getBoolean("change-1_14-hitbox", false);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNonFullBlockLightFix() {
|
public boolean isNonFullBlockLightFix() {
|
||||||
return getBoolean("fix-non-full-blocklight", false);
|
return fullBlockLightFix;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean is1_14HealthNaNFix() {
|
public boolean is1_14HealthNaNFix() {
|
||||||
return getBoolean("fix-1_14-health-nan", true);
|
return healthNaNFix;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean is1_15InstantRespawn() {
|
public boolean is1_15InstantRespawn() {
|
||||||
return getBoolean("use-1_15-instant-respawn", false);
|
return instantRespawn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,7 @@ import us.myles.ViaVersion.protocols.base.ProtocolInfo;
|
|||||||
import us.myles.ViaVersion.util.PipelineUtil;
|
import us.myles.ViaVersion.util.PipelineUtil;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class PacketWrapper {
|
public class PacketWrapper {
|
||||||
public static final int PASSTHROUGH_ID = 1000;
|
public static final int PASSTHROUGH_ID = 1000;
|
||||||
@ -326,13 +323,14 @@ public class PacketWrapper {
|
|||||||
// Other way if outgoing
|
// Other way if outgoing
|
||||||
Collections.reverse(protocols);
|
Collections.reverse(protocols);
|
||||||
}
|
}
|
||||||
int index = 0;
|
int index = -1;
|
||||||
for (int i = 0; i < protocols.size(); i++) {
|
for (int i = 0; i < protocols.size(); i++) {
|
||||||
if (protocols.get(i).getClass().equals(packetProtocol)) {
|
if (protocols.get(i).getClass().equals(packetProtocol)) {
|
||||||
index = skipCurrentPipeline ? (i + 1) : (i);
|
index = skipCurrentPipeline ? (i + 1) : (i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (index == -1) throw new NoSuchElementException(packetProtocol.getCanonicalName());
|
||||||
|
|
||||||
// Reset reader before we start
|
// Reset reader before we start
|
||||||
resetReader();
|
resetReader();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package us.myles.ViaVersion.api;
|
package us.myles.ViaVersion.api;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Set;
|
||||||
|
|
||||||
public interface ViaVersionConfig {
|
public interface ViaVersionConfig {
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ public interface ViaVersionConfig {
|
|||||||
*
|
*
|
||||||
* @return if true, enabled
|
* @return if true, enabled
|
||||||
*/
|
*/
|
||||||
boolean isStimulatePlayerTick();
|
boolean isSimulatePlayerTick();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use the item cache to prevent high resource usage
|
* Use the item cache to prevent high resource usage
|
||||||
@ -213,7 +213,7 @@ public interface ViaVersionConfig {
|
|||||||
*
|
*
|
||||||
* @return An Integer list
|
* @return An Integer list
|
||||||
*/
|
*/
|
||||||
List<Integer> getBlockedProtocols();
|
Set<Integer> getBlockedProtocols();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the custom disconnect message
|
* Get the custom disconnect message
|
||||||
@ -231,11 +231,11 @@ public interface ViaVersionConfig {
|
|||||||
String getReloadDisconnectMsg();
|
String getReloadDisconnectMsg();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should we hide errors that occur when trying to converting to 1.13 data?
|
* Should we hide errors that occur when trying to convert block and item data over versions?
|
||||||
*
|
*
|
||||||
* @return True if enabled
|
* @return True if enabled
|
||||||
*/
|
*/
|
||||||
boolean isSuppress1_13ConversionErrors();
|
boolean isSuppressConversionWarnings();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should we disable the 1.13 auto-complete feature to stop spam kicks? (for any server lower than 1.13)
|
* Should we disable the 1.13 auto-complete feature to stop spam kicks? (for any server lower than 1.13)
|
||||||
|
@ -31,7 +31,7 @@ public class MappingDataLoader {
|
|||||||
for (Map.Entry<String, JsonElement> entry : oldIdentifiers.entrySet()) {
|
for (Map.Entry<String, JsonElement> entry : oldIdentifiers.entrySet()) {
|
||||||
Map.Entry<String, JsonElement> value = findValue(newIdentifiers, entry.getValue().getAsString());
|
Map.Entry<String, JsonElement> value = findValue(newIdentifiers, entry.getValue().getAsString());
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
Via.getPlatform().getLogger().warning("No key for " + entry.getValue() + " :( ");
|
Via.getPlatform().getLogger().warning("No key for " + entry.getValue() + " :( ");
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@ -53,7 +53,7 @@ public class MappingDataLoader {
|
|||||||
value = findValue(newIdentifiers, diffIdentifiers.get(entry.getKey()).getAsString());
|
value = findValue(newIdentifiers, diffIdentifiers.get(entry.getKey()).getAsString());
|
||||||
}
|
}
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
Via.getPlatform().getLogger().warning("No key for " + entry.getValue() + " :( ");
|
Via.getPlatform().getLogger().warning("No key for " + entry.getValue() + " :( ");
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@ -68,7 +68,7 @@ public class MappingDataLoader {
|
|||||||
JsonElement v = oldIdentifiers.get(i);
|
JsonElement v = oldIdentifiers.get(i);
|
||||||
Integer index = findIndex(newIdentifiers, v.getAsString());
|
Integer index = findIndex(newIdentifiers, v.getAsString());
|
||||||
if (index == null) {
|
if (index == null) {
|
||||||
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
Via.getPlatform().getLogger().warning("No key for " + v + " :( ");
|
Via.getPlatform().getLogger().warning("No key for " + v + " :( ");
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
@ -8,13 +8,17 @@ import java.util.Arrays;
|
|||||||
public class Mappings {
|
public class Mappings {
|
||||||
protected final short[] oldToNew;
|
protected final short[] oldToNew;
|
||||||
|
|
||||||
|
protected Mappings(short[] oldToNew) {
|
||||||
|
this.oldToNew = oldToNew;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maps old identifiers to the new ones.
|
* Maps old identifiers to the new ones.
|
||||||
* If an old value cannot be found in the new mappings, the diffmapping will be checked for the given entry.
|
* If an old value cannot be found in the new mappings, the diffmapping will be checked for the given entry.
|
||||||
*
|
*
|
||||||
* @param size set size of the underlying short array
|
* @param size set size of the underlying short array
|
||||||
* @param oldMapping mappings to map from
|
* @param oldMapping mappings to map from
|
||||||
* @param newMapping mappings to map to
|
* @param newMapping mappings to map to
|
||||||
* @param diffMapping extra mappings that will be used/scanned when an entry cannot be found
|
* @param diffMapping extra mappings that will be used/scanned when an entry cannot be found
|
||||||
*/
|
*/
|
||||||
public Mappings(int size, JsonObject oldMapping, JsonObject newMapping, JsonObject diffMapping) {
|
public Mappings(int size, JsonObject oldMapping, JsonObject newMapping, JsonObject diffMapping) {
|
||||||
@ -30,7 +34,7 @@ public class Mappings {
|
|||||||
/**
|
/**
|
||||||
* Maps old identifiers to the new ones.
|
* Maps old identifiers to the new ones.
|
||||||
*
|
*
|
||||||
* @param size set size of the underlying short array
|
* @param size set size of the underlying short array
|
||||||
* @param oldMapping mappings to map from
|
* @param oldMapping mappings to map from
|
||||||
* @param newMapping mappings to map to
|
* @param newMapping mappings to map to
|
||||||
*/
|
*/
|
||||||
@ -47,7 +51,7 @@ public class Mappings {
|
|||||||
/**
|
/**
|
||||||
* Maps old identifiers to the new ones.
|
* Maps old identifiers to the new ones.
|
||||||
*
|
*
|
||||||
* @param size set size of the underlying short array
|
* @param size set size of the underlying short array
|
||||||
* @param oldMapping mappings to map from
|
* @param oldMapping mappings to map from
|
||||||
* @param newMapping mappings to map to
|
* @param newMapping mappings to map to
|
||||||
*/
|
*/
|
||||||
|
@ -20,7 +20,7 @@ public class Entity1_10Types {
|
|||||||
type = EntityType.findById(typeID);
|
type = EntityType.findById(typeID);
|
||||||
|
|
||||||
if (!type.isPresent()) {
|
if (!type.isPresent()) {
|
||||||
Via.getPlatform().getLogger().severe("Could not find type id " + typeID + " isObject=" + isObject);
|
Via.getPlatform().getLogger().severe("Could not find 1.10 type id " + typeID + " isObject=" + isObject);
|
||||||
return EntityType.ENTITY; // Fall back to the basic ENTITY
|
return EntityType.ENTITY; // Fall back to the basic ENTITY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ public class Entity1_11Types {
|
|||||||
type = EntityType.findById(typeID);
|
type = EntityType.findById(typeID);
|
||||||
|
|
||||||
if (!type.isPresent()) {
|
if (!type.isPresent()) {
|
||||||
Via.getPlatform().getLogger().severe("Could not find type id " + typeID + " isObject=" + isObject);
|
Via.getPlatform().getLogger().severe("Could not find 1.11 type id " + typeID + " isObject=" + isObject);
|
||||||
return EntityType.ENTITY; // Fall back to the basic ENTITY
|
return EntityType.ENTITY; // Fall back to the basic ENTITY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ public class Entity1_12Types {
|
|||||||
type = EntityType.findById(typeID);
|
type = EntityType.findById(typeID);
|
||||||
|
|
||||||
if (!type.isPresent()) {
|
if (!type.isPresent()) {
|
||||||
Via.getPlatform().getLogger().severe("Could not find type id " + typeID + " isObject=" + isObject);
|
Via.getPlatform().getLogger().severe("Could not find 1.12 type id " + typeID + " isObject=" + isObject);
|
||||||
return EntityType.ENTITY; // Fall back to the basic ENTITY
|
return EntityType.ENTITY; // Fall back to the basic ENTITY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ public class Entity1_13Types {
|
|||||||
type = EntityType.findById(typeID);
|
type = EntityType.findById(typeID);
|
||||||
|
|
||||||
if (!type.isPresent()) {
|
if (!type.isPresent()) {
|
||||||
Via.getPlatform().getLogger().severe("Could not find type id " + typeID + " isObject=" + isObject);
|
Via.getPlatform().getLogger().severe("Could not find 1.13 type id " + typeID + " isObject=" + isObject);
|
||||||
return EntityType.ENTITY; // Fall back to the basic ENTITY
|
return EntityType.ENTITY; // Fall back to the basic ENTITY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ public class Entity1_14Types {
|
|||||||
Optional<EntityType> type = EntityType.findById(typeID);
|
Optional<EntityType> type = EntityType.findById(typeID);
|
||||||
|
|
||||||
if (!type.isPresent()) {
|
if (!type.isPresent()) {
|
||||||
Via.getPlatform().getLogger().severe("Could not find type id " + typeID);
|
Via.getPlatform().getLogger().severe("Could not find 1.14 type id " + typeID);
|
||||||
return EntityType.ENTITY; // Fall back to the basic ENTITY
|
return EntityType.ENTITY; // Fall back to the basic ENTITY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ public class Entity1_15Types {
|
|||||||
Optional<EntityType> type = EntityType.findById(typeID);
|
Optional<EntityType> type = EntityType.findById(typeID);
|
||||||
|
|
||||||
if (!type.isPresent()) {
|
if (!type.isPresent()) {
|
||||||
Via.getPlatform().getLogger().severe("Could not find type id " + typeID);
|
Via.getPlatform().getLogger().severe("Could not find 1.15 type id " + typeID);
|
||||||
return EntityType.ENTITY; // Fall back to the basic ENTITY
|
return EntityType.ENTITY; // Fall back to the basic ENTITY
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,11 +39,11 @@ public class Entity1_15Types {
|
|||||||
LLAMA_SPIT(40, ENTITY),
|
LLAMA_SPIT(40, ENTITY),
|
||||||
TNT(59, ENTITY),
|
TNT(59, ENTITY),
|
||||||
SHULKER_BULLET(64, ENTITY),
|
SHULKER_BULLET(64, ENTITY),
|
||||||
FISHING_BOBBER(111, ENTITY),
|
FISHING_BOBBER(102, ENTITY),
|
||||||
|
|
||||||
LIVINGENTITY(-1, ENTITY),
|
LIVINGENTITY(-1, ENTITY),
|
||||||
ARMOR_STAND(1, LIVINGENTITY),
|
ARMOR_STAND(1, LIVINGENTITY),
|
||||||
PLAYER(110, LIVINGENTITY),
|
PLAYER(101, LIVINGENTITY),
|
||||||
|
|
||||||
ABSTRACT_INSENTIENT(-1, LIVINGENTITY),
|
ABSTRACT_INSENTIENT(-1, LIVINGENTITY),
|
||||||
ENDER_DRAGON(19, ABSTRACT_INSENTIENT),
|
ENDER_DRAGON(19, ABSTRACT_INSENTIENT),
|
||||||
@ -104,7 +104,7 @@ public class Entity1_15Types {
|
|||||||
|
|
||||||
// Monsters
|
// Monsters
|
||||||
ABSTRACT_MONSTER(-1, ABSTRACT_CREATURE),
|
ABSTRACT_MONSTER(-1, ABSTRACT_CREATURE),
|
||||||
BLAZE(4, ABSTRACT_MONSTER),
|
BLAZE(5, ABSTRACT_MONSTER),
|
||||||
CREEPER(12, ABSTRACT_MONSTER),
|
CREEPER(12, ABSTRACT_MONSTER),
|
||||||
ENDERMITE(21, ABSTRACT_MONSTER),
|
ENDERMITE(21, ABSTRACT_MONSTER),
|
||||||
ENDERMAN(20, ABSTRACT_MONSTER),
|
ENDERMAN(20, ABSTRACT_MONSTER),
|
||||||
|
@ -17,6 +17,8 @@ public interface Chunk {
|
|||||||
|
|
||||||
int[] getBiomeData();
|
int[] getBiomeData();
|
||||||
|
|
||||||
|
void setBiomeData(int[] biomeData);
|
||||||
|
|
||||||
CompoundTag getHeightMap();
|
CompoundTag getHeightMap();
|
||||||
|
|
||||||
void setHeightMap(CompoundTag heightMap);
|
void setHeightMap(CompoundTag heightMap);
|
||||||
|
@ -4,7 +4,7 @@ import lombok.Getter;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import us.myles.ViaVersion.api.minecraft.metadata.MetaType;
|
import us.myles.ViaVersion.api.minecraft.metadata.MetaType;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2;
|
import us.myles.ViaVersion.api.type.types.version.Types1_13;
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Getter
|
@Getter
|
||||||
@ -24,7 +24,7 @@ public enum MetaType1_13 implements MetaType {
|
|||||||
OptUUID(12, Type.OPTIONAL_UUID),
|
OptUUID(12, Type.OPTIONAL_UUID),
|
||||||
BlockID(13, Type.VAR_INT),
|
BlockID(13, Type.VAR_INT),
|
||||||
NBTTag(14, Type.NBT),
|
NBTTag(14, Type.NBT),
|
||||||
PARTICLE(15, Protocol1_13To1_12_2.PARTICLE_TYPE),
|
PARTICLE(15, Types1_13.PARTICLE),
|
||||||
Discontinued(99, null);
|
Discontinued(99, null);
|
||||||
|
|
||||||
private final int typeID;
|
private final int typeID;
|
||||||
|
@ -4,7 +4,7 @@ import lombok.Getter;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import us.myles.ViaVersion.api.minecraft.metadata.MetaType;
|
import us.myles.ViaVersion.api.minecraft.metadata.MetaType;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13_2to1_13_1.Protocol1_13_2To1_13_1;
|
import us.myles.ViaVersion.api.type.types.version.Types1_13_2;
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Getter
|
@Getter
|
||||||
@ -24,7 +24,7 @@ public enum MetaType1_13_2 implements MetaType {
|
|||||||
OptUUID(12, Type.OPTIONAL_UUID),
|
OptUUID(12, Type.OPTIONAL_UUID),
|
||||||
BlockID(13, Type.VAR_INT),
|
BlockID(13, Type.VAR_INT),
|
||||||
NBTTag(14, Type.NBT),
|
NBTTag(14, Type.NBT),
|
||||||
PARTICLE(15, Protocol1_13_2To1_13_1.PARTICLE_TYPE),
|
PARTICLE(15, Types1_13_2.PARTICLE),
|
||||||
Discontinued(99, null);
|
Discontinued(99, null);
|
||||||
|
|
||||||
private final int typeID;
|
private final int typeID;
|
||||||
|
@ -4,7 +4,7 @@ import lombok.Getter;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import us.myles.ViaVersion.api.minecraft.metadata.MetaType;
|
import us.myles.ViaVersion.api.minecraft.metadata.MetaType;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13_2to1_13_1.Protocol1_13_2To1_13_1;
|
import us.myles.ViaVersion.api.type.types.version.Types1_14;
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Getter
|
@Getter
|
||||||
@ -24,7 +24,7 @@ public enum MetaType1_14 implements MetaType {
|
|||||||
OptUUID(12, Type.OPTIONAL_UUID),
|
OptUUID(12, Type.OPTIONAL_UUID),
|
||||||
BlockID(13, Type.VAR_INT),
|
BlockID(13, Type.VAR_INT),
|
||||||
NBTTag(14, Type.NBT),
|
NBTTag(14, Type.NBT),
|
||||||
PARTICLE(15, Protocol1_13_2To1_13_1.PARTICLE_TYPE),
|
PARTICLE(15, Types1_14.PARTICLE),
|
||||||
VillagerData(16, Type.VILLAGER_DATA),
|
VillagerData(16, Type.VILLAGER_DATA),
|
||||||
OptVarInt(17, Type.OPTIONAL_VAR_INT),
|
OptVarInt(17, Type.OPTIONAL_VAR_INT),
|
||||||
Pose(18, Type.VAR_INT),
|
Pose(18, Type.VAR_INT),
|
||||||
|
@ -77,7 +77,7 @@ public class ProtocolVersion {
|
|||||||
register(v1_14_2 = new ProtocolVersion(485, "1.14.2"));
|
register(v1_14_2 = new ProtocolVersion(485, "1.14.2"));
|
||||||
register(v1_14_3 = new ProtocolVersion(490, "1.14.3"));
|
register(v1_14_3 = new ProtocolVersion(490, "1.14.3"));
|
||||||
register(v1_14_4 = new ProtocolVersion(498, "1.14.4"));
|
register(v1_14_4 = new ProtocolVersion(498, "1.14.4"));
|
||||||
register(v1_15 = new ProtocolVersion(564, "1.15"));
|
register(v1_15 = new ProtocolVersion(573, "1.15"));
|
||||||
register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
|
register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,6 +85,18 @@ public class ItemRewriter {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void registerSetCooldown(int oldPacketId, int newPacketId, ItemIdRewriteFunction itemIDRewriteFunction) {
|
||||||
|
protocol.registerOutgoing(State.PLAY, oldPacketId, newPacketId, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
handler(wrapper -> {
|
||||||
|
int itemId = wrapper.read(Type.VAR_INT);
|
||||||
|
wrapper.write(Type.VAR_INT, itemIDRewriteFunction.rewrite(itemId));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Only sent to the client
|
// Only sent to the client
|
||||||
public PacketHandler itemArrayHandler(Type<Item[]> type) {
|
public PacketHandler itemArrayHandler(Type<Item[]> type) {
|
||||||
return wrapper -> {
|
return wrapper -> {
|
||||||
@ -108,4 +120,10 @@ public class ItemRewriter {
|
|||||||
|
|
||||||
void rewrite(Item item);
|
void rewrite(Item item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface ItemIdRewriteFunction {
|
||||||
|
|
||||||
|
int rewrite(int itemId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ public class ByteArrayType extends Type<byte[]> {
|
|||||||
@Override
|
@Override
|
||||||
public byte[] read(ByteBuf buffer) throws Exception {
|
public byte[] read(ByteBuf buffer) throws Exception {
|
||||||
int length = Type.VAR_INT.read(buffer);
|
int length = Type.VAR_INT.read(buffer);
|
||||||
Preconditions.checkArgument(!buffer.isReadable(length), "Length is fewer than readable bytes");
|
Preconditions.checkArgument(buffer.isReadable(length), "Length is fewer than readable bytes");
|
||||||
byte[] array = new byte[length];
|
byte[] array = new byte[length];
|
||||||
buffer.readBytes(array);
|
buffer.readBytes(array);
|
||||||
return array;
|
return array;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data;
|
package us.myles.ViaVersion.api.type.types;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
@ -0,0 +1,46 @@
|
|||||||
|
package us.myles.ViaVersion.api.type.types.minecraft;
|
||||||
|
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
|
import us.myles.ViaVersion.api.type.types.Particle;
|
||||||
|
|
||||||
|
public class Particle1_14Type extends Type<Particle> {
|
||||||
|
|
||||||
|
public Particle1_14Type() {
|
||||||
|
super("Particle", Particle.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(ByteBuf buffer, Particle object) throws Exception {
|
||||||
|
Type.VAR_INT.write(buffer, object.getId());
|
||||||
|
for (Particle.ParticleData data : object.getArguments())
|
||||||
|
data.getType().write(buffer, data.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Particle read(ByteBuf buffer) throws Exception {
|
||||||
|
int type = Type.VAR_INT.read(buffer);
|
||||||
|
Particle particle = new Particle(type);
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
// Block / Falling Dust /
|
||||||
|
case 3:
|
||||||
|
case 23:
|
||||||
|
particle.getArguments().add(new Particle.ParticleData(Type.VAR_INT, Type.VAR_INT.read(buffer))); // Flat Block
|
||||||
|
break;
|
||||||
|
// Dust
|
||||||
|
case 14:
|
||||||
|
particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, Type.FLOAT.read(buffer))); // Red 0 - 1
|
||||||
|
particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, Type.FLOAT.read(buffer))); // Green 0 - 1
|
||||||
|
particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, Type.FLOAT.read(buffer))); // Blue 0 - 1
|
||||||
|
particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, Type.FLOAT.read(buffer)));// Scale 0.01 - 4
|
||||||
|
break;
|
||||||
|
// Item
|
||||||
|
case 32:
|
||||||
|
particle.getArguments().add(new Particle.ParticleData(Type.FLAT_VAR_INT_ITEM, Type.FLAT_VAR_INT_ITEM.read(buffer))); // Flat item
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return particle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -3,6 +3,8 @@ package us.myles.ViaVersion.api.type.types.version;
|
|||||||
import us.myles.ViaVersion.api.minecraft.chunks.ChunkSection;
|
import us.myles.ViaVersion.api.minecraft.chunks.ChunkSection;
|
||||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
|
import us.myles.ViaVersion.api.type.types.Particle;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.types.Particle1_13Type;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -18,4 +20,9 @@ public class Types1_13 {
|
|||||||
public static final Type<Metadata> METADATA = new Metadata1_13Type();
|
public static final Type<Metadata> METADATA = new Metadata1_13Type();
|
||||||
|
|
||||||
public static final Type<ChunkSection> CHUNK_SECTION = new ChunkSectionType1_13();
|
public static final Type<ChunkSection> CHUNK_SECTION = new ChunkSectionType1_13();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Particle type for 1.13
|
||||||
|
*/
|
||||||
|
public static Type<Particle> PARTICLE = new Particle1_13Type();
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@ package us.myles.ViaVersion.api.type.types.version;
|
|||||||
|
|
||||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
|
import us.myles.ViaVersion.api.type.types.Particle;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_13_2to1_13_1.types.Particle1_13_2Type;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -15,4 +17,9 @@ public class Types1_13_2 {
|
|||||||
* Metadata type for 1.13
|
* Metadata type for 1.13
|
||||||
*/
|
*/
|
||||||
public static final Type<Metadata> METADATA = new Metadata1_13_2Type();
|
public static final Type<Metadata> METADATA = new Metadata1_13_2Type();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Particle type for 1.13.2
|
||||||
|
*/
|
||||||
|
public static Type<Particle> PARTICLE = new Particle1_13_2Type();
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@ package us.myles.ViaVersion.api.type.types.version;
|
|||||||
|
|
||||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
|
import us.myles.ViaVersion.api.type.types.Particle;
|
||||||
|
import us.myles.ViaVersion.api.type.types.minecraft.Particle1_14Type;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -15,4 +17,9 @@ public class Types1_14 {
|
|||||||
* Metadata type for 1.14
|
* Metadata type for 1.14
|
||||||
*/
|
*/
|
||||||
public static final Type<Metadata> METADATA = new Metadata1_14Type();
|
public static final Type<Metadata> METADATA = new Metadata1_14Type();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Particle type for 1.14
|
||||||
|
*/
|
||||||
|
public static final Type<Particle> PARTICLE = new Particle1_14Type();
|
||||||
}
|
}
|
||||||
|
@ -11,10 +11,8 @@ import us.myles.ViaVersion.packets.State;
|
|||||||
import us.myles.ViaVersion.protocols.protocol1_13_2to1_13_1.packets.EntityPackets;
|
import us.myles.ViaVersion.protocols.protocol1_13_2to1_13_1.packets.EntityPackets;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13_2to1_13_1.packets.InventoryPackets;
|
import us.myles.ViaVersion.protocols.protocol1_13_2to1_13_1.packets.InventoryPackets;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13_2to1_13_1.packets.WorldPackets;
|
import us.myles.ViaVersion.protocols.protocol1_13_2to1_13_1.packets.WorldPackets;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13_2to1_13_1.types.Particle1_13_2Type;
|
|
||||||
|
|
||||||
public class Protocol1_13_2To1_13_1 extends Protocol {
|
public class Protocol1_13_2To1_13_1 extends Protocol {
|
||||||
public static final Particle1_13_2Type PARTICLE_TYPE = new Particle1_13_2Type();
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerPackets() {
|
protected void registerPackets() {
|
||||||
|
@ -2,7 +2,7 @@ package us.myles.ViaVersion.protocols.protocol1_13_2to1_13_1.types;
|
|||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.Particle;
|
import us.myles.ViaVersion.api.type.types.Particle;
|
||||||
|
|
||||||
public class Particle1_13_2Type extends Type<Particle> {
|
public class Particle1_13_2Type extends Type<Particle> {
|
||||||
public Particle1_13_2Type() {
|
public Particle1_13_2Type() {
|
||||||
|
@ -33,7 +33,6 @@ import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.BlockConnectio
|
|||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.BlockStorage;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.BlockStorage;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.EntityTracker1_13;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.EntityTracker1_13;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.TabCompleteTracker;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.storage.TabCompleteTracker;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.types.Particle1_13Type;
|
|
||||||
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||||
import us.myles.ViaVersion.util.GsonUtil;
|
import us.myles.ViaVersion.util.GsonUtil;
|
||||||
|
|
||||||
@ -41,7 +40,6 @@ import java.util.EnumMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class Protocol1_13To1_12_2 extends Protocol {
|
public class Protocol1_13To1_12_2 extends Protocol {
|
||||||
public static final Particle1_13Type PARTICLE_TYPE = new Particle1_13Type();
|
|
||||||
|
|
||||||
public static final PacketHandler POS_TO_3_INT = new PacketHandler() {
|
public static final PacketHandler POS_TO_3_INT = new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -5,6 +5,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import us.myles.ViaVersion.api.Via;
|
import us.myles.ViaVersion.api.Via;
|
||||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
|
import us.myles.ViaVersion.api.type.types.Particle;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.InventoryPackets;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.InventoryPackets;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.WorldPackets;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.WorldPackets;
|
||||||
|
|
||||||
|
@ -7,10 +7,10 @@ import us.myles.ViaVersion.api.minecraft.item.Item;
|
|||||||
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||||
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_13;
|
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_13;
|
||||||
import us.myles.ViaVersion.api.rewriters.MetadataRewriter;
|
import us.myles.ViaVersion.api.rewriters.MetadataRewriter;
|
||||||
|
import us.myles.ViaVersion.api.type.types.Particle;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ChatRewriter;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ChatRewriter;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.Protocol1_13To1_12_2;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.EntityTypeRewriter;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.EntityTypeRewriter;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.Particle;
|
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.ParticleRewriter;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.ParticleRewriter;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.InventoryPackets;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.InventoryPackets;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.WorldPackets;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.WorldPackets;
|
||||||
|
@ -100,7 +100,7 @@ public class InventoryPackets {
|
|||||||
flags |= 1;
|
flags |= 1;
|
||||||
Optional<SoundSource> finalSource = SoundSource.findBySource(originalSource);
|
Optional<SoundSource> finalSource = SoundSource.findBySource(originalSource);
|
||||||
if (!finalSource.isPresent()) {
|
if (!finalSource.isPresent()) {
|
||||||
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
Via.getPlatform().getLogger().info("Could not handle unknown sound source " + originalSource + " falling back to default: master");
|
Via.getPlatform().getLogger().info("Could not handle unknown sound source " + originalSource + " falling back to default: master");
|
||||||
}
|
}
|
||||||
finalSource = Optional.of(SoundSource.MASTER);
|
finalSource = Optional.of(SoundSource.MASTER);
|
||||||
@ -147,7 +147,7 @@ public class InventoryPackets {
|
|||||||
String old = channel;
|
String old = channel;
|
||||||
channel = getNewPluginChannelId(channel);
|
channel = getNewPluginChannelId(channel);
|
||||||
if (channel == null) {
|
if (channel == null) {
|
||||||
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
Via.getPlatform().getLogger().warning("Ignoring outgoing plugin message with channel: " + old);
|
Via.getPlatform().getLogger().warning("Ignoring outgoing plugin message with channel: " + old);
|
||||||
}
|
}
|
||||||
wrapper.cancel();
|
wrapper.cancel();
|
||||||
@ -159,7 +159,7 @@ public class InventoryPackets {
|
|||||||
String rewritten = getNewPluginChannelId(channels[i]);
|
String rewritten = getNewPluginChannelId(channels[i]);
|
||||||
if (rewritten != null) {
|
if (rewritten != null) {
|
||||||
rewrittenChannels.add(rewritten);
|
rewrittenChannels.add(rewritten);
|
||||||
} else if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
} else if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
Via.getPlatform().getLogger().warning("Ignoring plugin channel in outgoing REGISTER: " + channels[i]);
|
Via.getPlatform().getLogger().warning("Ignoring plugin channel in outgoing REGISTER: " + channels[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -218,7 +218,7 @@ public class InventoryPackets {
|
|||||||
String old = channel;
|
String old = channel;
|
||||||
channel = getOldPluginChannelId(channel);
|
channel = getOldPluginChannelId(channel);
|
||||||
if (channel == null) {
|
if (channel == null) {
|
||||||
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
Via.getPlatform().getLogger().warning("Ignoring incoming plugin message with channel: " + old);
|
Via.getPlatform().getLogger().warning("Ignoring incoming plugin message with channel: " + old);
|
||||||
}
|
}
|
||||||
wrapper.cancel();
|
wrapper.cancel();
|
||||||
@ -230,7 +230,7 @@ public class InventoryPackets {
|
|||||||
String rewritten = getOldPluginChannelId(channels[i]);
|
String rewritten = getOldPluginChannelId(channels[i]);
|
||||||
if (rewritten != null) {
|
if (rewritten != null) {
|
||||||
rewrittenChannels.add(rewritten);
|
rewrittenChannels.add(rewritten);
|
||||||
} else if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
} else if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
Via.getPlatform().getLogger().warning("Ignoring plugin channel in incoming REGISTER: " + channels[i]);
|
Via.getPlatform().getLogger().warning("Ignoring plugin channel in incoming REGISTER: " + channels[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -431,7 +431,7 @@ public class InventoryPackets {
|
|||||||
} else if (MappingData.oldToNewItems.containsKey(rawId & ~0xF)) {
|
} else if (MappingData.oldToNewItems.containsKey(rawId & ~0xF)) {
|
||||||
rawId &= ~0xF; // Remove data
|
rawId &= ~0xF; // Remove data
|
||||||
} else {
|
} else {
|
||||||
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
Via.getPlatform().getLogger().warning("Failed to get 1.13 item for " + item.getIdentifier());
|
Via.getPlatform().getLogger().warning("Failed to get 1.13 item for " + item.getIdentifier());
|
||||||
}
|
}
|
||||||
rawId = 16; // Stone
|
rawId = 16; // Stone
|
||||||
@ -518,7 +518,7 @@ public class InventoryPackets {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (rawId == null) {
|
if (rawId == null) {
|
||||||
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
Via.getPlatform().getLogger().warning("Failed to get 1.12 item for " + item.getIdentifier());
|
Via.getPlatform().getLogger().warning("Failed to get 1.12 item for " + item.getIdentifier());
|
||||||
}
|
}
|
||||||
rawId = 0x10000; // Stone
|
rawId = 0x10000; // Stone
|
||||||
|
@ -18,7 +18,7 @@ import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.blockconnections.Conne
|
|||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.blockconnections.ConnectionHandler;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.blockconnections.ConnectionHandler;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.MappingData;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.MappingData;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.NamedSoundRewriter;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.NamedSoundRewriter;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.Particle;
|
import us.myles.ViaVersion.api.type.types.Particle;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.ParticleRewriter;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.ParticleRewriter;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.providers.BlockEntityProvider;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.providers.BlockEntityProvider;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.providers.PaintingProvider;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.providers.PaintingProvider;
|
||||||
@ -73,7 +73,7 @@ public class WorldPackets {
|
|||||||
|
|
||||||
Optional<Integer> id = provider.getIntByIdentifier(motive);
|
Optional<Integer> id = provider.getIntByIdentifier(motive);
|
||||||
|
|
||||||
if (!id.isPresent() && (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug())) {
|
if (!id.isPresent() && (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug())) {
|
||||||
Via.getPlatform().getLogger().warning("Could not find painting motive: " + motive + " falling back to default (0)");
|
Via.getPlatform().getLogger().warning("Could not find painting motive: " + motive + " falling back to default (0)");
|
||||||
}
|
}
|
||||||
wrapper.write(Type.VAR_INT, id.orElse(0));
|
wrapper.write(Type.VAR_INT, id.orElse(0));
|
||||||
@ -374,7 +374,7 @@ public class WorldPackets {
|
|||||||
if (!validBiomes.contains(biome)) {
|
if (!validBiomes.contains(biome)) {
|
||||||
if (biome != 255 // is it generated naturally? *shrug*
|
if (biome != 255 // is it generated naturally? *shrug*
|
||||||
&& latestBiomeWarn != biome) {
|
&& latestBiomeWarn != biome) {
|
||||||
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
Via.getPlatform().getLogger().warning("Received invalid biome id " + biome);
|
Via.getPlatform().getLogger().warning("Received invalid biome id " + biome);
|
||||||
}
|
}
|
||||||
latestBiomeWarn = biome;
|
latestBiomeWarn = biome;
|
||||||
@ -502,12 +502,12 @@ public class WorldPackets {
|
|||||||
}
|
}
|
||||||
newId = MappingData.blockMappings.getNewId(oldId & ~0xF); // Remove data
|
newId = MappingData.blockMappings.getNewId(oldId & ~0xF); // Remove data
|
||||||
if (newId != -1) {
|
if (newId != -1) {
|
||||||
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
Via.getPlatform().getLogger().warning("Missing block " + oldId);
|
Via.getPlatform().getLogger().warning("Missing block " + oldId);
|
||||||
}
|
}
|
||||||
return newId;
|
return newId;
|
||||||
}
|
}
|
||||||
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
|
||||||
Via.getPlatform().getLogger().warning("Missing block completely " + oldId);
|
Via.getPlatform().getLogger().warning("Missing block completely " + oldId);
|
||||||
}
|
}
|
||||||
// Default stone
|
// Default stone
|
||||||
|
@ -2,70 +2,73 @@ package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.providers.blockentiti
|
|||||||
|
|
||||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||||
import us.myles.ViaVersion.api.Pair;
|
import us.myles.ViaVersion.api.Pair;
|
||||||
import us.myles.ViaVersion.api.Via;
|
|
||||||
import us.myles.ViaVersion.api.data.UserConnection;
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.providers.BlockEntityProvider;
|
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.providers.BlockEntityProvider;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public class FlowerPotHandler implements BlockEntityProvider.BlockEntityHandler {
|
public class FlowerPotHandler implements BlockEntityProvider.BlockEntityHandler {
|
||||||
private static final Map<Pair<String, Byte>, Integer> flowers = new HashMap<>();
|
// Object -> string (id without namespace) or byte (numeric id)
|
||||||
private static final Map<Pair<Byte, Byte>, Integer> flowersNumberId = new HashMap<>();
|
private static final Map<Pair<?, Byte>, Integer> flowers = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
register("minecraft:air", (byte) 0, (byte) 0, 5265);
|
register("air", (byte) 0, (byte) 0, 5265);
|
||||||
register("minecraft:sapling", (byte) 6, (byte) 0, 5266);
|
register("sapling", (byte) 6, (byte) 0, 5266);
|
||||||
register("minecraft:sapling", (byte) 6, (byte) 1, 5267);
|
register("sapling", (byte) 6, (byte) 1, 5267);
|
||||||
register("minecraft:sapling", (byte) 6, (byte) 2, 5268);
|
register("sapling", (byte) 6, (byte) 2, 5268);
|
||||||
register("minecraft:sapling", (byte) 6, (byte) 3, 5269);
|
register("sapling", (byte) 6, (byte) 3, 5269);
|
||||||
register("minecraft:sapling", (byte) 6, (byte) 4, 5270);
|
register("sapling", (byte) 6, (byte) 4, 5270);
|
||||||
register("minecraft:sapling", (byte) 6, (byte) 5, 5271);
|
register("sapling", (byte) 6, (byte) 5, 5271);
|
||||||
register("minecraft:tallgrass", (byte) 31, (byte) 2, 5272);
|
register("tallgrass", (byte) 31, (byte) 2, 5272);
|
||||||
register("minecraft:yellow_flower", (byte) 37, (byte) 0, 5273);
|
register("yellow_flower", (byte) 37, (byte) 0, 5273);
|
||||||
register("minecraft:red_flower", (byte) 38, (byte) 0, 5274);
|
register("red_flower", (byte) 38, (byte) 0, 5274);
|
||||||
register("minecraft:red_flower", (byte) 38, (byte) 1, 5275);
|
register("red_flower", (byte) 38, (byte) 1, 5275);
|
||||||
register("minecraft:red_flower", (byte) 38, (byte) 2, 5276);
|
register("red_flower", (byte) 38, (byte) 2, 5276);
|
||||||
register("minecraft:red_flower", (byte) 38, (byte) 3, 5277);
|
register("red_flower", (byte) 38, (byte) 3, 5277);
|
||||||
register("minecraft:red_flower", (byte) 38, (byte) 4, 5278);
|
register("red_flower", (byte) 38, (byte) 4, 5278);
|
||||||
register("minecraft:red_flower", (byte) 38, (byte) 5, 5279);
|
register("red_flower", (byte) 38, (byte) 5, 5279);
|
||||||
register("minecraft:red_flower", (byte) 38, (byte) 6, 5280);
|
register("red_flower", (byte) 38, (byte) 6, 5280);
|
||||||
register("minecraft:red_flower", (byte) 38, (byte) 7, 5281);
|
register("red_flower", (byte) 38, (byte) 7, 5281);
|
||||||
register("minecraft:red_flower", (byte) 38, (byte) 8, 5282);
|
register("red_flower", (byte) 38, (byte) 8, 5282);
|
||||||
register("minecraft:red_mushroom", (byte) 40, (byte) 0, 5283);
|
register("red_mushroom", (byte) 40, (byte) 0, 5283);
|
||||||
register("minecraft:brown_mushroom", (byte) 39, (byte) 0, 5284);
|
register("brown_mushroom", (byte) 39, (byte) 0, 5284);
|
||||||
register("minecraft:deadbush", (byte) 32, (byte) 0, 5285);
|
register("deadbush", (byte) 32, (byte) 0, 5285);
|
||||||
register("minecraft:cactus", (byte) 81, (byte) 0, 5286);
|
register("cactus", (byte) 81, (byte) 0, 5286);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void register(String identifier, byte numbericBlockId, byte blockData, int newId) {
|
public static void register(String identifier, byte numbericBlockId, byte blockData, int newId) {
|
||||||
flowers.put(new Pair<>(identifier, blockData), newId);
|
flowers.put(new Pair<>(identifier, blockData), newId);
|
||||||
flowersNumberId.put(new Pair<>(numbericBlockId, blockData), newId);
|
flowers.put(new Pair<>(numbericBlockId, blockData), newId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int transform(UserConnection user, CompoundTag tag) {
|
public int transform(UserConnection user, CompoundTag tag) {
|
||||||
Object item = tag.get("Item").getValue();
|
Object item = tag.contains("Item") ? tag.get("Item").getValue() : null;
|
||||||
byte data = ((Number) tag.get("Data").getValue()).byteValue();
|
Object data = tag.contains("Data") ? tag.get("Data").getValue() : null;
|
||||||
|
|
||||||
Pair<?, Byte> pair = item instanceof Number
|
// Convert item to String without namespace or to Byte
|
||||||
? new Pair<>(((Number) item).byteValue(), data)
|
if (item instanceof String) {
|
||||||
: new Pair<>((String) item, data);
|
item = ((String) item).replace("minecraft:", "");
|
||||||
|
} else if (item instanceof Number) {
|
||||||
// Return air on empty string
|
item = ((Number) item).byteValue();
|
||||||
if (item instanceof String && ((String) item).isEmpty())
|
|
||||||
return 5265;
|
|
||||||
else if (flowers.containsKey(pair)) {
|
|
||||||
return flowers.get(pair);
|
|
||||||
} else if (flowersNumberId.containsKey(pair)) {
|
|
||||||
return flowersNumberId.get(pair);
|
|
||||||
} else {
|
} else {
|
||||||
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
item = (byte) 0;
|
||||||
Via.getPlatform().getLogger().warning("Could not find flowerpot content " + item + " for " + tag);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
// Convert data to Byte
|
||||||
|
if (data instanceof Number) {
|
||||||
|
data = ((Number) data).byteValue();
|
||||||
|
} else {
|
||||||
|
data = (byte) 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer flower = flowers.get(new Pair<>(item, (byte) data));
|
||||||
|
if (flower != null) return flower;
|
||||||
|
flower = flowers.get(new Pair<>(item, (byte) 0));
|
||||||
|
if (flower != null) return flower;
|
||||||
|
|
||||||
|
return 5265; // Fallback to empty pot
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.types;
|
|||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.Particle;
|
import us.myles.ViaVersion.api.type.types.Particle;
|
||||||
|
|
||||||
// TODO make future proof
|
// TODO make future proof
|
||||||
public class Particle1_13Type extends Type<Particle> {
|
public class Particle1_13Type extends Type<Particle> {
|
||||||
|
@ -11,7 +11,7 @@ import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
|||||||
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_14;
|
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_14;
|
||||||
import us.myles.ViaVersion.api.rewriters.MetadataRewriter;
|
import us.myles.ViaVersion.api.rewriters.MetadataRewriter;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.Particle;
|
import us.myles.ViaVersion.api.type.types.Particle;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.Protocol1_14To1_13_2;
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.Protocol1_14To1_13_2;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.data.EntityTypeRewriter;
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.data.EntityTypeRewriter;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.packets.InventoryPackets;
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.packets.InventoryPackets;
|
||||||
|
@ -161,6 +161,7 @@ public class Protocol1_15To1_14_4 extends Protocol {
|
|||||||
registerOutgoing(State.PLAY, 0x08, 0x09);
|
registerOutgoing(State.PLAY, 0x08, 0x09);
|
||||||
registerOutgoing(State.PLAY, 0x09, 0x0A);
|
registerOutgoing(State.PLAY, 0x09, 0x0A);
|
||||||
|
|
||||||
|
registerOutgoing(State.PLAY, 0x0C, 0x0D);
|
||||||
registerOutgoing(State.PLAY, 0x0D, 0x0E);
|
registerOutgoing(State.PLAY, 0x0D, 0x0E);
|
||||||
registerOutgoing(State.PLAY, 0x0E, 0x0F);
|
registerOutgoing(State.PLAY, 0x0E, 0x0F);
|
||||||
registerOutgoing(State.PLAY, 0x10, 0x11);
|
registerOutgoing(State.PLAY, 0x10, 0x11);
|
||||||
@ -201,7 +202,7 @@ public class Protocol1_15To1_14_4 extends Protocol {
|
|||||||
registerOutgoing(State.PLAY, 0x34, 0x35);
|
registerOutgoing(State.PLAY, 0x34, 0x35);
|
||||||
registerOutgoing(State.PLAY, 0x35, 0x36);
|
registerOutgoing(State.PLAY, 0x35, 0x36);
|
||||||
registerOutgoing(State.PLAY, 0x36, 0x37);
|
registerOutgoing(State.PLAY, 0x36, 0x37);
|
||||||
registerOutgoing(State.PLAY, 0x37, 0x38);
|
|
||||||
registerOutgoing(State.PLAY, 0x38, 0x39);
|
registerOutgoing(State.PLAY, 0x38, 0x39);
|
||||||
registerOutgoing(State.PLAY, 0x39, 0x3A);
|
registerOutgoing(State.PLAY, 0x39, 0x3A);
|
||||||
registerOutgoing(State.PLAY, 0x3B, 0x3C);
|
registerOutgoing(State.PLAY, 0x3B, 0x3C);
|
||||||
@ -235,9 +236,6 @@ public class Protocol1_15To1_14_4 extends Protocol {
|
|||||||
|
|
||||||
registerOutgoing(State.PLAY, 0x58, 0x59);
|
registerOutgoing(State.PLAY, 0x58, 0x59);
|
||||||
registerOutgoing(State.PLAY, 0x59, 0x5A);
|
registerOutgoing(State.PLAY, 0x59, 0x5A);
|
||||||
|
|
||||||
|
|
||||||
registerOutgoing(State.PLAY, 0x5C, 0x08);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getNewSoundId(int id) {
|
public static int getNewSoundId(int id) {
|
||||||
|
@ -2,6 +2,7 @@ package us.myles.ViaVersion.protocols.protocol1_15to1_14_4.packets;
|
|||||||
|
|
||||||
import us.myles.ViaVersion.api.PacketWrapper;
|
import us.myles.ViaVersion.api.PacketWrapper;
|
||||||
import us.myles.ViaVersion.api.entities.Entity1_15Types;
|
import us.myles.ViaVersion.api.entities.Entity1_15Types;
|
||||||
|
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
|
||||||
import us.myles.ViaVersion.api.protocol.Protocol;
|
import us.myles.ViaVersion.api.protocol.Protocol;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
import us.myles.ViaVersion.api.remapper.PacketHandler;
|
||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
@ -12,6 +13,7 @@ import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.Protocol1_15To1_14_4;
|
|||||||
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.metadata.MetadataRewriter1_15To1_14_4;
|
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.metadata.MetadataRewriter1_15To1_14_4;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.storage.EntityTracker1_15;
|
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.storage.EntityTracker1_15;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class EntityPackets {
|
public class EntityPackets {
|
||||||
@ -73,7 +75,6 @@ public class EntityPackets {
|
|||||||
map(Type.SHORT); // 9 - Velocity X
|
map(Type.SHORT); // 9 - Velocity X
|
||||||
map(Type.SHORT); // 10 - Velocity Y
|
map(Type.SHORT); // 10 - Velocity Y
|
||||||
map(Type.SHORT); // 11 - Velocity Z
|
map(Type.SHORT); // 11 - Velocity Z
|
||||||
map(Types1_14.METADATA_LIST, Type.NOTHING); // removed - probably sent in an update packet?
|
|
||||||
|
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
@ -83,6 +84,13 @@ public class EntityPackets {
|
|||||||
Entity1_15Types.EntityType entityType = Entity1_15Types.getTypeFromId(getNewEntityId(typeId));
|
Entity1_15Types.EntityType entityType = Entity1_15Types.getTypeFromId(getNewEntityId(typeId));
|
||||||
wrapper.user().get(EntityTracker1_15.class).addEntity(entityId, entityType);
|
wrapper.user().get(EntityTracker1_15.class).addEntity(entityId, entityType);
|
||||||
wrapper.set(Type.VAR_INT, 1, entityType.getId());
|
wrapper.set(Type.VAR_INT, 1, entityType.getId());
|
||||||
|
|
||||||
|
List<Metadata> metadata = wrapper.read(Types1_14.METADATA_LIST);
|
||||||
|
metadataRewriter.handleMetadata(entityId, metadata, wrapper.user());
|
||||||
|
PacketWrapper metadataUpdate = wrapper.create(0x44);
|
||||||
|
metadataUpdate.write(Type.VAR_INT, entityId);
|
||||||
|
metadataUpdate.write(Types1_14.METADATA_LIST, metadata);
|
||||||
|
metadataUpdate.send(Protocol1_15To1_14_4.class);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -99,15 +107,20 @@ public class EntityPackets {
|
|||||||
map(Type.DOUBLE); // 4 - Z
|
map(Type.DOUBLE); // 4 - Z
|
||||||
map(Type.BYTE); // 5 - Yaw
|
map(Type.BYTE); // 5 - Yaw
|
||||||
map(Type.BYTE); // 6 - Pitch
|
map(Type.BYTE); // 6 - Pitch
|
||||||
map(Types1_14.METADATA_LIST, Type.NOTHING); // removed - probably sent in an update packet?
|
|
||||||
|
|
||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
int entityId = wrapper.get(Type.VAR_INT, 0);
|
int entityId = wrapper.get(Type.VAR_INT, 0);
|
||||||
|
|
||||||
Entity1_15Types.EntityType entityType = Entity1_15Types.EntityType.PLAYER;
|
Entity1_15Types.EntityType entityType = Entity1_15Types.EntityType.PLAYER;
|
||||||
wrapper.user().get(EntityTracker1_15.class).addEntity(entityId, entityType);
|
wrapper.user().get(EntityTracker1_15.class).addEntity(entityId, entityType);
|
||||||
|
|
||||||
|
List<Metadata> metadata = wrapper.read(Types1_14.METADATA_LIST);
|
||||||
|
metadataRewriter.handleMetadata(entityId, metadata, wrapper.user());
|
||||||
|
PacketWrapper metadataUpdate = wrapper.create(0x44);
|
||||||
|
metadataUpdate.write(Type.VAR_INT, entityId);
|
||||||
|
metadataUpdate.write(Types1_14.METADATA_LIST, metadata);
|
||||||
|
metadataUpdate.send(Protocol1_15To1_14_4.class);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -115,6 +128,8 @@ public class EntityPackets {
|
|||||||
|
|
||||||
// Metadata packet
|
// Metadata packet
|
||||||
metadataRewriter.registerMetadataRewriter(0x43, 0x44, Types1_14.METADATA_LIST);
|
metadataRewriter.registerMetadataRewriter(0x43, 0x44, Types1_14.METADATA_LIST);
|
||||||
|
|
||||||
|
metadataRewriter.registerEntityDestroy(0x37, 0x38);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getNewEntityId(int oldId) {
|
public static int getNewEntityId(int oldId) {
|
||||||
|
@ -48,6 +48,7 @@ public class InventoryPackets {
|
|||||||
wrapper.passthrough(Type.INT);
|
wrapper.passthrough(Type.INT);
|
||||||
wrapper.passthrough(Type.INT);
|
wrapper.passthrough(Type.INT);
|
||||||
wrapper.passthrough(Type.FLOAT);
|
wrapper.passthrough(Type.FLOAT);
|
||||||
|
wrapper.passthrough(Type.INT);
|
||||||
}
|
}
|
||||||
|
|
||||||
wrapper.passthrough(Type.VAR_INT);
|
wrapper.passthrough(Type.VAR_INT);
|
||||||
|
@ -9,7 +9,6 @@ import us.myles.ViaVersion.api.remapper.PacketHandler;
|
|||||||
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
import us.myles.ViaVersion.api.type.Type;
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
import us.myles.ViaVersion.packets.State;
|
import us.myles.ViaVersion.packets.State;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.packets.InventoryPackets;
|
|
||||||
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.types.Chunk1_14Type;
|
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.types.Chunk1_14Type;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.Protocol1_15To1_14_4;
|
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.Protocol1_15To1_14_4;
|
||||||
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.types.Chunk1_15Type;
|
import us.myles.ViaVersion.protocols.protocol1_15to1_14_4.types.Chunk1_15Type;
|
||||||
@ -18,6 +17,22 @@ import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
|||||||
public class WorldPackets {
|
public class WorldPackets {
|
||||||
|
|
||||||
public static void register(Protocol protocol) {
|
public static void register(Protocol protocol) {
|
||||||
|
// Acknowledge player digging
|
||||||
|
protocol.registerOutgoing(State.PLAY, 0x5C, 0x08, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.POSITION1_14);
|
||||||
|
map(Type.VAR_INT);
|
||||||
|
handler(new PacketHandler() {
|
||||||
|
@Override
|
||||||
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
|
int blockState = wrapper.get(Type.VAR_INT, 0);
|
||||||
|
wrapper.set(Type.VAR_INT, 0, Protocol1_15To1_14_4.getNewBlockStateId(blockState));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Block Action
|
// Block Action
|
||||||
protocol.registerOutgoing(State.PLAY, 0x0A, 0x0B, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x0A, 0x0B, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
@ -83,6 +98,26 @@ public class WorldPackets {
|
|||||||
Chunk chunk = wrapper.read(new Chunk1_14Type(clientWorld));
|
Chunk chunk = wrapper.read(new Chunk1_14Type(clientWorld));
|
||||||
wrapper.write(new Chunk1_15Type(clientWorld), chunk);
|
wrapper.write(new Chunk1_15Type(clientWorld), chunk);
|
||||||
|
|
||||||
|
if (chunk.isGroundUp()) {
|
||||||
|
int[] biomeData = chunk.getBiomeData();
|
||||||
|
int[] newBiomeData = new int[1024];
|
||||||
|
// Now in 4x4x4 areas - take the biome of each "middle"
|
||||||
|
for (int i = 0; i < 4; ++i) {
|
||||||
|
for (int j = 0; j < 4; ++j) {
|
||||||
|
int x = (j << 2) + 2;
|
||||||
|
int z = (i << 2) + 2;
|
||||||
|
int oldIndex = (z << 4 | x);
|
||||||
|
newBiomeData[i << 2 | j] = biomeData[oldIndex];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ... and copy it to the new y layers
|
||||||
|
for (int i = 1; i < 64; ++i) {
|
||||||
|
System.arraycopy(newBiomeData, 0, newBiomeData, i * 16, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
chunk.setBiomeData(newBiomeData);
|
||||||
|
}
|
||||||
|
|
||||||
for (int s = 0; s < 16; s++) {
|
for (int s = 0; s < 16; s++) {
|
||||||
ChunkSection section = chunk.getSections()[s];
|
ChunkSection section = chunk.getSections()[s];
|
||||||
if (section == null) continue;
|
if (section == null) continue;
|
||||||
@ -125,9 +160,9 @@ public class WorldPackets {
|
|||||||
public void registerMap() {
|
public void registerMap() {
|
||||||
map(Type.INT); // 0 - Particle ID
|
map(Type.INT); // 0 - Particle ID
|
||||||
map(Type.BOOLEAN); // 1 - Long Distance
|
map(Type.BOOLEAN); // 1 - Long Distance
|
||||||
map(Type.FLOAT); // 2 - X
|
map(Type.FLOAT, Type.DOUBLE); // 2 - X
|
||||||
map(Type.FLOAT); // 3 - Y
|
map(Type.FLOAT, Type.DOUBLE); // 3 - Y
|
||||||
map(Type.FLOAT); // 4 - Z
|
map(Type.FLOAT, Type.DOUBLE); // 4 - Z
|
||||||
map(Type.FLOAT); // 5 - Offset X
|
map(Type.FLOAT); // 5 - Offset X
|
||||||
map(Type.FLOAT); // 6 - Offset Y
|
map(Type.FLOAT); // 6 - Offset Y
|
||||||
map(Type.FLOAT); // 7 - Offset Z
|
map(Type.FLOAT); // 7 - Offset Z
|
||||||
|
@ -31,6 +31,14 @@ public class Chunk1_15Type extends PartialType<Chunk, ClientWorld> {
|
|||||||
boolean groundUp = input.readBoolean();
|
boolean groundUp = input.readBoolean();
|
||||||
int primaryBitmask = Type.VAR_INT.read(input);
|
int primaryBitmask = Type.VAR_INT.read(input);
|
||||||
CompoundTag heightMap = Type.NBT.read(input);
|
CompoundTag heightMap = Type.NBT.read(input);
|
||||||
|
|
||||||
|
int[] biomeData = groundUp ? new int[1024] : null;
|
||||||
|
if (groundUp) {
|
||||||
|
for (int i = 0; i < 1024; i++) {
|
||||||
|
biomeData[i] = input.readInt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Type.VAR_INT.read(input);
|
Type.VAR_INT.read(input);
|
||||||
|
|
||||||
BitSet usedSections = new BitSet(16);
|
BitSet usedSections = new BitSet(16);
|
||||||
@ -42,15 +50,6 @@ public class Chunk1_15Type extends PartialType<Chunk, ClientWorld> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int[] biomeData = groundUp ? new int[256] : null;
|
|
||||||
if (groundUp) {
|
|
||||||
//TODO Why 1024 ints?
|
|
||||||
for (int i = 0; i < 1024; i++) {
|
|
||||||
//biomeData[i] = input.readInt();
|
|
||||||
input.readInt();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Read sections
|
// Read sections
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
if (!usedSections.get(i)) continue; // Section not set
|
if (!usedSections.get(i)) continue; // Section not set
|
||||||
@ -84,13 +83,9 @@ public class Chunk1_15Type extends PartialType<Chunk, ClientWorld> {
|
|||||||
|
|
||||||
// Write biome data
|
// Write biome data
|
||||||
if (chunk.isBiomeData()) {
|
if (chunk.isBiomeData()) {
|
||||||
//TODO Why 1024 ints?
|
for (int value : chunk.getBiomeData()) {
|
||||||
for (int i = 0; i < 1024; i++) {
|
output.writeInt(value);
|
||||||
output.writeInt(0);
|
|
||||||
}
|
}
|
||||||
/*for (int value : chunk.getBiomeData()) {
|
|
||||||
output.writeInt(value & 0xFF); // This is a temporary workaround, we'll look into fixing this soon :)
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteBuf buf = output.alloc().buffer();
|
ByteBuf buf = output.alloc().buffer();
|
||||||
|
@ -100,7 +100,7 @@ public class Protocol1_9To1_8 extends Protocol {
|
|||||||
providers.register(BossBarProvider.class, new BossBarProvider());
|
providers.register(BossBarProvider.class, new BossBarProvider());
|
||||||
providers.register(MainHandProvider.class, new MainHandProvider());
|
providers.register(MainHandProvider.class, new MainHandProvider());
|
||||||
providers.require(MovementTransmitterProvider.class);
|
providers.require(MovementTransmitterProvider.class);
|
||||||
if (Via.getConfig().isStimulatePlayerTick()) {
|
if (Via.getConfig().isSimulatePlayerTick()) {
|
||||||
Via.getPlatform().runRepeatingSync(new ViaIdleThread(), 1L);
|
Via.getPlatform().runRepeatingSync(new ViaIdleThread(), 1L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ public abstract class Config implements ConfigurationProvider {
|
|||||||
|
|
||||||
private final CommentStore commentStore = new CommentStore('.', 2);
|
private final CommentStore commentStore = new CommentStore('.', 2);
|
||||||
private final File configFile;
|
private final File configFile;
|
||||||
private ConcurrentSkipListMap<String, Object> config;
|
private Map<String, Object> config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Config instance, this will *not* load the config by default.
|
* Create a new Config instance, this will *not* load the config by default.
|
||||||
|
@ -22,6 +22,8 @@ block-disconnect-msg: "You are using an unsupported Minecraft version!"
|
|||||||
# (We don't suggest using reload either, use a plugin manager)
|
# (We don't suggest using reload either, use a plugin manager)
|
||||||
# You can customise the message we kick people with if you use ProtocolLib here.
|
# You can customise the message we kick people with if you use ProtocolLib here.
|
||||||
reload-disconnect-msg: "Server reload, please rejoin!"
|
reload-disconnect-msg: "Server reload, please rejoin!"
|
||||||
|
# We warn when there's a error converting item and block data over versions, should we suppress these? (Only suggested if spamming)
|
||||||
|
suppress-conversion-warnings: false
|
||||||
#
|
#
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
# BUNGEE OPTIONS #
|
# BUNGEE OPTIONS #
|
||||||
@ -110,8 +112,6 @@ chat-nbt-fix: true
|
|||||||
quick-move-action-fix: false
|
quick-move-action-fix: false
|
||||||
# Should we use prefix for team colour on 1.13 and above clients
|
# Should we use prefix for team colour on 1.13 and above clients
|
||||||
team-colour-fix: true
|
team-colour-fix: true
|
||||||
# We warn when there's a error converting from pre-1.13 to 1.13, should we suppress these? (Only suggested if spamming)
|
|
||||||
suppress-1_13-conversion-errors: false
|
|
||||||
# 1.13 introduced new auto complete which can trigger "Kicked for spamming" for servers older than 1.13, the following option will disable it completely.
|
# 1.13 introduced new auto complete which can trigger "Kicked for spamming" for servers older than 1.13, the following option will disable it completely.
|
||||||
disable-1_13-auto-complete: false
|
disable-1_13-auto-complete: false
|
||||||
# The following option will delay the tab complete request in x ticks if greater than 0, if other tab-complete is received, the previous is cancelled
|
# The following option will delay the tab complete request in x ticks if greater than 0, if other tab-complete is received, the previous is cancelled
|
||||||
|
@ -20,7 +20,6 @@ public class SpongeViaConfig extends AbstractViaConfig {
|
|||||||
public SpongeViaConfig(PluginContainer pluginContainer, File configFile) {
|
public SpongeViaConfig(PluginContainer pluginContainer, File configFile) {
|
||||||
super(new File(configFile, "config.yml"));
|
super(new File(configFile, "config.yml"));
|
||||||
this.pluginContainer = pluginContainer;
|
this.pluginContainer = pluginContainer;
|
||||||
// Load config
|
|
||||||
reloadConfig();
|
reloadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,29 +40,4 @@ public class SpongeViaConfig extends AbstractViaConfig {
|
|||||||
public List<String> getUnsupportedOptions() {
|
public List<String> getUnsupportedOptions() {
|
||||||
return UNSUPPORTED;
|
return UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAntiXRay() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean is1_12QuickMoveActionFix() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean is1_9HitboxFix() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean is1_14HitboxFix() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getBlockConnectionMethod() {
|
|
||||||
return "packet";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -9,13 +9,23 @@ import java.util.*;
|
|||||||
|
|
||||||
public class VelocityViaConfig extends AbstractViaConfig {
|
public class VelocityViaConfig extends AbstractViaConfig {
|
||||||
private static final List<String> UNSUPPORTED = Arrays.asList("nms-player-ticking", "item-cache", "anti-xray-patch", "quick-move-action-fix", "bungee-ping-interval", "bungee-ping-save", "bungee-servers", "blockconnection-method", "change-1_9-hitbox", "change-1_14-hitbox");
|
private static final List<String> UNSUPPORTED = Arrays.asList("nms-player-ticking", "item-cache", "anti-xray-patch", "quick-move-action-fix", "bungee-ping-interval", "bungee-ping-save", "bungee-servers", "blockconnection-method", "change-1_9-hitbox", "change-1_14-hitbox");
|
||||||
|
private int velocityPingInterval;
|
||||||
|
private boolean velocityPingSave;
|
||||||
|
private Map<String, Integer> velocityServerProtocols;
|
||||||
|
|
||||||
public VelocityViaConfig(File configFile) {
|
public VelocityViaConfig(File configFile) {
|
||||||
super(new File(configFile, "config.yml"));
|
super(new File(configFile, "config.yml"));
|
||||||
// Load config
|
|
||||||
reloadConfig();
|
reloadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void loadFields() {
|
||||||
|
super.loadFields();
|
||||||
|
velocityPingInterval = getInt("velocity-ping-interval", 60);
|
||||||
|
velocityPingSave = getBoolean("velocity-ping-save", true);
|
||||||
|
velocityServerProtocols = get("velocity-servers", Map.class, new HashMap<>());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public URL getDefaultConfigURL() {
|
public URL getDefaultConfigURL() {
|
||||||
return getClass().getClassLoader().getResource("assets/viaversion/config.yml");
|
return getClass().getClassLoader().getResource("assets/viaversion/config.yml");
|
||||||
@ -64,11 +74,6 @@ public class VelocityViaConfig extends AbstractViaConfig {
|
|||||||
return UNSUPPORTED;
|
return UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAntiXRay() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemCache() {
|
public boolean isItemCache() {
|
||||||
return false;
|
return false;
|
||||||
@ -79,26 +84,6 @@ public class VelocityViaConfig extends AbstractViaConfig {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean is1_12QuickMoveActionFix() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getBlockConnectionMethod() {
|
|
||||||
return "packet";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean is1_9HitboxFix() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean is1_14HitboxFix() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* What is the interval for checking servers via ping
|
* What is the interval for checking servers via ping
|
||||||
* -1 for disabled
|
* -1 for disabled
|
||||||
@ -106,7 +91,7 @@ public class VelocityViaConfig extends AbstractViaConfig {
|
|||||||
* @return Ping interval in seconds
|
* @return Ping interval in seconds
|
||||||
*/
|
*/
|
||||||
public int getVelocityPingInterval() {
|
public int getVelocityPingInterval() {
|
||||||
return getInt("velocity-ping-interval", 60);
|
return velocityPingInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -115,7 +100,7 @@ public class VelocityViaConfig extends AbstractViaConfig {
|
|||||||
* @return True if it should save
|
* @return True if it should save
|
||||||
*/
|
*/
|
||||||
public boolean isVelocityPingSave() {
|
public boolean isVelocityPingSave() {
|
||||||
return getBoolean("velocity-ping-save", true);
|
return velocityPingSave;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -125,6 +110,6 @@ public class VelocityViaConfig extends AbstractViaConfig {
|
|||||||
* @return Map of String, Integer
|
* @return Map of String, Integer
|
||||||
*/
|
*/
|
||||||
public Map<String, Integer> getVelocityServerProtocols() {
|
public Map<String, Integer> getVelocityServerProtocols() {
|
||||||
return get("velocity-servers", Map.class, new HashMap<>());
|
return velocityServerProtocols;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren