mirror of
https://github.com/ViaVersion/ViaRewind.git
synced 2026-11-05 01:10:06 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e261824ef | ||
|
|
43c3bb11dc | ||
|
|
f57ac05bd4 | ||
|
|
a3c623c202 | ||
|
|
481315f1e6 | ||
|
|
21e50421e5 | ||
|
|
233d52281b | ||
|
|
6807a02de7 |
No files matched your search
File renamed without changes.
+1
-1
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id "com.viaversion.java-conventions"
|
||||
id "vr.java-conventions"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id "com.viaversion.java-conventions"
|
||||
id "vr.java-conventions"
|
||||
}
|
||||
|
||||
plugins {
|
||||
|
||||
@@ -39,6 +39,7 @@ public class ViaRewindConfig extends Config implements com.viaversion.viarewind.
|
||||
private String worldBorderParticle;
|
||||
private boolean enableOffhand;
|
||||
private String offhandCommand;
|
||||
private boolean emulateLevitationEffect;
|
||||
|
||||
public ViaRewindConfig(File configFile, Logger logger) {
|
||||
super(configFile, logger);
|
||||
@@ -61,6 +62,7 @@ public class ViaRewindConfig extends Config implements com.viaversion.viarewind.
|
||||
worldBorderParticle = getString("world-border-particle", "fireworksSpark");
|
||||
enableOffhand = getBoolean("enable-offhand", true);
|
||||
offhandCommand = getString("offhand-command", "/offhand");
|
||||
emulateLevitationEffect = getBoolean("emulate-levitation-effect", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -113,6 +115,11 @@ public class ViaRewindConfig extends Config implements com.viaversion.viarewind.
|
||||
return offhandCommand;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean emulateLevitationEffect() {
|
||||
return emulateLevitationEffect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getDefaultConfigURL() {
|
||||
return getClass().getClassLoader().getResource("assets/viarewind/config.yml");
|
||||
|
||||
@@ -103,4 +103,11 @@ public interface ViaRewindConfig extends Config {
|
||||
* @return the offhand command
|
||||
*/
|
||||
String getOffhandCommand();
|
||||
|
||||
/**
|
||||
* If enabled, 1.8 players on 1.9+ servers will also experience the levitation effect by sending velocity packets.
|
||||
*
|
||||
* @return true if enabled
|
||||
*/
|
||||
boolean emulateLevitationEffect();
|
||||
}
|
||||
+6
-6
@@ -174,12 +174,8 @@ public enum EntityDataIndex1_7_6_10 {
|
||||
}
|
||||
|
||||
private static Optional<EntityDataIndex1_7_6_10> getIndex(EntityType type, int index) {
|
||||
Pair<EntityType, Integer> pair = new Pair<>(type, index);
|
||||
if (ENTITY_DATA_REWRITES.containsKey(pair)) {
|
||||
return Optional.of(ENTITY_DATA_REWRITES.get(pair));
|
||||
}
|
||||
|
||||
return Optional.empty();
|
||||
final Pair<EntityType, Integer> pair = new Pair<>(type, index);
|
||||
return Optional.ofNullable(ENTITY_DATA_REWRITES.get(pair));
|
||||
}
|
||||
|
||||
public EntityTypes1_8.EntityType getClazz() {
|
||||
@@ -203,6 +199,10 @@ public enum EntityDataIndex1_7_6_10 {
|
||||
}
|
||||
|
||||
public static EntityDataIndex1_7_6_10 searchIndex(EntityType type, int index) {
|
||||
if (type == null) {
|
||||
// Plugins sending metadata before an entity is spawned, causing exceptions while the game ignores them.
|
||||
return null;
|
||||
}
|
||||
EntityType currentType = type;
|
||||
do {
|
||||
Optional<EntityDataIndex1_7_6_10> optMeta = getIndex(currentType, index);
|
||||
|
||||
-1
@@ -57,7 +57,6 @@ public interface CooldownVisualization {
|
||||
case BOSS_BAR -> BossBarVisualization::new;
|
||||
case ACTION_BAR -> ActionBarVisualization::new;
|
||||
case DISABLED -> DISABLED;
|
||||
default -> throw new IllegalArgumentException("Unexpected: " + indicator);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -37,14 +37,14 @@ public class EntityDataIndex1_8 {
|
||||
|
||||
private static Optional<EntityDataIndex1_9> getIndex(final EntityType type, final int index) {
|
||||
final Pair<EntityType, Integer> pair = new Pair<>(type, index);
|
||||
if (ENTITY_DATA_REWRITES.containsKey(pair)) {
|
||||
return Optional.of(ENTITY_DATA_REWRITES.get(pair));
|
||||
} else {
|
||||
return Optional.empty();
|
||||
}
|
||||
return Optional.ofNullable(ENTITY_DATA_REWRITES.get(pair));
|
||||
}
|
||||
|
||||
public static EntityDataIndex1_9 searchIndex(final EntityType type, final int index) {
|
||||
if (type == null) {
|
||||
// Plugins sending metadata before an entity is spawned, causing exceptions while the game ignores them.
|
||||
return null;
|
||||
}
|
||||
EntityType currentType = type;
|
||||
do {
|
||||
final Optional<EntityDataIndex1_9> optMeta = getIndex(currentType, index);
|
||||
|
||||
-3
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
package com.viaversion.viarewind.protocol.v1_9to1_8.rewriter;
|
||||
|
||||
import com.viaversion.viarewind.ViaRewind;
|
||||
import com.viaversion.viarewind.api.minecraft.math.RelativeMoveUtil;
|
||||
import com.viaversion.viarewind.api.rewriter.VREntityRewriter;
|
||||
import com.viaversion.viarewind.protocol.v1_9to1_8.Protocol1_9To1_8;
|
||||
@@ -26,7 +25,6 @@ import com.viaversion.viarewind.protocol.v1_9to1_8.storage.CooldownStorage;
|
||||
import com.viaversion.viarewind.protocol.v1_9to1_8.storage.EntityTracker1_9;
|
||||
import com.viaversion.viarewind.protocol.v1_9to1_8.storage.LevitationStorage;
|
||||
import com.viaversion.viarewind.protocol.v1_9to1_8.storage.PlayerPositionTracker;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.minecraft.BlockPosition;
|
||||
import com.viaversion.viaversion.api.minecraft.EulerAngle;
|
||||
import com.viaversion.viaversion.api.minecraft.Vector;
|
||||
@@ -52,7 +50,6 @@ import com.viaversion.viaversion.util.Pair;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class EntityPacketRewriter1_9 extends VREntityRewriter<ClientboundPackets1_9, Protocol1_9To1_8> {
|
||||
|
||||
|
||||
+11
-2
@@ -28,11 +28,12 @@ import java.util.logging.Level;
|
||||
|
||||
public class CooldownStorage implements StorableObject {
|
||||
|
||||
private double attackSpeed = 4.0;
|
||||
private long lastHit = 0;
|
||||
private CooldownVisualization.Factory visualizationFactory = CooldownVisualization.Factory.fromConfiguration();
|
||||
private CooldownVisualization current;
|
||||
|
||||
private double attackSpeed = 4.0;
|
||||
private long lastHit = 0;
|
||||
|
||||
public void tick(final UserConnection connection) {
|
||||
if (!hasCooldown()) {
|
||||
endCurrentVisualization();
|
||||
@@ -110,4 +111,12 @@ public class CooldownStorage implements StorableObject {
|
||||
public void setLastHit(long lastHit) {
|
||||
this.lastHit = lastHit;
|
||||
}
|
||||
|
||||
public CooldownVisualization.Factory getVisualizationFactory() {
|
||||
return visualizationFactory;
|
||||
}
|
||||
|
||||
public void setVisualizationFactory(CooldownVisualization.Factory visualizationFactory) {
|
||||
this.visualizationFactory = visualizationFactory;
|
||||
}
|
||||
}
|
||||
+3
@@ -32,6 +32,9 @@ public class LevitationUpdateTask implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (!ViaRewind.getConfig().emulateLevitationEffect()) {
|
||||
return;
|
||||
}
|
||||
for (UserConnection connection : Via.getManager().getConnectionManager().getConnections()) {
|
||||
final LevitationStorage levitation = connection.get(LevitationStorage.class);
|
||||
if (!levitation.isActive()) {
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
# Specifies how 1.8.x clients should see the cooldown indicator
|
||||
# You can choose between TITLE, ACTION_BAR, BOSS_BAR and DISABLED
|
||||
# ONLY DISABLE IF YOU HAVE 1.9 COOLDOWN DISABLED ON YOUR SERVER
|
||||
# 1.8 PLAYERS MAY ASK WHY PVP IS NOT WORKING OTHERWISE
|
||||
# 1.8 PLAYERS MAY ASK WHY PVP IS NOT WORKING OTHERWISE.
|
||||
# REQUIRES A SERVER RESTART TO TAKE EFFECT
|
||||
cooldown-indicator: 'TITLE'
|
||||
#
|
||||
# Replaces Adventure mode with Survival mode for 1.7.x clients
|
||||
@@ -11,14 +12,14 @@ cooldown-indicator: 'TITLE'
|
||||
# or 'CanPlaceOn' flags on items
|
||||
replace-adventure: false
|
||||
#
|
||||
# Whether 1.9 particles should be replaced by similar ones in
|
||||
# Whether similar ones should replace 1.9 particles in
|
||||
# 1.8 and lower
|
||||
replace-particles: false
|
||||
#
|
||||
# Max amount of pages for written books before a client gets kicked
|
||||
# Max number of pages for written books before a client gets kicked
|
||||
max-book-pages: 100
|
||||
#
|
||||
# Max amount of characters in the json (!) string of a book page before a client gets kicked
|
||||
# Max number of characters in the json (!) string of a book page before a client gets kicked
|
||||
max-book-page-length: 5000
|
||||
#
|
||||
# Whether to emulate the 1.8+ world border for 1.7.x clients
|
||||
@@ -28,11 +29,14 @@ emulate-world-border: true
|
||||
always-show-original-mob-name: true
|
||||
#
|
||||
# The particle to show the world border for the 1.8+ world border for 1.7.x clients
|
||||
# see https://wiki.vg/index.php?title=Protocol&oldid=7368#Particle_2
|
||||
# sees https://wiki.vg/index.php?title=Protocol&oldid=7368#Particle_2
|
||||
world-border-particle: 'fireworksSpark'
|
||||
#
|
||||
# If enabled, 1.8 players on 1.9+ servers can use /offhand to switch items between their main hand and offhand.
|
||||
enable-offhand: true
|
||||
#
|
||||
# Allows to define the offhand command
|
||||
offhand-command: '/offhand'
|
||||
# Allows defining the offhand command
|
||||
offhand-command: '/offhand'
|
||||
#
|
||||
# If enabled, 1.8 players on 1.9+ servers will also experience the levitation effect by sending velocity packets.
|
||||
emulate-levitation-effect: true
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id "com.viaversion.java-conventions"
|
||||
id "vr.java-conventions"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx8G
|
||||
org.gradle.parallel=true
|
||||
|
||||
# project
|
||||
maven_version=4.0.0
|
||||
maven_version=4.0.1
|
||||
maven_group=com.viaversion
|
||||
|
||||
# libraries
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id "com.viaversion.java-conventions"
|
||||
id "vr.java-conventions"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
Reference in new issue
Block a user