forked from BLOCKFANTASY/LOOHP-Limbo
Bump development to 1.17, Added a few more light emitting blocks, Improved PlayerChatEvent formatting
This commit is contained in:
parent
c6ac7b3593
commit
edbc668fa2
4
pom.xml
4
pom.xml
|
|
@ -5,7 +5,7 @@
|
|||
<groupId>com.loohp</groupId>
|
||||
<artifactId>Limbo</artifactId>
|
||||
<name>Limbo</name>
|
||||
<version>0.4.5-ALPHA</version>
|
||||
<version>0.5.0-ALPHA</version>
|
||||
|
||||
<description>Standalone Limbo Minecraft Server.</description>
|
||||
<url>https://github.com/LOOHP/Limbo</url>
|
||||
|
|
@ -87,7 +87,7 @@
|
|||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>${project.artifactId}-${project.version}-1.16.5</finalName>
|
||||
<finalName>${project.artifactId}-${project.version}-1.17</finalName>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
|
|
|
|||
|
|
@ -108,8 +108,8 @@ public class Limbo {
|
|||
|
||||
//===========================
|
||||
|
||||
public final String serverImplementationVersion = "1.16.5";
|
||||
public final int serverImplmentationProtocol = 754;
|
||||
public final String serverImplementationVersion = "1.17";
|
||||
public final int serverImplmentationProtocol = 755;
|
||||
public final String limboImplementationVersion;
|
||||
|
||||
private AtomicBoolean isRunning;
|
||||
|
|
|
|||
|
|
@ -11,25 +11,25 @@ import com.loohp.limbo.world.World;
|
|||
|
||||
public class ArmorStand extends LivingEntity {
|
||||
|
||||
@WatchableField(MetadataIndex = 14, WatchableObjectType = WatchableObjectType.BYTE, IsBitmask = true, Bitmask = 0x01)
|
||||
@WatchableField(MetadataIndex = 15, WatchableObjectType = WatchableObjectType.BYTE, IsBitmask = true, Bitmask = 0x01)
|
||||
protected boolean small = false;
|
||||
@WatchableField(MetadataIndex = 14, WatchableObjectType = WatchableObjectType.BYTE, IsBitmask = true, Bitmask = 0x04)
|
||||
@WatchableField(MetadataIndex = 15, WatchableObjectType = WatchableObjectType.BYTE, IsBitmask = true, Bitmask = 0x04)
|
||||
protected boolean arms = false;
|
||||
@WatchableField(MetadataIndex = 14, WatchableObjectType = WatchableObjectType.BYTE, IsBitmask = true, Bitmask = 0x08)
|
||||
@WatchableField(MetadataIndex = 15, WatchableObjectType = WatchableObjectType.BYTE, IsBitmask = true, Bitmask = 0x08)
|
||||
protected boolean noBasePlate = false;
|
||||
@WatchableField(MetadataIndex = 14, WatchableObjectType = WatchableObjectType.BYTE, IsBitmask = true, Bitmask = 0x10)
|
||||
@WatchableField(MetadataIndex = 15, WatchableObjectType = WatchableObjectType.BYTE, IsBitmask = true, Bitmask = 0x10)
|
||||
protected boolean marker = false;
|
||||
@WatchableField(MetadataIndex = 15, WatchableObjectType = WatchableObjectType.ROTATION)
|
||||
protected Rotation3f headRotation = new Rotation3f(0.0, 0.0, 0.0);
|
||||
@WatchableField(MetadataIndex = 16, WatchableObjectType = WatchableObjectType.ROTATION)
|
||||
protected Rotation3f bodyRotation = new Rotation3f(0.0, 0.0, 0.0);
|
||||
protected Rotation3f headRotation = new Rotation3f(0.0, 0.0, 0.0);
|
||||
@WatchableField(MetadataIndex = 17, WatchableObjectType = WatchableObjectType.ROTATION)
|
||||
protected Rotation3f leftArmRotation = new Rotation3f(-10.0, 0.0, -10.0);
|
||||
protected Rotation3f bodyRotation = new Rotation3f(0.0, 0.0, 0.0);
|
||||
@WatchableField(MetadataIndex = 18, WatchableObjectType = WatchableObjectType.ROTATION)
|
||||
protected Rotation3f rightArmRotation = new Rotation3f(-15.0, 0.0, 10.0);
|
||||
protected Rotation3f leftArmRotation = new Rotation3f(-10.0, 0.0, -10.0);
|
||||
@WatchableField(MetadataIndex = 19, WatchableObjectType = WatchableObjectType.ROTATION)
|
||||
protected Rotation3f leftLegRotation = new Rotation3f(-1.0, 0.0, -1.0);
|
||||
protected Rotation3f rightArmRotation = new Rotation3f(-15.0, 0.0, 10.0);
|
||||
@WatchableField(MetadataIndex = 20, WatchableObjectType = WatchableObjectType.ROTATION)
|
||||
protected Rotation3f leftLegRotation = new Rotation3f(-1.0, 0.0, -1.0);
|
||||
@WatchableField(MetadataIndex = 21, WatchableObjectType = WatchableObjectType.ROTATION)
|
||||
protected Rotation3f rightLegRotation = new Rotation3f(1.0, 0.0, 1.0);
|
||||
|
||||
public ArmorStand(int entityId, UUID uuid, World world, double x, double y, double z, float yaw, float pitch) {
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@ public abstract class Entity {
|
|||
protected boolean noGravity = false;
|
||||
@WatchableField(MetadataIndex = 6, WatchableObjectType = WatchableObjectType.POSE)
|
||||
protected Pose pose = Pose.STANDING;
|
||||
@WatchableField(MetadataIndex = 7, WatchableObjectType = WatchableObjectType.VARINT)
|
||||
protected int frozenTicks = 0;
|
||||
|
||||
protected final EntityType type;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,23 +12,23 @@ import com.loohp.limbo.world.World;
|
|||
|
||||
public abstract class LivingEntity extends Entity {
|
||||
|
||||
@WatchableField(MetadataIndex = 7, WatchableObjectType = WatchableObjectType.BYTE, IsBitmask = true, Bitmask = 0x01)
|
||||
@WatchableField(MetadataIndex = 8, WatchableObjectType = WatchableObjectType.BYTE, IsBitmask = true, Bitmask = 0x01)
|
||||
protected boolean handActive = false;
|
||||
@WatchableField(MetadataIndex = 7, WatchableObjectType = WatchableObjectType.BYTE, IsBitmask = true, Bitmask = 0x02)
|
||||
@WatchableField(MetadataIndex = 8, WatchableObjectType = WatchableObjectType.BYTE, IsBitmask = true, Bitmask = 0x02)
|
||||
protected boolean activeHand = false; //false = main hand, true = off hand
|
||||
@WatchableField(MetadataIndex = 7, WatchableObjectType = WatchableObjectType.BYTE, IsBitmask = true, Bitmask = 0x04)
|
||||
@WatchableField(MetadataIndex = 8, WatchableObjectType = WatchableObjectType.BYTE, IsBitmask = true, Bitmask = 0x04)
|
||||
protected boolean inRiptideSpinAttack = false;
|
||||
@WatchableField(MetadataIndex = 8, WatchableObjectType = WatchableObjectType.FLOAT)
|
||||
@WatchableField(MetadataIndex = 9, WatchableObjectType = WatchableObjectType.FLOAT)
|
||||
protected float health = 1.0F;
|
||||
@WatchableField(MetadataIndex = 9, WatchableObjectType = WatchableObjectType.VARINT)
|
||||
@WatchableField(MetadataIndex = 10, WatchableObjectType = WatchableObjectType.VARINT)
|
||||
protected int potionEffectColor = 0;
|
||||
@WatchableField(MetadataIndex = 10, WatchableObjectType = WatchableObjectType.BOOLEAN)
|
||||
@WatchableField(MetadataIndex = 11, WatchableObjectType = WatchableObjectType.BOOLEAN)
|
||||
protected boolean potionEffectAmbient = false;
|
||||
@WatchableField(MetadataIndex = 11, WatchableObjectType = WatchableObjectType.VARINT)
|
||||
protected int arrowsInEntity = 0;
|
||||
@WatchableField(MetadataIndex = 12, WatchableObjectType = WatchableObjectType.VARINT)
|
||||
protected int arrowsInEntity = 0;
|
||||
@WatchableField(MetadataIndex = 13, WatchableObjectType = WatchableObjectType.VARINT)
|
||||
protected int absorption = 0;
|
||||
@WatchableField(MetadataIndex = 13, WatchableObjectType = WatchableObjectType.POSITION, IsOptional = true)
|
||||
@WatchableField(MetadataIndex = 14, WatchableObjectType = WatchableObjectType.POSITION, IsOptional = true)
|
||||
protected BlockPosition sleepingLocation = null;
|
||||
|
||||
public LivingEntity(EntityType type, int entityId, UUID uuid, World world, double x, double y, double z, float yaw, float pitch) {
|
||||
|
|
|
|||
|
|
@ -5,23 +5,23 @@ import com.loohp.limbo.player.Player;
|
|||
|
||||
public class PlayerChatEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
private String prefix;
|
||||
private String format;
|
||||
private String message;
|
||||
private boolean cancelled;
|
||||
|
||||
public PlayerChatEvent(Player player, String prefix, String message, boolean cancelled) {
|
||||
public PlayerChatEvent(Player player, String format, String message, boolean cancelled) {
|
||||
super(player);
|
||||
this.prefix = prefix;
|
||||
this.format = format;
|
||||
this.message = message;
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
public String getPrefix() {
|
||||
return prefix;
|
||||
public String getFormat() {
|
||||
return format;
|
||||
}
|
||||
|
||||
public void setPrefix(String prefix) {
|
||||
this.prefix = prefix;
|
||||
public void setFormat(String format) {
|
||||
this.format = format;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
|
|
|
|||
|
|
@ -35,17 +35,17 @@ public class Player extends LivingEntity implements CommandSender {
|
|||
protected DataWatcher watcher;
|
||||
protected byte selectedSlot;
|
||||
|
||||
@WatchableField(MetadataIndex = 14, WatchableObjectType = WatchableObjectType.FLOAT)
|
||||
@WatchableField(MetadataIndex = 15, WatchableObjectType = WatchableObjectType.FLOAT)
|
||||
protected float additionalHearts = 0.0F;
|
||||
@WatchableField(MetadataIndex = 15, WatchableObjectType = WatchableObjectType.VARINT)
|
||||
@WatchableField(MetadataIndex = 16, WatchableObjectType = WatchableObjectType.VARINT)
|
||||
protected int score = 0;
|
||||
@WatchableField(MetadataIndex = 16, WatchableObjectType = WatchableObjectType.BYTE)
|
||||
protected byte skinLayers = 0;
|
||||
@WatchableField(MetadataIndex = 17, WatchableObjectType = WatchableObjectType.BYTE)
|
||||
protected byte skinLayers = 0;
|
||||
@WatchableField(MetadataIndex = 18, WatchableObjectType = WatchableObjectType.BYTE)
|
||||
protected byte mainHand = 1;
|
||||
//@WatchableField(MetadataIndex = 18, WatchableObjectType = WatchableObjectType.NBT)
|
||||
//protected Entity leftShoulder = null;
|
||||
//@WatchableField(MetadataIndex = 19, WatchableObjectType = WatchableObjectType.NBT)
|
||||
//protected Entity leftShoulder = null;
|
||||
//@WatchableField(MetadataIndex = 20, WatchableObjectType = WatchableObjectType.NBT)
|
||||
//protected Entity rightShoulder = null;
|
||||
|
||||
public Player(ClientConnection clientConnection, String username, UUID uuid, int entityId, Location location, PlayerInteractManager playerInteractManager) throws IllegalArgumentException, IllegalAccessException {
|
||||
|
|
@ -182,7 +182,7 @@ public class Player extends LivingEntity implements CommandSender {
|
|||
PacketPlayOutRespawn respawn = new PacketPlayOutRespawn(location.getWorld(), Limbo.getInstance().getDimensionRegistry().getCodec(), 0, gamemode, false, false, true);
|
||||
clientConnection.sendPacket(respawn);
|
||||
}
|
||||
PacketPlayOutPositionAndLook positionLook = new PacketPlayOutPositionAndLook(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch(), 1);
|
||||
PacketPlayOutPositionAndLook positionLook = new PacketPlayOutPositionAndLook(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch(), 1, false);
|
||||
clientConnection.sendPacket(positionLook);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
|
@ -247,10 +247,10 @@ public class Player extends LivingEntity implements CommandSender {
|
|||
}
|
||||
|
||||
public void chat(String message) {
|
||||
String prefix = "<" + username + "> ";
|
||||
PlayerChatEvent event = (PlayerChatEvent) Limbo.getInstance().getEventsManager().callEvent(new PlayerChatEvent(this, prefix, message, false));
|
||||
String format = "<%name%> %message%";
|
||||
PlayerChatEvent event = (PlayerChatEvent) Limbo.getInstance().getEventsManager().callEvent(new PlayerChatEvent(this, format, message, false));
|
||||
if (!event.isCancelled()) {
|
||||
String chat = event.getPrefix() + event.getMessage();
|
||||
String chat = event.getFormat().replace("%name%", username).replace("%message%", event.getMessage());
|
||||
Limbo.getInstance().getConsole().sendMessage(chat);
|
||||
for (Player each : Limbo.getInstance().getPlayers()) {
|
||||
each.sendMessage(chat, uuid);
|
||||
|
|
|
|||
|
|
@ -77,8 +77,10 @@ public class PlayerInteractManager {
|
|||
ids.add(entity.getEntityId());
|
||||
}
|
||||
}
|
||||
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(ids.stream().mapToInt(each -> each).toArray());
|
||||
for (int id : ids) {
|
||||
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(id);
|
||||
player.clientConnection.sendPacket(packet);
|
||||
}
|
||||
|
||||
entities = entitiesInRange;
|
||||
|
||||
|
|
|
|||
|
|
@ -311,8 +311,6 @@ public class ClientConnection extends Thread {
|
|||
sendPacket(join);
|
||||
Limbo.getInstance().getUnsafe().setPlayerGameModeSilently(player, properties.getDefaultGamemode());
|
||||
|
||||
player.playerInteractManager.update();
|
||||
|
||||
SkinResponse skinresponce = isBungeecord && bungeeSkin != null ? bungeeSkin : MojangAPIUtils.getSkinFromMojangServer(player.getName());
|
||||
PlayerSkinProperty skin = skinresponce != null ? new PlayerSkinProperty(skinresponce.getSkin(), skinresponce.getSignature()) : null;
|
||||
PacketPlayOutPlayerInfo info = new PacketPlayOutPlayerInfo(PlayerInfoAction.ADD_PLAYER, player.getUniqueId(), new PlayerInfoData.PlayerInfoDataAddPlayer(player.getName(), Optional.ofNullable(skin), properties.getDefaultGamemode(), 0, false, Optional.empty()));
|
||||
|
|
@ -336,10 +334,12 @@ public class ClientConnection extends Thread {
|
|||
sendPacket(declare);
|
||||
}
|
||||
|
||||
PacketPlayOutSpawnPosition spawnPos = new PacketPlayOutSpawnPosition(BlockPosition.from(worldSpawn));
|
||||
player.playerInteractManager.update();
|
||||
|
||||
PacketPlayOutSpawnPosition spawnPos = new PacketPlayOutSpawnPosition(BlockPosition.from(worldSpawn), worldSpawn.getPitch());
|
||||
sendPacket(spawnPos);
|
||||
|
||||
PacketPlayOutPositionAndLook positionLook = new PacketPlayOutPositionAndLook(worldSpawn.getX(), worldSpawn.getY(), worldSpawn.getZ(), worldSpawn.getYaw(), worldSpawn.getPitch(), 1);
|
||||
PacketPlayOutPositionAndLook positionLook = new PacketPlayOutPositionAndLook(worldSpawn.getX(), worldSpawn.getY(), worldSpawn.getZ(), worldSpawn.getYaw(), worldSpawn.getPitch(), 1, false);
|
||||
Limbo.getInstance().getUnsafe().setPlayerLocationSilently(player, new Location(world, worldSpawn.getX(), worldSpawn.getY(), worldSpawn.getZ(), worldSpawn.getYaw(), worldSpawn.getPitch()));
|
||||
sendPacket(positionLook);
|
||||
|
||||
|
|
@ -359,14 +359,14 @@ public class ClientConnection extends Thread {
|
|||
Location originalTo = event.getTo().clone();
|
||||
if (event.isCancelled()) {
|
||||
Location returnTo = event.getFrom();
|
||||
PacketPlayOutPositionAndLook cancel = new PacketPlayOutPositionAndLook(returnTo.getX(), returnTo.getY(), returnTo.getZ(), returnTo.getYaw(), returnTo.getPitch(), 1);
|
||||
PacketPlayOutPositionAndLook cancel = new PacketPlayOutPositionAndLook(returnTo.getX(), returnTo.getY(), returnTo.getZ(), returnTo.getYaw(), returnTo.getPitch(), 1, false);
|
||||
sendPacket(cancel);
|
||||
} else {
|
||||
Location to = event.getTo();
|
||||
Limbo.getInstance().getUnsafe().setPlayerLocationSilently(player, to);
|
||||
// If an event handler used setTo, let's make sure we tell the player about it.
|
||||
if (!originalTo.equals(to)) {
|
||||
PacketPlayOutPositionAndLook pos = new PacketPlayOutPositionAndLook(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch(), 1);
|
||||
PacketPlayOutPositionAndLook pos = new PacketPlayOutPositionAndLook(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch(), 1, false);
|
||||
sendPacket(pos);
|
||||
}
|
||||
PacketPlayOutUpdateViewPosition response = new PacketPlayOutUpdateViewPosition((int) player.getLocation().getX() >> 4, (int) player.getLocation().getZ() >> 4);
|
||||
|
|
|
|||
|
|
@ -8,14 +8,14 @@ import com.loohp.limbo.utils.DataTypeIO;
|
|||
|
||||
public class PacketPlayOutEntityDestroy extends PacketOut {
|
||||
|
||||
private int[] entityIds;
|
||||
private int entityId;
|
||||
|
||||
public PacketPlayOutEntityDestroy(int... entityIds) {
|
||||
this.entityIds = entityIds;
|
||||
public PacketPlayOutEntityDestroy(int entityId) {
|
||||
this.entityId = entityId;
|
||||
}
|
||||
|
||||
public int[] getEntityIds() {
|
||||
return entityIds;
|
||||
public int getEntityId() {
|
||||
return entityId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -24,10 +24,7 @@ public class PacketPlayOutEntityDestroy extends PacketOut {
|
|||
|
||||
DataOutputStream output = new DataOutputStream(buffer);
|
||||
output.writeByte(Packet.getPlayOut().get(getClass()));
|
||||
DataTypeIO.writeVarInt(output, entityIds.length);
|
||||
for (int id : entityIds) {
|
||||
DataTypeIO.writeVarInt(output, id);
|
||||
}
|
||||
DataTypeIO.writeVarInt(output, entityId);
|
||||
|
||||
return buffer.toByteArray();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.loohp.limbo.server.packets;
|
|||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.BitSet;
|
||||
import java.util.List;
|
||||
|
||||
import com.loohp.limbo.utils.DataTypeIO;
|
||||
|
|
@ -12,8 +13,10 @@ public class PacketPlayOutLightUpdate extends PacketOut {
|
|||
private int chunkX;
|
||||
private int chunkZ;
|
||||
private boolean trustEdges;
|
||||
private int skyLightBitMask;
|
||||
private int blockLightBitMask;
|
||||
private long[] skyLightBitMasks;
|
||||
private long[] blockLightBitMasks;
|
||||
private long[] skyLightBitMasksEmpty;
|
||||
private long[] blockLightBitMasksEmpty;
|
||||
private List<Byte[]> skylightArrays;
|
||||
private List<Byte[]> blocklightArrays;
|
||||
|
||||
|
|
@ -24,21 +27,23 @@ public class PacketPlayOutLightUpdate extends PacketOut {
|
|||
this.skylightArrays = skylightArrays;
|
||||
this.blocklightArrays = blocklightArrays;
|
||||
|
||||
skyLightBitMask = 0;
|
||||
BitSet skyLightBitSet = new BitSet();
|
||||
BitSet skyLightBitSetInverse = new BitSet();
|
||||
for (int i = Math.min(17, skylightArrays.size() - 1); i >= 0; i--) {
|
||||
skyLightBitMask = skyLightBitMask >> 1;
|
||||
if (skylightArrays.get(i) != null) {
|
||||
skyLightBitMask |= 131072;
|
||||
}
|
||||
skyLightBitSet.set(i, skylightArrays.get(i) != null);
|
||||
skyLightBitSetInverse.set(i, skylightArrays.get(i) == null);
|
||||
}
|
||||
skyLightBitMasks = skyLightBitSet.toLongArray();
|
||||
skyLightBitMasksEmpty = skyLightBitSetInverse.toLongArray();
|
||||
|
||||
blockLightBitMask = 0;
|
||||
BitSet blockLightBitSet = new BitSet();
|
||||
BitSet blockLightBitSetInverse = new BitSet();
|
||||
for (int i = Math.min(17, blocklightArrays.size() - 1); i >= 0; i--) {
|
||||
blockLightBitMask = blockLightBitMask >> 1;
|
||||
if (blocklightArrays.get(i) != null) {
|
||||
blockLightBitMask |= 131072;
|
||||
}
|
||||
blockLightBitSet.set(i, blocklightArrays.get(i) != null);
|
||||
blockLightBitSetInverse.set(i, blocklightArrays.get(i) == null);
|
||||
}
|
||||
blockLightBitMasks = blockLightBitSet.toLongArray();
|
||||
blockLightBitMasksEmpty = blockLightBitSetInverse.toLongArray();
|
||||
}
|
||||
|
||||
public int getChunkX() {
|
||||
|
|
@ -53,12 +58,12 @@ public class PacketPlayOutLightUpdate extends PacketOut {
|
|||
return trustEdges;
|
||||
}
|
||||
|
||||
public int getSkyLightBitMask() {
|
||||
return skyLightBitMask;
|
||||
public long[] getSkyLightBitMasks() {
|
||||
return skyLightBitMasks;
|
||||
}
|
||||
|
||||
public int getBlockLightBitMask() {
|
||||
return blockLightBitMask;
|
||||
public long[] getBlockLightBitMasks() {
|
||||
return blockLightBitMasks;
|
||||
}
|
||||
|
||||
public List<Byte[]> getSkylightArrays() {
|
||||
|
|
@ -78,11 +83,24 @@ public class PacketPlayOutLightUpdate extends PacketOut {
|
|||
DataTypeIO.writeVarInt(output, chunkX);
|
||||
DataTypeIO.writeVarInt(output, chunkZ);
|
||||
output.writeBoolean(trustEdges);
|
||||
DataTypeIO.writeVarInt(output, skyLightBitMask);
|
||||
DataTypeIO.writeVarInt(output, blockLightBitMask);
|
||||
DataTypeIO.writeVarInt(output, ~skyLightBitMask & 262143);
|
||||
DataTypeIO.writeVarInt(output, ~blockLightBitMask & 262143);
|
||||
DataTypeIO.writeVarInt(output, skyLightBitMasks.length);
|
||||
for (long l : skyLightBitMasks) {
|
||||
output.writeLong(l);
|
||||
}
|
||||
DataTypeIO.writeVarInt(output, blockLightBitMasks.length);
|
||||
for (long l : blockLightBitMasks) {
|
||||
output.writeLong(l);
|
||||
}
|
||||
DataTypeIO.writeVarInt(output, skyLightBitMasksEmpty.length);
|
||||
for (long l : skyLightBitMasksEmpty) {
|
||||
output.writeLong(l);
|
||||
}
|
||||
DataTypeIO.writeVarInt(output, blockLightBitMasksEmpty.length);
|
||||
for (long l : blockLightBitMasksEmpty) {
|
||||
output.writeLong(l);
|
||||
}
|
||||
|
||||
DataTypeIO.writeVarInt(output, skylightArrays.stream().mapToInt(each -> each == null ? 0 : 1).sum());
|
||||
for (int i = skylightArrays.size() - 1; i >= 0; i--) {
|
||||
Byte[] array = skylightArrays.get(i);
|
||||
if (array != null) {
|
||||
|
|
@ -94,6 +112,7 @@ public class PacketPlayOutLightUpdate extends PacketOut {
|
|||
}
|
||||
}
|
||||
|
||||
DataTypeIO.writeVarInt(output, blocklightArrays.stream().mapToInt(each -> each == null ? 0 : 1).sum());
|
||||
for (int i = blocklightArrays.size() - 1; i >= 0; i--) {
|
||||
Byte[] array = blocklightArrays.get(i);
|
||||
if (array != null) {
|
||||
|
|
|
|||
|
|
@ -31,10 +31,7 @@ public class PacketPlayOutLogin extends PacketOut {
|
|||
private boolean isDebug;
|
||||
private boolean isFlat;
|
||||
|
||||
public PacketPlayOutLogin(int entityId, boolean isHardcore, GameMode gamemode,
|
||||
String[] worldsNames, CompoundTag dimensionCodec, World world, long hashedSeed,
|
||||
byte maxPlayers, int viewDistance, boolean reducedDebugInfo, boolean enableRespawnScreen, boolean isDebug,
|
||||
boolean isFlat) {
|
||||
public PacketPlayOutLogin(int entityId, boolean isHardcore, GameMode gamemode, String[] worldsNames, CompoundTag dimensionCodec, World world, long hashedSeed, byte maxPlayers, int viewDistance, boolean reducedDebugInfo, boolean enableRespawnScreen, boolean isDebug, boolean isFlat) {
|
||||
this.entityId = entityId;
|
||||
this.isHardcore = isHardcore;
|
||||
this.gamemode = gamemode;
|
||||
|
|
@ -130,7 +127,7 @@ public class PacketPlayOutLogin extends PacketOut {
|
|||
break;
|
||||
}
|
||||
}
|
||||
DataTypeIO.writeCompoundTag(output, tag != null ? tag : list.get(0));
|
||||
DataTypeIO.writeCompoundTag(output, tag != null ? tag : list.get(0).getCompoundTag("element"));
|
||||
DataTypeIO.writeString(output, worldName, StandardCharsets.UTF_8);
|
||||
output.writeLong(hashedSeed);
|
||||
DataTypeIO.writeVarInt(output, maxPlayers);
|
||||
|
|
|
|||
|
|
@ -63,15 +63,16 @@ public class PacketPlayOutMapChunk extends PacketOut {
|
|||
|
||||
output.writeInt(chunkX);
|
||||
output.writeInt(chunkZ);
|
||||
output.writeBoolean(true);
|
||||
int bitmask = 0;
|
||||
BitSet chunkPresent = new BitSet();
|
||||
for (int i = 0; i < 16; i++) {
|
||||
Section section = chunk.getSection(i);
|
||||
if (section != null) {
|
||||
bitmask = bitmask | (int) Math.pow(2, i);
|
||||
chunkPresent.set(i, section != null);
|
||||
}
|
||||
long[] bitmasks = chunkPresent.toLongArray();
|
||||
DataTypeIO.writeVarInt(output, bitmasks.length);
|
||||
for (long l : bitmasks) {
|
||||
output.writeLong(l);
|
||||
}
|
||||
DataTypeIO.writeVarInt(output, bitmask);
|
||||
DataTypeIO.writeCompoundTag(output, chunk.getHeightMaps());
|
||||
|
||||
DataTypeIO.writeVarInt(output, 1024);
|
||||
|
|
|
|||
|
|
@ -36,8 +36,9 @@ public class PacketPlayOutPositionAndLook extends PacketOut {
|
|||
private float pitch;
|
||||
private Set<PlayerTeleportFlags> flags;
|
||||
private int teleportId;
|
||||
private boolean dismountVehicle;
|
||||
|
||||
public PacketPlayOutPositionAndLook(double x, double y, double z, float yaw, float pitch, int teleportId, PlayerTeleportFlags... flags) {
|
||||
public PacketPlayOutPositionAndLook(double x, double y, double z, float yaw, float pitch, int teleportId, boolean dismountVehicle, PlayerTeleportFlags... flags) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
|
|
@ -45,6 +46,7 @@ public class PacketPlayOutPositionAndLook extends PacketOut {
|
|||
this.pitch = pitch;
|
||||
this.teleportId = teleportId;
|
||||
this.flags = Arrays.asList(flags).stream().collect(Collectors.toSet());
|
||||
this.dismountVehicle = dismountVehicle;
|
||||
}
|
||||
|
||||
public double getX() {
|
||||
|
|
@ -75,6 +77,10 @@ public class PacketPlayOutPositionAndLook extends PacketOut {
|
|||
return teleportId;
|
||||
}
|
||||
|
||||
public boolean isDismountVehicle() {
|
||||
return dismountVehicle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] serializePacket() throws IOException {
|
||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||
|
|
@ -94,6 +100,7 @@ public class PacketPlayOutPositionAndLook extends PacketOut {
|
|||
|
||||
output.writeByte(flag);
|
||||
DataTypeIO.writeVarInt(output, teleportId);
|
||||
output.writeBoolean(dismountVehicle);
|
||||
|
||||
return buffer.toByteArray();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,21 +10,28 @@ import com.loohp.limbo.world.BlockPosition;
|
|||
public class PacketPlayOutSpawnPosition extends PacketOut {
|
||||
|
||||
private BlockPosition position;
|
||||
private float angle;
|
||||
|
||||
public PacketPlayOutSpawnPosition(BlockPosition position) {
|
||||
public PacketPlayOutSpawnPosition(BlockPosition position, float angle) {
|
||||
this.position = position;
|
||||
this.angle = angle;
|
||||
}
|
||||
|
||||
public BlockPosition getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
public float getAngle() {
|
||||
return angle;
|
||||
}
|
||||
|
||||
public byte[] serializePacket() throws IOException {
|
||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||
|
||||
DataOutputStream output = new DataOutputStream(buffer);
|
||||
output.writeByte(Packet.getPlayOut().get(getClass()));
|
||||
DataTypeIO.writeBlockPosition(output, position);
|
||||
output.writeFloat(angle);
|
||||
|
||||
return buffer.toByteArray();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,15 +10,15 @@ public abstract class LightEngine {
|
|||
static {
|
||||
blockLightLevelMapping.put("minecraft:beacon", (byte) 15);
|
||||
blockLightLevelMapping.put("minecraft:torch", (byte) 15);
|
||||
blockLightLevelMapping.put("minecraft:beacon", (byte) 15);
|
||||
blockLightLevelMapping.put("minecraft:beacon", (byte) 15);
|
||||
blockLightLevelMapping.put("minecraft:beacon", (byte) 15);
|
||||
blockLightLevelMapping.put("minecraft:beacon", (byte) 15);
|
||||
blockLightLevelMapping.put("minecraft:beacon", (byte) 15);
|
||||
blockLightLevelMapping.put("minecraft:beacon", (byte) 15);
|
||||
blockLightLevelMapping.put("minecraft:beacon", (byte) 15);
|
||||
blockLightLevelMapping.put("minecraft:beacon", (byte) 15);
|
||||
blockLightLevelMapping.put("minecraft:beacon", (byte) 15);
|
||||
blockLightLevelMapping.put("minecraft:sea_lantern", (byte) 15);
|
||||
blockLightLevelMapping.put("minecraft:end_rod", (byte) 15);
|
||||
blockLightLevelMapping.put("minecraft:fire", (byte) 15);
|
||||
blockLightLevelMapping.put("minecraft:lava", (byte) 15);
|
||||
blockLightLevelMapping.put("minecraft:lantern", (byte) 15);
|
||||
blockLightLevelMapping.put("minecraft:soul_lantern", (byte) 10);
|
||||
blockLightLevelMapping.put("minecraft:glowstone", (byte) 15);
|
||||
blockLightLevelMapping.put("minecraft:campfire", (byte) 15);
|
||||
blockLightLevelMapping.put("minecraft:soul_campfire", (byte) 10);
|
||||
blockLightLevelMapping.put("minecraft:beacon", (byte) 15);
|
||||
blockLightLevelMapping.put("minecraft:beacon", (byte) 15);
|
||||
blockLightLevelMapping.put("minecraft:beacon", (byte) 15);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -69,13 +69,21 @@
|
|||
"type": "DoubleTag",
|
||||
"value": 1
|
||||
},
|
||||
"ultrawarm": {
|
||||
"type": "ByteTag",
|
||||
"min_y": {
|
||||
"type": "IntTag",
|
||||
"value": 0
|
||||
},
|
||||
"has_ceiling": {
|
||||
"type": "ByteTag",
|
||||
"value": 0
|
||||
},
|
||||
"ultrawarm": {
|
||||
"type": "ByteTag",
|
||||
"value": 0
|
||||
},
|
||||
"height": {
|
||||
"type": "IntTag",
|
||||
"value": 256
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -136,13 +144,21 @@
|
|||
"type": "DoubleTag",
|
||||
"value": 1
|
||||
},
|
||||
"ultrawarm": {
|
||||
"type": "ByteTag",
|
||||
"min_y": {
|
||||
"type": "IntTag",
|
||||
"value": 0
|
||||
},
|
||||
"has_ceiling": {
|
||||
"type": "ByteTag",
|
||||
"value": 1
|
||||
},
|
||||
"ultrawarm": {
|
||||
"type": "ByteTag",
|
||||
"value": 0
|
||||
},
|
||||
"height": {
|
||||
"type": "IntTag",
|
||||
"value": 256
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -207,13 +223,21 @@
|
|||
"type": "DoubleTag",
|
||||
"value": 8
|
||||
},
|
||||
"ultrawarm": {
|
||||
"type": "ByteTag",
|
||||
"value": 1
|
||||
"min_y": {
|
||||
"type": "IntTag",
|
||||
"value": 0
|
||||
},
|
||||
"has_ceiling": {
|
||||
"type": "ByteTag",
|
||||
"value": 1
|
||||
},
|
||||
"ultrawarm": {
|
||||
"type": "ByteTag",
|
||||
"value": 1
|
||||
},
|
||||
"height": {
|
||||
"type": "IntTag",
|
||||
"value": 256
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -278,13 +302,21 @@
|
|||
"type": "DoubleTag",
|
||||
"value": 1
|
||||
},
|
||||
"ultrawarm": {
|
||||
"type": "ByteTag",
|
||||
"min_y": {
|
||||
"type": "IntTag",
|
||||
"value": 0
|
||||
},
|
||||
"has_ceiling": {
|
||||
"type": "ByteTag",
|
||||
"value": 0
|
||||
},
|
||||
"ultrawarm": {
|
||||
"type": "ByteTag",
|
||||
"value": 0
|
||||
},
|
||||
"height": {
|
||||
"type": "IntTag",
|
||||
"value": 256
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -7046,6 +7078,147 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"type": "StringTag",
|
||||
"value": "minecraft:dripstone_caves"
|
||||
},
|
||||
"id": {
|
||||
"type": "IntTag",
|
||||
"value": 174
|
||||
},
|
||||
"element": {
|
||||
"type": "CompoundTag",
|
||||
"value": {
|
||||
"precipitation": {
|
||||
"type": "StringTag",
|
||||
"value": "rain"
|
||||
},
|
||||
"effects": {
|
||||
"type": "CompoundTag",
|
||||
"value": {
|
||||
"water_fog_color": {
|
||||
"type": "IntTag",
|
||||
"value": 329011
|
||||
},
|
||||
"sky_color": {
|
||||
"type": "IntTag",
|
||||
"value": 7907327
|
||||
},
|
||||
"fog_color": {
|
||||
"type": "IntTag",
|
||||
"value": 12638463
|
||||
},
|
||||
"water_color": {
|
||||
"type": "IntTag",
|
||||
"value": 4159204
|
||||
},
|
||||
"mood_sound": {
|
||||
"type": "CompoundTag",
|
||||
"value": {
|
||||
"tick_delay": {
|
||||
"type": "IntTag",
|
||||
"value": 6000
|
||||
},
|
||||
"offset": {
|
||||
"type": "DoubleTag",
|
||||
"value": 2
|
||||
},
|
||||
"block_search_extent": {
|
||||
"type": "IntTag",
|
||||
"value": 8
|
||||
},
|
||||
"sound": {
|
||||
"type": "StringTag",
|
||||
"value": "minecraft:ambient.cave"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"depth": {
|
||||
"type": "FloatTag",
|
||||
"value": 0.125
|
||||
},
|
||||
"temperature": {
|
||||
"type": "FloatTag",
|
||||
"value": 0.8
|
||||
},
|
||||
"scale": {
|
||||
"type": "FloatTag",
|
||||
"value": 0.05
|
||||
},
|
||||
"downfall": {
|
||||
"type": "FloatTag",
|
||||
"value": 0.4
|
||||
},
|
||||
"category": {
|
||||
"type": "StringTag",
|
||||
"value": "underground"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": {
|
||||
"type": "StringTag",
|
||||
"value": "minecraft:lush_caves"
|
||||
},
|
||||
"id": {
|
||||
"type": "IntTag",
|
||||
"value": 175
|
||||
},
|
||||
"element": {
|
||||
"type": "CompoundTag",
|
||||
"value": {
|
||||
"precipitation": {
|
||||
"type": "StringTag",
|
||||
"value": "rain"
|
||||
},
|
||||
"effects": {
|
||||
"type": "CompoundTag",
|
||||
"value": {
|
||||
"water_fog_color": {
|
||||
"type": "IntTag",
|
||||
"value": 329011
|
||||
},
|
||||
"sky_color": {
|
||||
"type": "IntTag",
|
||||
"value": 8103167
|
||||
},
|
||||
"fog_color": {
|
||||
"type": "IntTag",
|
||||
"value": 12638463
|
||||
},
|
||||
"water_color": {
|
||||
"type": "IntTag",
|
||||
"value": 4159204
|
||||
}
|
||||
}
|
||||
},
|
||||
"depth": {
|
||||
"type": "FloatTag",
|
||||
"value": 0.1
|
||||
},
|
||||
"temperature": {
|
||||
"type": "FloatTag",
|
||||
"value": 0.5
|
||||
},
|
||||
"scale": {
|
||||
"type": "FloatTag",
|
||||
"value": 0.2
|
||||
},
|
||||
"downfall": {
|
||||
"type": "FloatTag",
|
||||
"value": 0.5
|
||||
},
|
||||
"category": {
|
||||
"type": "StringTag",
|
||||
"value": "underground"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,38 +12,38 @@
|
|||
"PacketLoginOutPluginMessaging": "0x04",
|
||||
},
|
||||
"PlayIn": {
|
||||
"0x10": "PacketPlayInKeepAlive",
|
||||
"0x0F": "PacketPlayInKeepAlive",
|
||||
"0x03": "PacketPlayInChat",
|
||||
"0x13": "PacketPlayInPositionAndLook",
|
||||
"0x12": "PacketPlayInPosition",
|
||||
"0x14": "PacketPlayInRotation",
|
||||
"0x0B": "PacketPlayInPluginMessaging",
|
||||
"0x12": "PacketPlayInPositionAndLook",
|
||||
"0x11": "PacketPlayInPosition",
|
||||
"0x13": "PacketPlayInRotation",
|
||||
"0x0A": "PacketPlayInPluginMessaging",
|
||||
"0x06": "PacketPlayInTabComplete",
|
||||
"0x25": "PacketPlayInHeldItemChange"
|
||||
},
|
||||
"PlayOut": {
|
||||
"PacketPlayOutLogin": "0x24",
|
||||
"PacketPlayOutPositionAndLook": "0x34",
|
||||
"PacketPlayOutSpawnPosition": "0x42",
|
||||
"PacketPlayOutChat": "0x0E",
|
||||
"PacketPlayOutPlayerAbilities": "0x30",
|
||||
"PacketPlayOutMapChunk": "0x20",
|
||||
"PacketPlayOutUnloadChunk": "0x1C",
|
||||
"PacketPlayOutLightUpdate": "0x23",
|
||||
"PacketPlayOutKeepAlive": "0x1F",
|
||||
"PacketPlayOutPlayerInfo": "0x32",
|
||||
"PacketPlayOutUpdateViewPosition": "0x40",
|
||||
"PacketPlayOutDisconnect": "0x19",
|
||||
"PacketPlayOutPluginMessaging": "0x17",
|
||||
"PacketPlayOutTabComplete": "0x0F",
|
||||
"PacketPlayOutDeclareCommands": "0x10",
|
||||
"PacketPlayOutRespawn": "0x39",
|
||||
"PacketPlayOutGameState": "0x1D",
|
||||
"PacketPlayOutEntityDestroy": "0x36",
|
||||
"PacketPlayOutEntityMetadata": "0x44",
|
||||
"PacketPlayOutLogin": "0x26",
|
||||
"PacketPlayOutPositionAndLook": "0x38",
|
||||
"PacketPlayOutSpawnPosition": "0x4B",
|
||||
"PacketPlayOutChat": "0x0F",
|
||||
"PacketPlayOutPlayerAbilities": "0x32",
|
||||
"PacketPlayOutMapChunk": "0x22",
|
||||
"PacketPlayOutUnloadChunk": "0x1D",
|
||||
"PacketPlayOutLightUpdate": "0x25",
|
||||
"PacketPlayOutKeepAlive": "0x21",
|
||||
"PacketPlayOutPlayerInfo": "0x36",
|
||||
"PacketPlayOutUpdateViewPosition": "0x49",
|
||||
"PacketPlayOutDisconnect": "0x1A",
|
||||
"PacketPlayOutPluginMessaging": "0x18",
|
||||
"PacketPlayOutTabComplete": "0x11",
|
||||
"PacketPlayOutDeclareCommands": "0x12",
|
||||
"PacketPlayOutRespawn": "0x3D",
|
||||
"PacketPlayOutGameState": "0x1E",
|
||||
"PacketPlayOutEntityDestroy": "0x3A",
|
||||
"PacketPlayOutEntityMetadata": "0x4D",
|
||||
"PacketPlayOutSpawnEntity": "0x00",
|
||||
"PacketPlayOutSpawnEntityLiving": "0x02",
|
||||
"PacketPlayOutHeldItemChange": "0x3F"
|
||||
"PacketPlayOutHeldItemChange": "0x48"
|
||||
},
|
||||
"StatusIn": {
|
||||
"0x01": "PacketStatusInPing",
|
||||
|
|
|
|||
Loading…
Reference in New Issue