mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-09-10 21:58:04 +02:00
Merge pull request #1476 from KennyTV/abstraction
Merge master & restore merged branches' history
This commit is contained in:
commit
abb5e27358
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viaversion-parent</artifactId>
|
<artifactId>viaversion-parent</artifactId>
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<version>2.1.4-19w38b</version>
|
<version>2.1.4-19w39a</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viaversion-parent</artifactId>
|
<artifactId>viaversion-parent</artifactId>
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<version>2.1.4-19w38b</version>
|
<version>2.1.4-19w39a</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viaversion-parent</artifactId>
|
<artifactId>viaversion-parent</artifactId>
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<version>2.1.4-19w38b</version>
|
<version>2.1.4-19w39a</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@ -243,6 +243,11 @@ public abstract class AbstractViaConfig extends Config implements ViaVersionConf
|
|||||||
return getBoolean("fix-non-full-blocklight", false);
|
return getBoolean("fix-non-full-blocklight", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean is1_14HealthNaNFix() {
|
||||||
|
return getBoolean("fix-1_14-health-nan", true);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean is1_15InstantRespawn() {
|
public boolean is1_15InstantRespawn() {
|
||||||
return getBoolean("use-1_15-instant-respawn", false);
|
return getBoolean("use-1_15-instant-respawn", false);
|
||||||
|
@ -329,6 +329,15 @@ public interface ViaVersionConfig {
|
|||||||
*/
|
*/
|
||||||
boolean isNonFullBlockLightFix();
|
boolean isNonFullBlockLightFix();
|
||||||
|
|
||||||
|
boolean is1_14HealthNaNFix();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fixes non full blocks having 0 light for 1.14+ clients on sub 1.14 servers.
|
||||||
|
*
|
||||||
|
* @return True if enabled
|
||||||
|
*/
|
||||||
|
boolean isNonFullBlockLightFix();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should 1.15 clients respawn instantly / without showing the death screen
|
* Should 1.15 clients respawn instantly / without showing the death screen
|
||||||
*
|
*
|
||||||
|
@ -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(555, "1.15"));
|
register(v1_15 = new ProtocolVersion(556, "1.15"));
|
||||||
register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
|
register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,34 +350,33 @@ public class Protocol1_11To1_10 extends Protocol {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getNewSoundId(int id) { //TODO Make it better, suggestions are welcome. It's ugly and hardcoded now.
|
private int getNewSoundId(int id) {
|
||||||
if (id == 196) // Experience orb sound got removed
|
if (id == 196) // Experience orb sound got removed
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
int newId = id;
|
if (id >= 85) // Shulker boxes
|
||||||
if (id >= 85) // Hello shulker boxes
|
id += 2;
|
||||||
newId += 2;
|
if (id >= 176) // Guardian flop
|
||||||
if (id >= 174) // Hello Guardian flop
|
id += 1;
|
||||||
newId += 1;
|
if (id >= 197) // evocation things
|
||||||
if (id >= 194) // Hello evocation things
|
id += 8;
|
||||||
newId += 8;
|
|
||||||
if (id >= 196) // Rip the Experience orb touch sound :'(
|
if (id >= 196) // Rip the Experience orb touch sound :'(
|
||||||
newId -= 1;
|
id -= 1;
|
||||||
if (id >= 269) // Hello Liama's
|
if (id >= 279) // Liama's
|
||||||
newId += 9;
|
id += 9;
|
||||||
if (id >= 277) // Hello Mule chest
|
if (id >= 296) // Mule chest
|
||||||
newId += 1;
|
id += 1;
|
||||||
if (id >= 370) // Hello Vex
|
if (id >= 390) // Vex
|
||||||
newId += 4;
|
id += 4;
|
||||||
if (id >= 376) // Hello vindication
|
if (id >= 400) // vindication
|
||||||
newId += 3;
|
id += 3;
|
||||||
if (id >= 423) // Equip Elytra
|
if (id >= 450) // Elytra
|
||||||
newId += 1;
|
id += 1;
|
||||||
if (id >= 427) // Hello empty bottle
|
if (id >= 455) // Empty bottle
|
||||||
newId += 1;
|
id += 1;
|
||||||
if (id >= 441) // Hello item totem use
|
if (id >= 470) // Totem use
|
||||||
newId += 1;
|
id += 1;
|
||||||
return newId;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ public class InventoryPackets {
|
|||||||
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
|
if (!Via.getConfig().isSuppress1_13ConversionErrors() || 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 = java.util.Optional.of(SoundSource.MASTER);
|
finalSource = Optional.of(SoundSource.MASTER);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -509,9 +509,9 @@ public class InventoryPackets {
|
|||||||
case "bungeecord:main":
|
case "bungeecord:main":
|
||||||
return null;
|
return null;
|
||||||
case "FML|MP":
|
case "FML|MP":
|
||||||
return "fml:mp";
|
return "fml:mp";
|
||||||
case "FML|HS":
|
case "FML|HS":
|
||||||
return "fml:hs";
|
return "fml:hs";
|
||||||
default:
|
default:
|
||||||
return old.matches("([0-9a-z_.-]+):([0-9a-z_/.-]+)") // Identifier regex
|
return old.matches("([0-9a-z_.-]+):([0-9a-z_/.-]+)") // Identifier regex
|
||||||
? old : null;
|
? old : null;
|
||||||
@ -754,9 +754,9 @@ public class InventoryPackets {
|
|||||||
case "wdl:request":
|
case "wdl:request":
|
||||||
return "WDL|REQUEST";
|
return "WDL|REQUEST";
|
||||||
case "fml:hs":
|
case "fml:hs":
|
||||||
return "FML|HS";
|
return "FML|HS";
|
||||||
case "fml:mp":
|
case "fml:mp":
|
||||||
return "FML:MP";
|
return "FML:MP";
|
||||||
default:
|
default:
|
||||||
return newId.length() > 20 ? newId.substring(0, 20) : newId;
|
return newId.length() > 20 ? newId.substring(0, 20) : newId;
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,22 @@ public class EntityPackets {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Destroy entities
|
||||||
|
protocol.registerOutgoing(State.PLAY, 0x37, 0x37, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.VAR_INT_ARRAY); // 0 - Entity ids
|
||||||
|
handler(new PacketHandler() {
|
||||||
|
@Override
|
||||||
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
|
for (int entity : wrapper.get(Type.VAR_INT_ARRAY, 0)) {
|
||||||
|
wrapper.user().get(EntityTracker.class).removeEntity(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Spawn Player
|
// Spawn Player
|
||||||
protocol.registerOutgoing(State.PLAY, 0x05, 0x05, new PacketRemapper() {
|
protocol.registerOutgoing(State.PLAY, 0x05, 0x05, new PacketRemapper() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package us.myles.ViaVersion.protocols.protocol1_14to1_13_2.metadata;
|
package us.myles.ViaVersion.protocols.protocol1_14to1_13_2.metadata;
|
||||||
|
|
||||||
import us.myles.ViaVersion.api.PacketWrapper;
|
import us.myles.ViaVersion.api.PacketWrapper;
|
||||||
|
import us.myles.ViaVersion.api.Via;
|
||||||
import us.myles.ViaVersion.api.data.UserConnection;
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
import us.myles.ViaVersion.api.entities.Entity1_14Types;
|
import us.myles.ViaVersion.api.entities.Entity1_14Types;
|
||||||
import us.myles.ViaVersion.api.entities.EntityType;
|
import us.myles.ViaVersion.api.entities.EntityType;
|
||||||
@ -43,6 +44,12 @@ public class MetadataRewriter1_14To1_13_2 extends MetadataRewriter<Protocol1_14T
|
|||||||
if (metadata.getId() > 5) {
|
if (metadata.getId() > 5) {
|
||||||
metadata.setId(metadata.getId() + 1);
|
metadata.setId(metadata.getId() + 1);
|
||||||
}
|
}
|
||||||
|
if (metadata.getId() == 8 && type.isOrHasParent(Entity1_14Types.EntityType.LIVINGENTITY)) {
|
||||||
|
final float v = ((Number) metadata.getValue()).floatValue();
|
||||||
|
if (Float.isNaN(v) && Via.getConfig().is1_14HealthNaNFix()) {
|
||||||
|
metadata.setValue(1F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Metadata 12 added to living_entity
|
//Metadata 12 added to living_entity
|
||||||
if (metadata.getId() > 11 && type.isOrHasParent(Entity1_14Types.EntityType.LIVINGENTITY)) {
|
if (metadata.getId() > 11 && type.isOrHasParent(Entity1_14Types.EntityType.LIVINGENTITY)) {
|
||||||
|
@ -15,7 +15,7 @@ public enum SoundEffect {
|
|||||||
DIG_GRAVEL("dig.gravel", "block.gravel.place", SoundCategory.BLOCK),
|
DIG_GRAVEL("dig.gravel", "block.gravel.place", SoundCategory.BLOCK),
|
||||||
RANDOM_BOWHIT("random.bowhit", "block.tripwire.detach", SoundCategory.NEUTRAL),
|
RANDOM_BOWHIT("random.bowhit", "block.tripwire.detach", SoundCategory.NEUTRAL),
|
||||||
DIG_GLASS("dig.glass", "block.glass.break", SoundCategory.BLOCK),
|
DIG_GLASS("dig.glass", "block.glass.break", SoundCategory.BLOCK),
|
||||||
MOB_ZOMBIE_SAY("mob.zombie.say", "entity.zombie_villager.ambient", SoundCategory.HOSTILE),
|
MOB_ZOMBIE_SAY("mob.zombie.say", "entity.zombie.ambient", SoundCategory.HOSTILE),
|
||||||
MOB_PIG_DEATH("mob.pig.death", "entity.pig.death", SoundCategory.NEUTRAL),
|
MOB_PIG_DEATH("mob.pig.death", "entity.pig.death", SoundCategory.NEUTRAL),
|
||||||
MOB_HORSE_DONKEY_HIT("mob.horse.donkey.hit", "entity.donkey.hurt", SoundCategory.NEUTRAL),
|
MOB_HORSE_DONKEY_HIT("mob.horse.donkey.hit", "entity.donkey.hurt", SoundCategory.NEUTRAL),
|
||||||
GAME_NEUTRAL_SWIM("game.neutral.swim", "entity.player.swim", SoundCategory.NEUTRAL),
|
GAME_NEUTRAL_SWIM("game.neutral.swim", "entity.player.swim", SoundCategory.NEUTRAL),
|
||||||
@ -207,7 +207,7 @@ public enum SoundEffect {
|
|||||||
MOB_MAGMACUBE_SMALL("mob.magmacube.small", "entity.small_magmacube.squish", SoundCategory.HOSTILE),
|
MOB_MAGMACUBE_SMALL("mob.magmacube.small", "entity.small_magmacube.squish", SoundCategory.HOSTILE),
|
||||||
FIRE_IGNITE("fire.ignite", "item.flintandsteel.use", SoundCategory.BLOCK, true),
|
FIRE_IGNITE("fire.ignite", "item.flintandsteel.use", SoundCategory.BLOCK, true),
|
||||||
MOB_ENDERDRAGON_HIT("mob.enderdragon.hit", "entity.enderdragon.hurt", SoundCategory.HOSTILE),
|
MOB_ENDERDRAGON_HIT("mob.enderdragon.hit", "entity.enderdragon.hurt", SoundCategory.HOSTILE),
|
||||||
MOB_ZOMBIE_HURT("mob.zombie.hurt", "entity.zombie_villager.hurt", SoundCategory.HOSTILE),
|
MOB_ZOMBIE_HURT("mob.zombie.hurt", "entity.zombie.hurt", SoundCategory.HOSTILE),
|
||||||
RANDOM_EXPLODE("random.explode", "block.end_gateway.spawn", SoundCategory.BLOCK),
|
RANDOM_EXPLODE("random.explode", "block.end_gateway.spawn", SoundCategory.BLOCK),
|
||||||
MOB_SLIME_ATTACK("mob.slime.attack", "entity.slime.attack", SoundCategory.HOSTILE),
|
MOB_SLIME_ATTACK("mob.slime.attack", "entity.slime.attack", SoundCategory.HOSTILE),
|
||||||
MOB_MAGMACUBE_JUMP("mob.magmacube.jump", "entity.magmacube.jump", SoundCategory.HOSTILE),
|
MOB_MAGMACUBE_JUMP("mob.magmacube.jump", "entity.magmacube.jump", SoundCategory.HOSTILE),
|
||||||
|
@ -128,6 +128,8 @@ change-1_9-hitbox: false
|
|||||||
change-1_14-hitbox: false
|
change-1_14-hitbox: false
|
||||||
# Fixes 1.14+ clients on sub 1.14 servers having a light value of 0 for non full blocks.
|
# Fixes 1.14+ clients on sub 1.14 servers having a light value of 0 for non full blocks.
|
||||||
fix-non-full-blocklight: true
|
fix-non-full-blocklight: true
|
||||||
|
# Fixes walk animation not shown when health is set to Float.NaN
|
||||||
|
fix-1_14-health-nan: true
|
||||||
# Should 1.15+ clients respawn instantly / without showing a death screen?
|
# Should 1.15+ clients respawn instantly / without showing a death screen?
|
||||||
use-1_15-instant-respawn: false
|
use-1_15-instant-respawn: false
|
||||||
#
|
#
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viaversion-parent</artifactId>
|
<artifactId>viaversion-parent</artifactId>
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<version>2.1.4-19w38b</version>
|
<version>2.1.4-19w39a</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<name>viaversion-jar</name>
|
<name>viaversion-jar</name>
|
||||||
|
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<artifactId>viaversion-parent</artifactId>
|
<artifactId>viaversion-parent</artifactId>
|
||||||
<version>2.1.4-19w38b</version>
|
<version>2.1.4-19w39a</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<name>viaversion-parent</name>
|
<name>viaversion-parent</name>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viaversion-parent</artifactId>
|
<artifactId>viaversion-parent</artifactId>
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<version>2.1.4-19w38b</version>
|
<version>2.1.4-19w39a</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viaversion-parent</artifactId>
|
<artifactId>viaversion-parent</artifactId>
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<version>2.1.4-19w38b</version>
|
<version>2.1.4-19w39a</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>viaversion-parent</artifactId>
|
<artifactId>viaversion-parent</artifactId>
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<version>2.1.4-19w38b</version>
|
<version>2.1.4-19w39a</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user