Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c595c654aa | ||
|
|
c0d1cabb12 | ||
|
|
51e81c7bb1 | ||
|
|
6bdaa54ce8 | ||
|
|
65ac2f37f2 | ||
|
|
b08bb90cef | ||
|
|
89e76d369b | ||
|
|
ed8cc47c7a |
No files matched your search
@@ -44,7 +44,7 @@ base {
|
||||
archivesName = project.maven_name
|
||||
group = project.maven_group
|
||||
version = project.maven_version
|
||||
description = "ViaVersion addon to allow 1.8.x and 1.7.x clients on newer server versions."
|
||||
description = "ViaBackwards addon to allow 1.8.x and 1.7.x clients on newer server versions."
|
||||
}
|
||||
|
||||
java.sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
|
||||
+25
-25
@@ -48,49 +48,49 @@ public class Protocol1_7_2_5To1_7_6_10 extends AbstractProtocol<ClientboundPacke
|
||||
this.registerClientbound(State.LOGIN, ClientboundLoginPackets.GAME_PROFILE.getId(), ClientboundLoginPackets.GAME_PROFILE.getId(), new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.STRING, REMOVE_DASHES); // uuid
|
||||
map(Type.STRING); // name
|
||||
map(Type.STRING, REMOVE_DASHES); // Uuid
|
||||
map(Type.STRING); // Name
|
||||
}
|
||||
});
|
||||
|
||||
this.registerClientbound(ClientboundPackets1_7_2_5.SPAWN_PLAYER, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.VAR_INT); // entity id
|
||||
map(Type.STRING, REMOVE_DASHES); // uuid
|
||||
map(Type.STRING); // name
|
||||
handler(wrapper -> { // delete data introduced in 1.7.6
|
||||
final int size = wrapper.read(Type.VAR_INT); // data count
|
||||
map(Type.VAR_INT); // Entity id
|
||||
map(Type.STRING, REMOVE_DASHES); // Uuid
|
||||
map(Type.STRING); // Name
|
||||
handler(wrapper -> {
|
||||
final int size = wrapper.read(Type.VAR_INT); // Data count
|
||||
for (int i = 0; i < size; i++) {
|
||||
wrapper.read(Type.STRING); // data name
|
||||
wrapper.read(Type.STRING); // data value
|
||||
wrapper.read(Type.STRING); // data signature
|
||||
wrapper.read(Type.STRING); // Data name
|
||||
wrapper.read(Type.STRING); // Data value
|
||||
wrapper.read(Type.STRING); // Data signature
|
||||
}
|
||||
});
|
||||
map(Type.INT); // x
|
||||
map(Type.INT); // y
|
||||
map(Type.INT); // z
|
||||
map(Type.BYTE); // yaw
|
||||
map(Type.BYTE); // pitch
|
||||
map(Type.SHORT); // item in hand
|
||||
map(Types1_7_6_10.METADATA_LIST); // metadata
|
||||
map(Type.INT); // X
|
||||
map(Type.INT); // Y
|
||||
map(Type.INT); // Z
|
||||
map(Type.BYTE); // Yaw
|
||||
map(Type.BYTE); // Pitch
|
||||
map(Type.SHORT); // Item in hand
|
||||
map(Types1_7_6_10.METADATA_LIST); // Metadata
|
||||
}
|
||||
});
|
||||
|
||||
this.registerClientbound(ClientboundPackets1_7_2_5.TEAMS, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.STRING); // team name
|
||||
map(Type.BYTE); // mode
|
||||
map(Type.STRING); // Team name
|
||||
map(Type.BYTE); // Mode
|
||||
handler(wrapper -> {
|
||||
final byte mode = wrapper.get(Type.BYTE, 0);
|
||||
if (mode == 0 || mode == 2) { // team is created or information is updated
|
||||
wrapper.passthrough(Type.STRING); // team display name
|
||||
wrapper.passthrough(Type.STRING); // team prefix
|
||||
wrapper.passthrough(Type.STRING); // team suffix
|
||||
wrapper.passthrough(Type.BYTE); // friendly fire
|
||||
if (mode == 0 || mode == 2) { // Team is created or information is updated
|
||||
wrapper.passthrough(Type.STRING); // Team display name
|
||||
wrapper.passthrough(Type.STRING); // Team prefix
|
||||
wrapper.passthrough(Type.STRING); // Team suffix
|
||||
wrapper.passthrough(Type.BYTE); // Friendly fire
|
||||
}
|
||||
if (mode == 0 || mode == 3 || mode == 4) { // team is created, player is added or player is removed
|
||||
if (mode == 0 || mode == 3 || mode == 4) { // Team is created, player is added or player is removed
|
||||
List<String> entryList = new ArrayList<>();
|
||||
final int size = wrapper.read(Type.SHORT);
|
||||
for (int i = 0; i < size; i++) {
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.viaversion.viarewind.protocol.protocol1_7_6_10to1_8.emulation;
|
||||
package com.viaversion.viarewind.protocol.protocol1_7_6_10to1_8.data;
|
||||
|
||||
import com.viaversion.viarewind.protocol.protocol1_7_2_5to1_7_6_10.ClientboundPackets1_7_2_5;
|
||||
import com.viaversion.viarewind.protocol.protocol1_7_6_10to1_8.Protocol1_7_6_10To1_8;
|
||||
+22
-9
@@ -17,13 +17,15 @@
|
||||
*/
|
||||
package com.viaversion.viarewind.protocol.protocol1_7_6_10to1_8.metadata;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.primitives.Ints;
|
||||
import com.viaversion.viarewind.ViaRewind;
|
||||
import com.viaversion.viarewind.api.rewriter.VREntityRewriter;
|
||||
import com.viaversion.viarewind.api.type.Types1_7_6_10;
|
||||
import com.viaversion.viarewind.api.type.metadata.MetaType1_7_6_10;
|
||||
import com.viaversion.viarewind.protocol.protocol1_7_2_5to1_7_6_10.ClientboundPackets1_7_2_5;
|
||||
import com.viaversion.viarewind.protocol.protocol1_7_6_10to1_8.Protocol1_7_6_10To1_8;
|
||||
import com.viaversion.viarewind.protocol.protocol1_7_6_10to1_8.emulation.VirtualHologramEntity;
|
||||
import com.viaversion.viarewind.protocol.protocol1_7_6_10to1_8.data.VirtualHologramEntity;
|
||||
import com.viaversion.viarewind.protocol.protocol1_7_6_10to1_8.storage.EntityTracker1_8;
|
||||
import com.viaversion.viarewind.protocol.protocol1_7_6_10to1_8.storage.GameProfileStorage;
|
||||
import com.viaversion.viarewind.protocol.protocol1_7_6_10to1_8.storage.Scoreboard;
|
||||
@@ -87,14 +89,19 @@ public class MetadataRewriter1_7_6_10To1_8 extends VREntityRewriter<ClientboundP
|
||||
});
|
||||
}
|
||||
});
|
||||
protocol.registerClientbound(ClientboundPackets1_8.DESTROY_ENTITIES, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.VAR_INT_ARRAY_PRIMITIVE, Types1_7_6_10.BYTE_INT_ARRAY); // Entity ids
|
||||
handler(wrapper -> {
|
||||
final int[] entities = wrapper.get(Types1_7_6_10.BYTE_INT_ARRAY, 0);
|
||||
untrackEntities(wrapper.user(), entities);
|
||||
});
|
||||
protocol.registerClientbound(ClientboundPackets1_8.DESTROY_ENTITIES, wrapper -> {
|
||||
final int[] entities = wrapper.read(Type.VAR_INT_ARRAY_PRIMITIVE);
|
||||
untrackEntities(wrapper.user(), entities);
|
||||
|
||||
wrapper.cancel();
|
||||
|
||||
// Split entity destroy packets into smaller packets because 1.8 can handle more entities at once then 1.7 can.
|
||||
final List<List<Integer>> parts = Lists.partition(Ints.asList(entities), Byte.MAX_VALUE);
|
||||
|
||||
for (List<Integer> part : parts) {
|
||||
final PacketWrapper destroy = PacketWrapper.create(ClientboundPackets1_7_2_5.DESTROY_ENTITIES, wrapper.user());
|
||||
destroy.write(Types1_7_6_10.BYTE_INT_ARRAY, part.stream().mapToInt(Integer::intValue).toArray());
|
||||
destroy.scheduleSend(Protocol1_7_6_10To1_8.class);
|
||||
}
|
||||
});
|
||||
protocol.registerClientbound(ClientboundPackets1_8.ENTITY_METADATA, new PacketHandlers() {
|
||||
@@ -404,6 +411,12 @@ public class MetadataRewriter1_7_6_10To1_8 extends VREntityRewriter<ClientboundP
|
||||
case Slot:
|
||||
metadata.setValue(protocol.getItemRewriter().handleItemToClient(event.user(), (Item) value));
|
||||
break;
|
||||
case Float:
|
||||
case String:
|
||||
case Short:
|
||||
case Position:
|
||||
metadata.setValue(value);
|
||||
break;
|
||||
default:
|
||||
event.cancel();
|
||||
break;
|
||||
|
||||
+10
-1
@@ -18,7 +18,7 @@
|
||||
package com.viaversion.viarewind.protocol.protocol1_7_6_10to1_8.packets;
|
||||
|
||||
import com.viaversion.viarewind.protocol.protocol1_7_6_10to1_8.Protocol1_7_6_10To1_8;
|
||||
import com.viaversion.viarewind.protocol.protocol1_7_6_10to1_8.emulation.VirtualHologramEntity;
|
||||
import com.viaversion.viarewind.protocol.protocol1_7_6_10to1_8.data.VirtualHologramEntity;
|
||||
import com.viaversion.viarewind.protocol.protocol1_7_6_10to1_8.storage.EntityTracker1_8;
|
||||
import com.viaversion.viarewind.protocol.protocol1_7_6_10to1_8.storage.GameProfileStorage;
|
||||
import com.viaversion.viarewind.protocol.protocol1_7_6_10to1_8.storage.PlayerSessionStorage;
|
||||
@@ -48,6 +48,15 @@ public class EntityPackets1_8 {
|
||||
wrapper.set(Types1_7_6_10.COMPRESSED_NBT_ITEM, 0, item);
|
||||
});
|
||||
|
||||
handler(wrapper -> {
|
||||
final EntityTracker1_8 tracker = wrapper.user().getEntityTracker(Protocol1_7_6_10To1_8.class);
|
||||
final int id = wrapper.get(Type.INT, 0);
|
||||
int limit = tracker.clientEntityId() == id ? 3 : 4;
|
||||
if (wrapper.get(Type.SHORT, 0) > limit) {
|
||||
wrapper.cancel();
|
||||
}
|
||||
});
|
||||
|
||||
handler(wrapper -> {
|
||||
final EntityTracker1_8 tracker = wrapper.user().getEntityTracker(Protocol1_7_6_10To1_8.class);
|
||||
final short slot = wrapper.get(Type.SHORT, 0);
|
||||
|
||||
+1
-1
@@ -701,7 +701,7 @@ public class PlayerPackets1_8 {
|
||||
abilitiesPacket.write(Type.BYTE, playerSession.combineAbilities());
|
||||
abilitiesPacket.write(Type.FLOAT, playerSession.sprinting ? playerSession.flySpeed * 2.0f : playerSession.flySpeed);
|
||||
abilitiesPacket.write(Type.FLOAT, playerSession.walkSpeed);
|
||||
abilitiesPacket.send(Protocol1_7_6_10To1_8.class);
|
||||
abilitiesPacket.scheduleSend(Protocol1_7_6_10To1_8.class);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
-1
@@ -204,7 +204,6 @@ public class ScoreboardPackets1_8 {
|
||||
wrapper.read(Type.STRING); // name tag visibility
|
||||
byte color = wrapper.read(Type.BYTE);
|
||||
if (mode == 2 && scoreboard.getTeamColor(team).get() != color) {
|
||||
String username = wrapper.user().getProtocolInfo().getUsername();
|
||||
String sidebar = scoreboard.getColorDependentSidebar().get(color);
|
||||
PacketWrapper sidebarPacket = wrapper.create(0x3D);
|
||||
sidebarPacket.write(Type.BYTE, (byte) 1);
|
||||
|
||||
+3
-3
@@ -224,7 +224,7 @@ public class WorldPackets1_8 {
|
||||
mapData.write(Type.SHORT, (short) columnData.length); // data length
|
||||
mapData.write(new FixedByteArrayType(columnData.length), columnData); // data
|
||||
|
||||
mapData.send(Protocol1_7_6_10To1_8.class, true);
|
||||
mapData.send(Protocol1_7_6_10To1_8.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ public class WorldPackets1_8 {
|
||||
mapData.write(Type.SHORT, (short) iconData.length); // data length
|
||||
mapData.write(new FixedByteArrayType(iconData.length), iconData); // data
|
||||
|
||||
mapData.send(Protocol1_7_6_10To1_8.class, true);
|
||||
mapData.send(Protocol1_7_6_10To1_8.class);
|
||||
}
|
||||
|
||||
// Update scale
|
||||
@@ -251,7 +251,7 @@ public class WorldPackets1_8 {
|
||||
mapData.write(Type.SHORT, (short) 2); // data length
|
||||
mapData.write(new FixedByteArrayType(2), new byte[]{2, scale}); // data
|
||||
|
||||
mapData.send(Protocol1_7_6_10To1_8.class, true);
|
||||
mapData.send(Protocol1_7_6_10To1_8.class);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ package com.viaversion.viarewind.protocol.protocol1_7_6_10to1_8.storage;
|
||||
import com.viaversion.viarewind.ViaRewind;
|
||||
import com.viaversion.viarewind.protocol.protocol1_7_2_5to1_7_6_10.ServerboundPackets1_7_2_5;
|
||||
import com.viaversion.viarewind.protocol.protocol1_7_6_10to1_8.Protocol1_7_6_10To1_8;
|
||||
import com.viaversion.viarewind.protocol.protocol1_7_6_10to1_8.emulation.VirtualHologramEntity;
|
||||
import com.viaversion.viarewind.protocol.protocol1_7_6_10to1_8.data.VirtualHologramEntity;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_10;
|
||||
@@ -148,7 +148,7 @@ public class EntityTracker1_8 extends EntityTrackerBase {
|
||||
attachEntity.write(Type.INT, target); // passenger id
|
||||
attachEntity.write(Type.BOOLEAN, false); // leash
|
||||
|
||||
attachEntity.scheduleSend(Protocol1_7_6_10To1_8.class, true);
|
||||
attachEntity.scheduleSend(Protocol1_7_6_10To1_8.class);
|
||||
} catch (Exception e) {
|
||||
ViaRewind.getPlatform().getLogger().log(Level.SEVERE, "Failed to send attach packet", e);
|
||||
}
|
||||
|
||||
+1
-1
@@ -85,7 +85,7 @@ public class WorldBorderUpdateTask implements Runnable {
|
||||
spawnParticle.write(Type.INT, (int) Math.floor((maxH - minH) * (maxV - minV) * 0.5));
|
||||
|
||||
try {
|
||||
spawnParticle.send(Protocol1_7_6_10To1_8.class, true);
|
||||
spawnParticle.send(Protocol1_7_6_10To1_8.class);
|
||||
} catch (Exception e) {
|
||||
ViaRewind.getPlatform().getLogger().log(Level.SEVERE, "Failed to send world border particle", e);
|
||||
}
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ public final class RewindMappings extends com.viaversion.viarewind.api.data.Rewi
|
||||
protected void loadExtras(CompoundTag data) {
|
||||
super.loadExtras(data);
|
||||
|
||||
final JsonArray sounds = VRMappingDataLoader.INSTANCE.loadData("sounds-1.9.4.json").getAsJsonArray("sounds");
|
||||
final JsonArray sounds = VRMappingDataLoader.INSTANCE.loadData("sounds-1.9.json").getAsJsonArray("sounds");
|
||||
for (final JsonElement sound : sounds) {
|
||||
this.sounds.add(sound.getAsString());
|
||||
}
|
||||
|
||||
+2
-2
@@ -50,7 +50,7 @@ public class BossBarVisualization implements CooldownVisualization {
|
||||
wrapper.write(Type.VAR_INT, 2); // Action - update health
|
||||
wrapper.write(Type.FLOAT, (float) progress); // Health
|
||||
}
|
||||
wrapper.scheduleSend(Protocol1_8To1_9.class, false);
|
||||
wrapper.send(Protocol1_8To1_9.class, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -61,7 +61,7 @@ public class BossBarVisualization implements CooldownVisualization {
|
||||
PacketWrapper wrapper = PacketWrapper.create(ClientboundPackets1_9.BOSSBAR, null, user);
|
||||
wrapper.write(Type.UUID, bossUUID);
|
||||
wrapper.write(Type.VAR_INT, 1); // Action - remove
|
||||
wrapper.scheduleSend(Protocol1_8To1_9.class, false);
|
||||
wrapper.send(Protocol1_8To1_9.class, false);
|
||||
bossUUID = null;
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -247,14 +247,13 @@ public class MetadataRewriter1_8To1_9 extends VREntityRewriter<ClientboundPacket
|
||||
}
|
||||
if (metaIndex.getOldType() == null || metaIndex.getNewType() == null) {
|
||||
if (metaIndex == MetaIndex.PLAYER_HAND) { // Player eating/aiming/drinking
|
||||
int status = tracker.getStatus().getOrDefault(event.entityId(), 0);
|
||||
byte status = (byte) tracker.getStatus().getOrDefault(event.entityId(), 0);
|
||||
if ((((byte) metadata.value()) & 1 << HAND_ACTIVE_BIT) != 0) {
|
||||
status = (byte) (status | 1 << STATUS_USE_BIT);
|
||||
} else {
|
||||
status = (byte) (status & ~(1 << STATUS_USE_BIT));
|
||||
}
|
||||
event.createExtraMeta(new Metadata(MetaIndex.ENTITY_STATUS.getIndex(), MetaType1_8.Byte, status));
|
||||
return;
|
||||
}
|
||||
event.cancel();
|
||||
return;
|
||||
|
||||
@@ -201,12 +201,12 @@
|
||||
"430": {
|
||||
"id": "324",
|
||||
"data": "-1",
|
||||
"name": "1.8 Dark Oak Door"
|
||||
"name": "1.8 Acacia Door"
|
||||
},
|
||||
"431": {
|
||||
"id": "324",
|
||||
"data": "-1",
|
||||
"name": "1.8 Acacia Door"
|
||||
"name": "1.8 Dark Oak Door"
|
||||
},
|
||||
"1:1": {
|
||||
"id": "1",
|
||||
@@ -271,25 +271,32 @@
|
||||
},
|
||||
"blocks": {
|
||||
"176": {
|
||||
"id": "63"
|
||||
"id": "63",
|
||||
"data": "-1"
|
||||
},
|
||||
"177": {
|
||||
"id": "68"
|
||||
"id": "68",
|
||||
"data": "-1"
|
||||
},
|
||||
"193": {
|
||||
"id": "64"
|
||||
"id": "64",
|
||||
"data": "-1"
|
||||
},
|
||||
"194": {
|
||||
"id": "64"
|
||||
"id": "64",
|
||||
"data": "-1"
|
||||
},
|
||||
"195": {
|
||||
"id": "64"
|
||||
"id": "64",
|
||||
"data": "-1"
|
||||
},
|
||||
"196": {
|
||||
"id": "64"
|
||||
"id": "64",
|
||||
"data": "-1"
|
||||
},
|
||||
"197": {
|
||||
"id": "64"
|
||||
"id": "64",
|
||||
"data": "-1"
|
||||
},
|
||||
"77:5": {
|
||||
"id": "69",
|
||||
@@ -324,7 +331,8 @@
|
||||
"data": "8"
|
||||
},
|
||||
"178": {
|
||||
"id": "151"
|
||||
"id": "151",
|
||||
"data": "-1"
|
||||
},
|
||||
"182:0": {
|
||||
"id": "44",
|
||||
|
||||
@@ -203,7 +203,8 @@
|
||||
},
|
||||
"blocks": {
|
||||
"209": {
|
||||
"id": "119"
|
||||
"id": "119",
|
||||
"data": "-1"
|
||||
},
|
||||
"198:0": {
|
||||
"id": "50",
|
||||
@@ -242,7 +243,8 @@
|
||||
"data": "15"
|
||||
},
|
||||
"207": {
|
||||
"id": "141"
|
||||
"id": "141",
|
||||
"data": "-1"
|
||||
},
|
||||
"137": {
|
||||
"id": "137",
|
||||
|
||||
-1
@@ -415,7 +415,6 @@
|
||||
"item.bucket.fill",
|
||||
"item.bucket.fill_lava",
|
||||
"item.chorus_fruit.teleport",
|
||||
"item.elytra.flying",
|
||||
"item.firecharge.use",
|
||||
"item.flintandsteel.use",
|
||||
"item.hoe.till",
|
||||
+1
-1
@@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx8G
|
||||
org.gradle.parallel=true
|
||||
|
||||
# project
|
||||
maven_version=3.1.1
|
||||
maven_version=3.1.2
|
||||
maven_group=com.viaversion
|
||||
|
||||
# libraries
|
||||
|
||||
@@ -37,7 +37,7 @@ import java.util.logging.Logger;
|
||||
name = "ViaRewind",
|
||||
version = ViaRewindPlatform.VERSION,
|
||||
authors = { "FlorianMichael/EnZaXD", "Gerrygames", "creeper123123321"},
|
||||
description = "ViaVersion addon to allow 1.8.x and 1.7.x clients on newer server versions.",
|
||||
description = "ViaBackwards addon to allow 1.8.x and 1.7.x clients on newer server versions.",
|
||||
dependencies = {
|
||||
@Dependency(id = "viaversion"),
|
||||
@Dependency(id = "viabackwards")
|
||||
|
||||
Reference in new issue
Block a user