Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c595c654aa | ||
|
|
c0d1cabb12 | ||
|
|
51e81c7bb1 | ||
|
|
6bdaa54ce8 | ||
|
|
65ac2f37f2 | ||
|
|
b08bb90cef | ||
|
|
89e76d369b | ||
|
|
ed8cc47c7a | ||
|
|
d988fdc849 | ||
|
|
a0ff53fb9d | ||
|
|
1d1dd7dc66 | ||
|
|
cb4ef9ffa8 | ||
|
|
459f403541 | ||
|
|
465962b939 | ||
|
|
2fad493eac | ||
|
|
fb8ea8c4f8 | ||
|
|
9713e5a8a4 | ||
|
|
7cee59f548 | ||
|
|
c7e638fc70 | ||
|
|
a4b445cf1f | ||
|
|
6859f6125c |
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;
|
||||
|
||||
+15
-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);
|
||||
@@ -278,6 +287,11 @@ public class EntityPackets1_8 {
|
||||
public void register() {
|
||||
map(Type.VAR_INT, Type.INT); // entity id
|
||||
handler(wrapper -> {
|
||||
final EntityTracker1_8 tracker = wrapper.user().getEntityTracker(Protocol1_7_6_10To1_8.class);
|
||||
if (tracker.getHolograms().containsKey(wrapper.get(Type.INT, 0))) { // Don't handle properties for hologram emulation
|
||||
wrapper.cancel();
|
||||
return;
|
||||
}
|
||||
final int amount = wrapper.passthrough(Type.INT);
|
||||
for (int i = 0; i < amount; i++) {
|
||||
wrapper.passthrough(Type.STRING); // id
|
||||
|
||||
+2
-2
@@ -366,7 +366,7 @@ public class PlayerPackets1_8 {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.STRING);
|
||||
handler(wrapper -> {
|
||||
handlerSoftFail(wrapper -> {
|
||||
String channel = wrapper.get(Type.STRING, 0);
|
||||
if (channel.equals("MC|TrList")) {
|
||||
wrapper.passthrough(Type.INT); //Window Id
|
||||
@@ -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;
|
||||
|
||||
+32
-2
@@ -65,7 +65,14 @@ public class BlockItemPackets1_9 extends VRBlockItemRewriter<ClientboundPackets1
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_9.CLOSE_WINDOW, wrapper -> {
|
||||
final short windowId = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
||||
wrapper.user().get(WindowTracker.class).remove(windowId);
|
||||
|
||||
final WindowTracker tracker = wrapper.user().get(WindowTracker.class);
|
||||
|
||||
final String windowType = tracker.get(windowId);
|
||||
if (windowType != null && windowType.equalsIgnoreCase("minecraft:enchanting_table")) {
|
||||
tracker.clearEnchantmentProperties();
|
||||
}
|
||||
tracker.remove(windowId);
|
||||
});
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_9.OPEN_WINDOW, wrapper -> {
|
||||
@@ -87,7 +94,7 @@ public class BlockItemPackets1_9 extends VRBlockItemRewriter<ClientboundPackets1
|
||||
protocol.registerClientbound(ClientboundPackets1_9.WINDOW_ITEMS, wrapper -> {
|
||||
final short windowId = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
||||
|
||||
Item[] items = wrapper.passthrough(Type.ITEM1_8_SHORT_ARRAY);
|
||||
Item[] items = wrapper.read(Type.ITEM1_8_SHORT_ARRAY);
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
items[i] = handleItemToClient(wrapper.user(), items[i]);
|
||||
}
|
||||
@@ -107,6 +114,8 @@ public class BlockItemPackets1_9 extends VRBlockItemRewriter<ClientboundPackets1
|
||||
System.arraycopy(old, 5, items, 4, old.length - 5);
|
||||
}
|
||||
}
|
||||
|
||||
wrapper.write(Type.ITEM1_8_SHORT_ARRAY, items);
|
||||
});
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_9.SET_SLOT, wrapper -> {
|
||||
@@ -161,6 +170,27 @@ public class BlockItemPackets1_9 extends VRBlockItemRewriter<ClientboundPackets1
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
protocol.registerClientbound(ClientboundPackets1_9.WINDOW_PROPERTY, wrapper -> {
|
||||
final short windowId = wrapper.passthrough(Type.UNSIGNED_BYTE);
|
||||
short key = wrapper.read(Type.SHORT);
|
||||
short value = wrapper.read(Type.SHORT);
|
||||
|
||||
final WindowTracker tracker = wrapper.user().get(WindowTracker.class);
|
||||
final String windowType = tracker.get(windowId);
|
||||
if (windowType != null && windowType.equalsIgnoreCase("minecraft:enchanting_table")) {
|
||||
if (key >= 4 && key <= 6) { // Store enchantment ids
|
||||
tracker.putEnchantmentProperty(key, value);
|
||||
wrapper.cancel();
|
||||
} else if (key >= 7 && key <= 9) { // Mix levels with tracked ids
|
||||
key -= 3;
|
||||
final short property = tracker.getEnchantmentValue(key);
|
||||
value = (short) (property | (value << 8));
|
||||
}
|
||||
}
|
||||
wrapper.write(Type.SHORT, key);
|
||||
wrapper.write(Type.SHORT, value);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -504,7 +504,7 @@ public class PlayerPackets1_9 {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.STRING);
|
||||
handler(wrapper -> {
|
||||
handlerSoftFail(wrapper -> {
|
||||
String channel = wrapper.get(Type.STRING, 0);
|
||||
if (channel.equals("MC|BEdit") || channel.equals("MC|BSign")) {
|
||||
Item book = wrapper.passthrough(Type.ITEM);
|
||||
|
||||
+10
-10
@@ -48,17 +48,17 @@ public class WorldPackets1_9 {
|
||||
protocol.registerClientbound(ClientboundPackets1_9.BLOCK_ENTITY_DATA, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.POSITION1_8);
|
||||
map(Type.UNSIGNED_BYTE);
|
||||
map(Type.NAMED_COMPOUND_TAG);
|
||||
map(Type.POSITION1_8); // Position
|
||||
map(Type.UNSIGNED_BYTE); // Action
|
||||
map(Type.NAMED_COMPOUND_TAG); // Tag
|
||||
handler(wrapper -> {
|
||||
CompoundTag tag = wrapper.get(Type.NAMED_COMPOUND_TAG, 0);
|
||||
if (tag != null && tag.contains("SpawnData")) {
|
||||
CompoundTag spawnData = tag.get("SpawnData");
|
||||
if (spawnData.contains("id")) {
|
||||
String entity = (String) spawnData.get("id").getValue();
|
||||
tag.remove("SpawnData");
|
||||
tag.put("entityId", new StringTag(entity));
|
||||
final CompoundTag tag = wrapper.get(Type.NAMED_COMPOUND_TAG, 0);
|
||||
|
||||
final CompoundTag spawnData = tag.remove("SpawnData");
|
||||
if (spawnData != null) {
|
||||
final StringTag id = spawnData.remove("id");
|
||||
if (id != null) {
|
||||
tag.put("EntityId", id);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ public class EntityTracker1_9 extends EntityTrackerBase {
|
||||
offsets.remove(id);
|
||||
status.remove(id);
|
||||
|
||||
vehicles.forEach((vehicle, passengers) -> passengers.removeInt(id));
|
||||
vehicles.forEach((vehicle, passengers) -> passengers.rem(id));
|
||||
vehicles.int2ObjectEntrySet().removeIf(entry -> entry.getValue().isEmpty());
|
||||
super.removeEntity(id);
|
||||
}
|
||||
|
||||
+17
@@ -32,10 +32,12 @@ import com.viaversion.viaversion.libs.mcstructs.text.serializer.TextComponentSer
|
||||
import com.viaversion.viaversion.protocols.protocol1_8.ClientboundPackets1_8;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class WindowTracker extends StoredObject {
|
||||
private final HashMap<Short, String> types = new HashMap<>();
|
||||
private final HashMap<Short, Item[]> brewingItems = new HashMap<>();
|
||||
private final Map<Short, Short> enchantmentProperties = new HashMap<>();
|
||||
|
||||
public WindowTracker(UserConnection user) {
|
||||
super(user);
|
||||
@@ -63,6 +65,21 @@ public class WindowTracker extends StoredObject {
|
||||
});
|
||||
}
|
||||
|
||||
public short getEnchantmentValue(final short key) {
|
||||
if (!enchantmentProperties.containsKey(key)) {
|
||||
return 0;
|
||||
}
|
||||
return enchantmentProperties.remove(key);
|
||||
}
|
||||
|
||||
public void putEnchantmentProperty(short key, short value) {
|
||||
enchantmentProperties.put(key, value);
|
||||
}
|
||||
|
||||
public void clearEnchantmentProperties() {
|
||||
enchantmentProperties.clear();
|
||||
}
|
||||
|
||||
public static void updateBrewingStand(UserConnection user, Item blazePowder, short windowId) throws Exception {
|
||||
if (blazePowder != null && blazePowder.identifier() != 377) {
|
||||
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",
|
||||
|
||||
@@ -84,155 +84,127 @@
|
||||
"199": {
|
||||
"id": "35",
|
||||
"data": "10",
|
||||
"name": "1.9 Chorus Plant",
|
||||
"block": true
|
||||
"name": "1.9 Chorus Plant"
|
||||
},
|
||||
"200": {
|
||||
"id": "35",
|
||||
"data": "2",
|
||||
"name": "1.9 Chorus Flower",
|
||||
"block": true
|
||||
"name": "1.9 Chorus Flower"
|
||||
},
|
||||
"201": {
|
||||
"id": "155",
|
||||
"data": "0",
|
||||
"name": "1.9 Purpur Block",
|
||||
"block": true
|
||||
"name": "1.9 Purpur Block"
|
||||
},
|
||||
"202": {
|
||||
"id": "155",
|
||||
"data": "2",
|
||||
"name": "1.9 Purpur Pillar",
|
||||
"block": true
|
||||
"name": "1.9 Purpur Pillar"
|
||||
},
|
||||
"206": {
|
||||
"id": "121",
|
||||
"data": "0",
|
||||
"name": "1.9 Endstone Bricks",
|
||||
"block": true
|
||||
"name": "1.9 Endstone Bricks"
|
||||
},
|
||||
"207": {
|
||||
"id": "141",
|
||||
"name": "1.9 Beetroot Block",
|
||||
"block": true
|
||||
"name": "1.9 Beetroot Block"
|
||||
},
|
||||
"208": {
|
||||
"id": "2",
|
||||
"data": "0",
|
||||
"name": "1.9 Grass Path",
|
||||
"block": true
|
||||
},
|
||||
"209": {
|
||||
"id": "90",
|
||||
"name": "1.9 End Gateway",
|
||||
"block": true
|
||||
"name": "1.9 Grass Path"
|
||||
},
|
||||
"210": {
|
||||
"id": "137",
|
||||
"data": "0",
|
||||
"name": "1.9 Repeating Command Block",
|
||||
"block": true
|
||||
"name": "1.9 Repeating Command Block"
|
||||
},
|
||||
"211": {
|
||||
"id": "137",
|
||||
"data": "0",
|
||||
"name": "1.9 Chain Command Block",
|
||||
"block": true
|
||||
"name": "1.9 Chain Command Block"
|
||||
},
|
||||
"212": {
|
||||
"id": "79",
|
||||
"data": "0",
|
||||
"name": "1.9 Frosted Ice",
|
||||
"block": true
|
||||
"name": "1.9 Frosted Ice"
|
||||
},
|
||||
"214": {
|
||||
"id": "87",
|
||||
"data": "0",
|
||||
"name": "1.9 Nether Wart Block",
|
||||
"block": true
|
||||
"name": "1.9 Nether Wart Block"
|
||||
},
|
||||
"215": {
|
||||
"id": "112",
|
||||
"data": "0",
|
||||
"name": "1.9 Red Nether Brick",
|
||||
"block": true
|
||||
"name": "1.9 Red Nether Brick"
|
||||
},
|
||||
"217": {
|
||||
"id": "166",
|
||||
"data": "0",
|
||||
"name": "1.9 Structure Void",
|
||||
"block": true
|
||||
"name": "1.9 Structure Void"
|
||||
},
|
||||
"255": {
|
||||
"id": "137",
|
||||
"data": "0",
|
||||
"name": "1.9 Structure Block",
|
||||
"block": true
|
||||
"name": "1.9 Structure Block"
|
||||
},
|
||||
"203:0": {
|
||||
"id": "156",
|
||||
"data": "0",
|
||||
"name": "1.9 Purpur Stairs",
|
||||
"block": true
|
||||
"name": "1.9 Purpur Stairs"
|
||||
},
|
||||
"203:1": {
|
||||
"id": "156",
|
||||
"data": "1",
|
||||
"name": "1.9 Purpur Stairs",
|
||||
"block": true
|
||||
"name": "1.9 Purpur Stairs"
|
||||
},
|
||||
"203:2": {
|
||||
"id": "156",
|
||||
"data": "2",
|
||||
"name": "1.9 Purpur Stairs",
|
||||
"block": true
|
||||
"name": "1.9 Purpur Stairs"
|
||||
},
|
||||
"203:3": {
|
||||
"id": "156",
|
||||
"data": "3",
|
||||
"name": "1.9 Purpur Stairs",
|
||||
"block": true
|
||||
"name": "1.9 Purpur Stairs"
|
||||
},
|
||||
"203:4": {
|
||||
"id": "156",
|
||||
"data": "4",
|
||||
"name": "1.9 Purpur Stairs",
|
||||
"block": true
|
||||
"name": "1.9 Purpur Stairs"
|
||||
},
|
||||
"203:5": {
|
||||
"id": "156",
|
||||
"data": "5",
|
||||
"name": "1.9 Purpur Stairs",
|
||||
"block": true
|
||||
"name": "1.9 Purpur Stairs"
|
||||
},
|
||||
"203:6": {
|
||||
"id": "156",
|
||||
"data": "6",
|
||||
"name": "1.9 Purpur Stairs",
|
||||
"block": true
|
||||
"name": "1.9 Purpur Stairs"
|
||||
},
|
||||
"203:7": {
|
||||
"id": "156",
|
||||
"data": "7",
|
||||
"name": "1.9 Purpur Stairs",
|
||||
"block": true
|
||||
"name": "1.9 Purpur Stairs"
|
||||
},
|
||||
"203:8": {
|
||||
"id": "156",
|
||||
"data": "8",
|
||||
"name": "1.9 Purpur Stairs",
|
||||
"block": true
|
||||
"name": "1.9 Purpur Stairs"
|
||||
},
|
||||
"397:5": {
|
||||
"id": "397",
|
||||
"data": "0",
|
||||
"name": "1.9 Dragon Head",
|
||||
"block": true
|
||||
"name": "1.9 Dragon Head"
|
||||
}
|
||||
},
|
||||
"blocks": {
|
||||
"209": {
|
||||
"id": "119"
|
||||
"id": "119",
|
||||
"data": "-1"
|
||||
},
|
||||
"198:0": {
|
||||
"id": "50",
|
||||
@@ -271,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",
|
||||
+3
-3
@@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx8G
|
||||
org.gradle.parallel=true
|
||||
|
||||
# project
|
||||
maven_version=3.1.0
|
||||
maven_version=3.1.2
|
||||
maven_group=com.viaversion
|
||||
|
||||
# libraries
|
||||
@@ -13,7 +13,7 @@ netty_version=4.0.20.Final
|
||||
guava_version=17.0
|
||||
|
||||
# Smile emoji
|
||||
mcVersions=1.20.5, 1.20.4, 1.20.3, 1.20.2, 1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2, 1.18.1, 1.18, 1.17.1, 1.17, 1.16.5, 1.16.4, 1.16.3, 1.16.2, 1.16.1, 1.16, 1.15.2, 1.15.1, 1.15, 1.14.4, 1.14.3, 1.14.2, 1.14.1, 1.14, 1.13.2, 1.13.1, 1.13, 1.12.2, 1.12.1, 1.12, 1.11.2, 1.11.1, 1.11, 1.10.2, 1.10.1, 1.10, 1.9.4, 1.9.3, 1.9.2, 1.9.1, 1.9, 1.8.9, 1.8.8
|
||||
mcVersionRange=1.8-1.20.5
|
||||
mcVersions=1.20.6, 1.20.5, 1.20.4, 1.20.3, 1.20.2, 1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2, 1.18.1, 1.18, 1.17.1, 1.17, 1.16.5, 1.16.4, 1.16.3, 1.16.2, 1.16.1, 1.16, 1.15.2, 1.15.1, 1.15, 1.14.4, 1.14.3, 1.14.2, 1.14.1, 1.14, 1.13.2, 1.13.1, 1.13, 1.12.2, 1.12.1, 1.12, 1.11.2, 1.11.1, 1.11, 1.10.2, 1.10.1, 1.10, 1.9.4, 1.9.3, 1.9.2, 1.9.1, 1.9, 1.8.9, 1.8.8
|
||||
mcVersionRange=1.8-1.20.6
|
||||
waterfallVersion=1.20
|
||||
velocityVersion=3.3
|
||||
@@ -21,6 +21,9 @@ java {
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
manifest {
|
||||
attributes["paperweight-mappings-namespace"] = "mojang"
|
||||
}
|
||||
archiveClassifier.set("")
|
||||
archiveBaseName.set("ViaRewind-" + project.maven_version)
|
||||
configurations {
|
||||
|
||||
@@ -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