#807: Add Player#sendBlockDamage()
This commit is contained in:
parent
b7eed25467
commit
ea050e6e98
@ -44,6 +44,7 @@ import net.minecraft.server.MapIcon;
|
||||
import net.minecraft.server.MinecraftKey;
|
||||
import net.minecraft.server.NBTTagCompound;
|
||||
import net.minecraft.server.PacketDataSerializer;
|
||||
import net.minecraft.server.PacketPlayOutBlockBreakAnimation;
|
||||
import net.minecraft.server.PacketPlayOutBlockChange;
|
||||
import net.minecraft.server.PacketPlayOutChat;
|
||||
import net.minecraft.server.PacketPlayOutCustomPayload;
|
||||
@ -545,6 +546,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBlockDamage(Location loc, float progress) {
|
||||
Preconditions.checkArgument(loc != null, "loc must not be null");
|
||||
Preconditions.checkArgument(progress >= 0.0 && progress <= 1.0, "progress must be between 0.0 and 1.0 (inclusive)");
|
||||
|
||||
if (getHandle().playerConnection == null) return;
|
||||
|
||||
int stage = (int) (9 * progress); // There are 0 - 9 damage states
|
||||
PacketPlayOutBlockBreakAnimation packet = new PacketPlayOutBlockBreakAnimation(getHandle().getId(), new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()), stage);
|
||||
getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendSignChange(Location loc, String[] lines) {
|
||||
sendSignChange(loc, lines, DyeColor.BLACK);
|
||||
|
Loading…
x
Reference in New Issue
Block a user