Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d988fdc849 | ||
|
|
a0ff53fb9d | ||
|
|
1d1dd7dc66 | ||
|
|
cb4ef9ffa8 | ||
|
|
459f403541 | ||
|
|
465962b939 | ||
|
|
2fad493eac | ||
|
|
fb8ea8c4f8 | ||
|
|
9713e5a8a4 | ||
|
|
7cee59f548 | ||
|
|
c7e638fc70 | ||
|
|
a4b445cf1f | ||
|
|
6859f6125c |
No files matched your search
+5
@@ -278,6 +278,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
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
+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;
|
||||
|
||||
@@ -84,150 +84,121 @@
|
||||
"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": {
|
||||
|
||||
+3
-3
@@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx8G
|
||||
org.gradle.parallel=true
|
||||
|
||||
# project
|
||||
maven_version=3.1.0
|
||||
maven_version=3.1.1
|
||||
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 {
|
||||
|
||||
Reference in new issue
Block a user