Added 1.20.5 support finished
This commit is contained in:
parent
ef49048ee1
commit
f25c727a15
2 changed files with 12 additions and 7 deletions
|
@ -113,8 +113,6 @@ public class MapSender {
|
||||||
final int id = -id0;
|
final int id = -id0;
|
||||||
Object packet;
|
Object packet;
|
||||||
if (supports(20, 4)) { //1.20.5+
|
if (supports(20, 4)) { //1.20.5+
|
||||||
//TODO: Implement 1.20.5+ map sending
|
|
||||||
|
|
||||||
Object updateData = ReflectionUtil.callConstructor(worldMapData,
|
Object updateData = ReflectionUtil.callConstructor(worldMapData,
|
||||||
content.minX, //X pos
|
content.minX, //X pos
|
||||||
content.minY, //Y pos
|
content.minY, //Y pos
|
||||||
|
@ -123,8 +121,10 @@ public class MapSender {
|
||||||
content.array //Data
|
content.array //Data
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Object mapId = ReflectionUtil.callConstructor(getNMSClass("world.level.saveddata.maps", "MapId"), id);
|
||||||
|
|
||||||
packet = ReflectionUtil.callConstructor(packetPlayOutMapClass,
|
packet = ReflectionUtil.callConstructor(packetPlayOutMapClass,
|
||||||
id, //ID
|
mapId, //ID
|
||||||
(byte) 0, //Scale, 0 = 1 block per pixel
|
(byte) 0, //Scale, 0 = 1 block per pixel
|
||||||
false, //Show icons
|
false, //Show icons
|
||||||
new ReflectionUtil.CollectionParam<>(), //Icons
|
new ReflectionUtil.CollectionParam<>(), //Icons
|
||||||
|
|
|
@ -165,8 +165,8 @@ public class MapWrapper extends AbstractMapWrapper {
|
||||||
|
|
||||||
String inventoryMenuName;
|
String inventoryMenuName;
|
||||||
if (supports(20)) {
|
if (supports(20)) {
|
||||||
//>= 1.20.2 = bR, 1.20(.1) = bQ
|
//1.20.5 = cb, 1.20.2 - 1.20.4 = bR, 1.20(.1) = bQ
|
||||||
inventoryMenuName = supports(20, 2) ? "bR" : "bQ";
|
inventoryMenuName = supports(20, 4) ? "cb" : supports(20, 2) ? "bR" : "bQ";
|
||||||
} else if (supports(19)) {
|
} else if (supports(19)) {
|
||||||
//1.19.4 = bO, >= 1.19.3 = bT
|
//1.19.4 = bO, >= 1.19.3 = bT
|
||||||
inventoryMenuName = supports(19, 3) ? "bO" : "bT";
|
inventoryMenuName = supports(19, 3) ? "bO" : "bT";
|
||||||
|
@ -286,7 +286,12 @@ public class MapWrapper extends AbstractMapWrapper {
|
||||||
|
|
||||||
Object nmsStack = ReflectionUtil.callMethod(craftStackClass, "asNMSCopy", stack);
|
Object nmsStack = ReflectionUtil.callMethod(craftStackClass, "asNMSCopy", stack);
|
||||||
|
|
||||||
if (supports(13)) {
|
//1.20.5 uses new NBT compound system
|
||||||
|
if (supports(20, 4)) {
|
||||||
|
Object mapIdComponent = ReflectionUtil.getDeclaredField(getNMSClass("core.component", "DataComponents"), "B");
|
||||||
|
Object mapId1 = ReflectionUtil.callConstructor(getNMSClass("world.level.saveddata.maps", "MapId"), mapId);
|
||||||
|
ReflectionUtil.callMethod(nmsStack, "b", mapIdComponent, mapId1);
|
||||||
|
} else if (supports(13)) {
|
||||||
String nbtObjectName;
|
String nbtObjectName;
|
||||||
if (supports(20)) { //1.20
|
if (supports(20)) { //1.20
|
||||||
nbtObjectName = "w";
|
nbtObjectName = "w";
|
||||||
|
@ -328,7 +333,7 @@ public class MapWrapper extends AbstractMapWrapper {
|
||||||
|
|
||||||
Object packet;
|
Object packet;
|
||||||
if (supports(19, 3)) { //1.19.3
|
if (supports(19, 3)) { //1.19.3
|
||||||
Class<?> dataWatcherRecordClass = getNMSClass("network.syncher", "DataWatcher$b");
|
Class<?> dataWatcherRecordClass = getNMSClass("network.syncher", supports(20, 4) ? "DataWatcher$c" : "DataWatcher$b"); //1.20.5 = c, lower is b
|
||||||
// Sadly not possible to use ReflectionUtil (in its current state), because of the Object parameter
|
// Sadly not possible to use ReflectionUtil (in its current state), because of the Object parameter
|
||||||
Object dataWatcherItem;
|
Object dataWatcherItem;
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Reference in a new issue