feat: still researching packets support
This commit is contained in:
parent
3037945729
commit
af7081a87a
3 changed files with 23 additions and 14 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -50,3 +50,5 @@ dependency-reduced-pom.xml
|
||||||
|
|
||||||
# Kept for convenience
|
# Kept for convenience
|
||||||
v1_19_R3
|
v1_19_R3
|
||||||
|
# MockBukkit logs
|
||||||
|
logs
|
|
@ -149,8 +149,8 @@ public class AppearanceManager {
|
||||||
respawn.setDifficulty(world.getDifficulty());
|
respawn.setDifficulty(world.getDifficulty());
|
||||||
respawn.setCopyMetadata(false);
|
respawn.setCopyMetadata(false);
|
||||||
respawn.getHandle().getBooleans().write(0, false); // is debug
|
respawn.getHandle().getBooleans().write(0, false); // is debug
|
||||||
respawn.getHandle().getBooleans().write(1, false); // is flat
|
respawn.getHandle().getBooleans().write(1, true); // is flat
|
||||||
respawn.broadcastPacket();
|
respawn.sendPacket(player);
|
||||||
/*final EntityPlayer cp = ((CraftPlayer) player).getHandle();
|
/*final EntityPlayer cp = ((CraftPlayer) player).getHandle();
|
||||||
final PacketPlayOutRespawn respawn = new PacketPlayOutRespawn(cp.cG().Z(), cp.P(), player.getWorld().getSeed(), EnumGamemode.a, EnumGamemode.a, true, true, (byte) 0x00, Optional.empty());
|
final PacketPlayOutRespawn respawn = new PacketPlayOutRespawn(cp.cG().Z(), cp.P(), player.getWorld().getSeed(), EnumGamemode.a, EnumGamemode.a, true, true, (byte) 0x00, Optional.empty());
|
||||||
cp.b.a(respawn);*/
|
cp.b.a(respawn);*/
|
||||||
|
|
|
@ -2,9 +2,12 @@ package net.artelnatif.nicko.wrapper;
|
||||||
|
|
||||||
import com.comphenix.protocol.PacketType;
|
import com.comphenix.protocol.PacketType;
|
||||||
import com.comphenix.protocol.events.PacketContainer;
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
|
import com.comphenix.protocol.utility.MinecraftReflection;
|
||||||
import com.comphenix.protocol.utility.MinecraftVersion;
|
import com.comphenix.protocol.utility.MinecraftVersion;
|
||||||
import com.comphenix.protocol.wrappers.BlockPosition;
|
import com.comphenix.protocol.wrappers.BlockPosition;
|
||||||
|
import com.comphenix.protocol.wrappers.BukkitConverters;
|
||||||
import com.comphenix.protocol.wrappers.EnumWrappers;
|
import com.comphenix.protocol.wrappers.EnumWrappers;
|
||||||
|
import com.google.common.hash.Hashing;
|
||||||
import org.bukkit.Difficulty;
|
import org.bukkit.Difficulty;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
@ -27,12 +30,11 @@ public class WrapperPlayServerRespawn extends AbstractPacket {
|
||||||
}
|
}
|
||||||
|
|
||||||
//.............
|
//.............
|
||||||
// Dimension Field (1.8 - Present)
|
// Dimension/World Field
|
||||||
// The dimension field has changed numerous times:
|
// The dimension field has changed numerous times:
|
||||||
// - Version 1.8 through 1.15 need an integer,
|
// - 1.8 through 1.17 (?) need an integer,
|
||||||
// - 1.15 through 1.18 need a (NBT Tag) Identifier and
|
// - 1.18 need a Holder of a World ResourceKey,
|
||||||
// - 1.19.2 and beyond require a Holder of a DimensionManager Identifier (???).
|
// - 1.19.2 reverted 1.18 and simply need a World ResourceKey.
|
||||||
// (Wiki.vg still refers to this as an "Identifier")
|
|
||||||
//
|
//
|
||||||
// n.b.: this field is a nightmare please mojang stop refactoring
|
// n.b.: this field is a nightmare please mojang stop refactoring
|
||||||
// your code to change things that were working perfectly fine before
|
// your code to change things that were working perfectly fine before
|
||||||
|
@ -50,10 +52,16 @@ public class WrapperPlayServerRespawn extends AbstractPacket {
|
||||||
if (MinecraftVersion.WILD_UPDATE.atOrAbove()) {
|
if (MinecraftVersion.WILD_UPDATE.atOrAbove()) {
|
||||||
// 1.19 and above
|
// 1.19 and above
|
||||||
handle.getWorldKeys().write(0, value);
|
handle.getWorldKeys().write(0, value);
|
||||||
return;
|
} else if (MinecraftVersion.CAVES_CLIFFS_2.atOrAbove()) {
|
||||||
|
// 1.18
|
||||||
|
handle.getHolders(
|
||||||
|
MinecraftReflection.getDimensionManager(),
|
||||||
|
BukkitConverters.getDimensionConverter()
|
||||||
|
).write(0, value);
|
||||||
|
} else {
|
||||||
|
// 1.17 and below (untested)
|
||||||
|
handle.getDimensions().write(0, value.getEnvironment().ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
handle.getDimensionTypes().write(0, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//.............
|
//.............
|
||||||
|
@ -89,13 +97,12 @@ public class WrapperPlayServerRespawn extends AbstractPacket {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCopyMetadata(boolean value) {
|
public void setCopyMetadata(boolean value) {
|
||||||
handle.getBytes().write(0, ((byte) (value ? 1 : 0)));
|
handle.getBytes().write(0, ((byte) (value ? 0x01 : 0x00)));
|
||||||
}
|
}
|
||||||
|
|
||||||
//.............
|
//.............
|
||||||
// Last death location Field
|
// Last death location Field
|
||||||
// Added in 1.19.
|
// Added in 1.19.
|
||||||
// (useless?)
|
|
||||||
//.............
|
//.............
|
||||||
|
|
||||||
public Optional<BlockPosition> getLastDeathLocation() {
|
public Optional<BlockPosition> getLastDeathLocation() {
|
||||||
|
@ -127,7 +134,7 @@ public class WrapperPlayServerRespawn extends AbstractPacket {
|
||||||
|
|
||||||
public void setSeed(long value) {
|
public void setSeed(long value) {
|
||||||
if (MinecraftVersion.BEE_UPDATE.atOrAbove()) {
|
if (MinecraftVersion.BEE_UPDATE.atOrAbove()) {
|
||||||
handle.getLongs().write(0, value);
|
handle.getLongs().write(0, Hashing.sha256().hashLong(value).asLong());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue