mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-04 23:47:59 +01:00
chore: other melonhell pr changes
This commit is contained in:
parent
9eab3d4f8b
commit
266040cfa7
@ -466,8 +466,7 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
|
||||
refreshHealth();
|
||||
|
||||
sendPacket(new RespawnPacket(getDimensionType().toString(), instance.getDimensionName(),
|
||||
0, gameMode, gameMode, false, levelFlat, RespawnPacket.COPY_ALL,
|
||||
deathLocation, portalCooldown));
|
||||
0, gameMode, gameMode, false, levelFlat, deathLocation, portalCooldown, RespawnPacket.COPY_ALL));
|
||||
|
||||
PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(this);
|
||||
EventDispatcher.call(respawnEvent);
|
||||
@ -1081,8 +1080,7 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
|
||||
final PlayerInfoUpdatePacket addPlayerPacket = getAddPlayerToList();
|
||||
|
||||
RespawnPacket respawnPacket = new RespawnPacket(getDimensionType().toString(), instance.getDimensionName(),
|
||||
0, gameMode, gameMode, false, levelFlat, RespawnPacket.COPY_ALL,
|
||||
deathLocation, portalCooldown);
|
||||
0, gameMode, gameMode, false, levelFlat, deathLocation, portalCooldown, RespawnPacket.COPY_ALL);
|
||||
|
||||
sendPacket(removePlayerPacket);
|
||||
sendPacket(destroyEntitiesPacket);
|
||||
@ -1483,7 +1481,7 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
|
||||
this.dimensionType = dimensionType;
|
||||
sendPacket(new RespawnPacket(dimensionType.toString(), dimensionName,
|
||||
0, gameMode, gameMode, false, levelFlat,
|
||||
RespawnPacket.COPY_ALL, deathLocation, portalCooldown));
|
||||
deathLocation, portalCooldown, RespawnPacket.COPY_ALL));
|
||||
refreshClientStateAfterRespawn();
|
||||
}
|
||||
|
||||
|
@ -10,9 +10,15 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import static net.minestom.server.network.NetworkBuffer.*;
|
||||
|
||||
// Notes
|
||||
// sourceEntityId - 0 indicates no source entity, otherwise it is entityId + 1
|
||||
// sourceDirectId - 0 indicates no direct source. Direct attacks (e.g. melee) will have this number me the same as sourceEntityId, indirect attacks (e.g. projectiles) will have this be be the projectile entity id + 1
|
||||
/**
|
||||
* See <a href="https://wiki.vg/Protocol#Damage_Event">https://wiki.vg/Protocol#Damage_Event</a> for more info.
|
||||
*
|
||||
* @param targetEntityId ID of the entity being damaged
|
||||
* @param damageTypeId ID of damage type
|
||||
* @param sourceEntityId 0 if there is no source entity, otherwise it is entityId + 1
|
||||
* @param sourceDirectId 0 if there is no direct source. For direct attacks (e.g. melee), this is the same as sourceEntityId. For indirect attacks (e.g. projectiles), this is the projectile entity id + 1
|
||||
* @param sourcePos null if there is no source position, otherwise the position of the source
|
||||
*/
|
||||
public record DamageEventPacket(int targetEntityId, int damageTypeId, int sourceEntityId, int sourceDirectId, @Nullable Point sourcePos) implements ServerPacket {
|
||||
|
||||
public DamageEventPacket(@NotNull NetworkBuffer reader) {
|
||||
|
@ -10,22 +10,24 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static net.minestom.server.network.NetworkBuffer.*;
|
||||
|
||||
public record RespawnPacket(String dimensionType, String worldName,
|
||||
long hashedSeed, GameMode gameMode, GameMode previousGameMode,
|
||||
boolean isDebug, boolean isFlat, byte dataToCopy,
|
||||
DeathLocation deathLocation, int portalCooldown) implements ServerPacket {
|
||||
|
||||
public static final byte COPY_ATTRIBUTES = 0x1;
|
||||
public static final byte COPY_METADATA = 0x2;
|
||||
public static final byte COPY_ALL = COPY_ATTRIBUTES | COPY_METADATA;
|
||||
public record RespawnPacket(
|
||||
String dimensionType, String worldName,
|
||||
long hashedSeed, GameMode gameMode, GameMode previousGameMode,
|
||||
boolean isDebug, boolean isFlat, DeathLocation deathLocation,
|
||||
int portalCooldown, int copyData
|
||||
) implements ServerPacket {
|
||||
public static final int COPY_NONE = 0x0;
|
||||
public static final int COPY_ATTRIBUTES = 0x1;
|
||||
public static final int COPY_METADATA = 0x2;
|
||||
public static final int COPY_ALL = COPY_ATTRIBUTES | COPY_METADATA;
|
||||
|
||||
public RespawnPacket(@NotNull NetworkBuffer reader) {
|
||||
this(reader.read(STRING), reader.read(STRING),
|
||||
reader.read(LONG), GameMode.fromId(reader.read(BYTE)),
|
||||
GameMode.fromId(reader.read(BYTE)),
|
||||
reader.read(BOOLEAN), reader.read(BOOLEAN),
|
||||
reader.read(BYTE), reader.read(DEATH_LOCATION),
|
||||
reader.read(VAR_INT));
|
||||
reader.read(DEATH_LOCATION),
|
||||
reader.read(VAR_INT), reader.read(BYTE));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -37,9 +39,9 @@ public record RespawnPacket(String dimensionType, String worldName,
|
||||
writer.write(BYTE, previousGameMode.id());
|
||||
writer.write(BOOLEAN, isDebug);
|
||||
writer.write(BOOLEAN, isFlat);
|
||||
writer.write(BYTE, dataToCopy);
|
||||
writer.write(DEATH_LOCATION, deathLocation);
|
||||
writer.write(VAR_INT, portalCooldown);
|
||||
writer.write(BYTE, (byte) copyData);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -72,7 +72,7 @@ public final class Biome {
|
||||
element.setFloat("scale", scale);
|
||||
element.setFloat("downfall", downfall);
|
||||
element.setString("category", category.name().toLowerCase(Locale.ROOT));
|
||||
element.setByte("has_precipitation", (byte) 1); //todo bad fix
|
||||
element.setByte("has_precipitation", (byte) (precipitation == Precipitation.NONE ? 0 : 1));
|
||||
element.setString("precipitation", precipitation.name().toLowerCase(Locale.ROOT));
|
||||
if (temperatureModifier != TemperatureModifier.NONE)
|
||||
element.setString("temperature_modifier", temperatureModifier.name().toLowerCase(Locale.ROOT));
|
||||
|
Loading…
Reference in New Issue
Block a user