Swimming, Small ArmorStand, Initial MapType
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Dieser Commit ist enthalten in:
Ursprung
000f2189f8
Commit
8886cc5562
@ -298,10 +298,19 @@ public class FlatteningWrapper14 implements FlatteningWrapper.IFlatteningWrapper
|
||||
|
||||
private static final Class<?> entityPose = Reflection.getClass("{nms.world.entity}.EntityPose");
|
||||
private static final Object standing = entityPose.getEnumConstants()[0];
|
||||
private static final Object swimming = entityPose.getEnumConstants()[3];
|
||||
private static final Object sneaking = entityPose.getEnumConstants()[5];
|
||||
@Override
|
||||
public Object getPose(boolean isSneaking) {
|
||||
return isSneaking ? sneaking : standing;
|
||||
public Object getPose(FlatteningWrapper.EntityPose pose) {
|
||||
switch (pose) {
|
||||
case SNEAKING:
|
||||
return sneaking;
|
||||
case SWIMMING:
|
||||
return swimming;
|
||||
case NORMAL:
|
||||
default:
|
||||
return standing;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -50,6 +50,9 @@ public class ProtocolWrapper18 implements ProtocolWrapper {
|
||||
case FIREBALL:
|
||||
spawnType.set(packet, EntityTypes.S);
|
||||
break;
|
||||
case ITEM_FRAME:
|
||||
spawnType.set(packet, EntityTypes.R);
|
||||
break;
|
||||
case ARMOR_STAND:
|
||||
spawnLivingType.set(packet, 1);
|
||||
break;
|
||||
|
@ -49,6 +49,9 @@ public class ProtocolWrapper19 implements ProtocolWrapper {
|
||||
case FIREBALL:
|
||||
spawnType.set(packet, EntityTypes.V);
|
||||
break;
|
||||
case ITEM_FRAME:
|
||||
spawnType.set(packet, EntityTypes.U);
|
||||
break;
|
||||
case ARMOR_STAND:
|
||||
spawnType.set(packet, EntityTypes.d);
|
||||
break;
|
||||
|
@ -66,8 +66,8 @@ public class FlatteningWrapper8 implements FlatteningWrapper.IFlatteningWrapper
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getPose(boolean sneaking) {
|
||||
return Byte.valueOf((byte)(sneaking ? 2 : 0));
|
||||
public Object getPose(FlatteningWrapper.EntityPose pose) {
|
||||
return Byte.valueOf((byte)(pose == FlatteningWrapper.EntityPose.SNEAKING ? 2 : 0));
|
||||
}
|
||||
|
||||
private static final Class<?> dataWatcher = Reflection.getClass("{nms}.DataWatcher");
|
||||
|
@ -47,6 +47,7 @@ public class ProtocolWrapper8 implements ProtocolWrapper {
|
||||
private static final Object tnt;
|
||||
private static final Object arrow;
|
||||
private static final Object fireball;
|
||||
private static final Object itemFrame;
|
||||
private static final int armorStand;
|
||||
static {
|
||||
if(Core.getVersion() < 14) {
|
||||
@ -55,12 +56,14 @@ public class ProtocolWrapper8 implements ProtocolWrapper {
|
||||
arrow = 60;
|
||||
fireball = 63;
|
||||
armorStand = 30;
|
||||
itemFrame = 18;
|
||||
} else {
|
||||
Class<?> entityTypes = Reflection.getClass("{nms.world.entity}.EntityTypes");
|
||||
spawnType = Reflection.getField(ProtocolWrapper.spawnPacket, entityTypes, 0);
|
||||
tnt = Reflection.getField(entityTypes, "TNT", entityTypes).get(null);
|
||||
arrow = Reflection.getField(entityTypes, "ARROW", entityTypes).get(null);
|
||||
fireball = Reflection.getField(entityTypes, "FIREBALL", entityTypes).get(null);
|
||||
itemFrame = Reflection.getField(entityTypes, "ITEM_FRAME", entityTypes).get(null);
|
||||
armorStand = 1;
|
||||
}
|
||||
}
|
||||
@ -76,6 +79,9 @@ public class ProtocolWrapper8 implements ProtocolWrapper {
|
||||
case FIREBALL:
|
||||
spawnType.set(packet, fireball);
|
||||
break;
|
||||
case ITEM_FRAME:
|
||||
spawnType.set(packet, itemFrame);
|
||||
break;
|
||||
case ARMOR_STAND:
|
||||
spawnLivingType.set(packet, armorStand);
|
||||
break;
|
||||
|
@ -39,8 +39,14 @@ public class FlatteningWrapper {
|
||||
Material getDye(int colorCode);
|
||||
ItemStack setSkullOwner(String player);
|
||||
|
||||
Object getPose(boolean sneaking);
|
||||
Object getPose(EntityPose pose);
|
||||
void setNamedSpawnPacketDataWatcher(Object packet);
|
||||
Object formatDisplayName(String displayName);
|
||||
}
|
||||
|
||||
public enum EntityPose {
|
||||
NORMAL,
|
||||
SNEAKING,
|
||||
SWIMMING;
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ import org.bukkit.entity.EntityType;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class RHologram extends REntity {
|
||||
public class RArmorStand extends REntity {
|
||||
|
||||
private static int sizeIndex() {
|
||||
switch(Core.getVersion()) {
|
||||
@ -49,14 +49,28 @@ public class RHologram extends REntity {
|
||||
|
||||
private static final Object sizeWatcher = BountifulWrapper.impl.getDataWatcherObject(sizeIndex(), Byte.class);
|
||||
|
||||
public RHologram(REntityServer server, Location location) {
|
||||
private final Size size;
|
||||
|
||||
public RArmorStand(REntityServer server, Location location, Size size) {
|
||||
super(server, EntityType.ARMOR_STAND, location);
|
||||
setInvisible(true);
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
@Override
|
||||
void spawn(Consumer<Object> packetSink) {
|
||||
super.spawn(packetSink);
|
||||
packetSink.accept(getDataWatcherPacket(sizeWatcher, (byte) 0x10));
|
||||
packetSink.accept(getDataWatcherPacket(sizeWatcher, size.value));
|
||||
}
|
||||
|
||||
public enum Size {
|
||||
NORMAL((byte) 0x00),
|
||||
SMALL((byte) 0x01),
|
||||
MARKER((byte) 0x10);
|
||||
|
||||
private final byte value;
|
||||
|
||||
Size(byte value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
}
|
@ -34,7 +34,7 @@ import java.util.function.Function;
|
||||
public class REntity {
|
||||
|
||||
private static final Object entityStatusWatcher = BountifulWrapper.impl.getDataWatcherObject(0, Byte.class);
|
||||
private static final Object sneakingDataWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() > 12 ? 6 : 0, FlatteningWrapper.impl.getPose(true).getClass());
|
||||
private static final Object sneakingDataWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() > 12 ? 6 : 0, FlatteningWrapper.impl.getPose(FlatteningWrapper.EntityPose.NORMAL).getClass());
|
||||
private static final Object bowDrawnWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() > 12 ? 7 : 6, Byte.class);
|
||||
private static final Object nameWatcher = BountifulWrapper.impl.getDataWatcherObject(2, Core.getVersion() > 12 ? Optional.class : String.class); // Optional<IChatBaseComponent>
|
||||
private static final Object nameVisibleWatcher = BountifulWrapper.impl.getDataWatcherObject(3, Boolean.class);
|
||||
@ -55,7 +55,7 @@ public class REntity {
|
||||
private byte headYaw;
|
||||
|
||||
private boolean invisible;
|
||||
private boolean sneaks;
|
||||
private FlatteningWrapper.EntityPose pose;
|
||||
private boolean bowDrawn;
|
||||
private int fireTick;
|
||||
private String displayName;
|
||||
@ -133,10 +133,10 @@ public class REntity {
|
||||
server.updateEntity(this, packet);
|
||||
}
|
||||
|
||||
public void sneak(boolean sneaking) {
|
||||
sneaks = sneaking;
|
||||
public void setPose(FlatteningWrapper.EntityPose pose) {
|
||||
this.pose = pose;
|
||||
if(Core.getVersion() > 12) {
|
||||
server.updateEntity(this, getDataWatcherPacket(sneakingDataWatcher, FlatteningWrapper.impl.getPose(sneaking)));
|
||||
server.updateEntity(this, getDataWatcherPacket(sneakingDataWatcher, FlatteningWrapper.impl.getPose(pose)));
|
||||
} else {
|
||||
server.updateEntity(this, getDataWatcherPacket(entityStatusWatcher, getEntityStatus()));
|
||||
}
|
||||
@ -195,8 +195,8 @@ public class REntity {
|
||||
packetSink.accept(getHeadRotationPacket());
|
||||
}
|
||||
|
||||
if(Core.getVersion() > 12 && sneaks) {
|
||||
packetSink.accept(getDataWatcherPacket(sneakingDataWatcher, FlatteningWrapper.impl.getPose(true)));
|
||||
if(Core.getVersion() > 12 && pose != FlatteningWrapper.EntityPose.NORMAL) {
|
||||
packetSink.accept(getDataWatcherPacket(sneakingDataWatcher, FlatteningWrapper.impl.getPose(pose)));
|
||||
}
|
||||
|
||||
byte status = getEntityStatus();
|
||||
@ -245,7 +245,7 @@ public class REntity {
|
||||
|
||||
if(fireTick != 0)
|
||||
status |= 1;
|
||||
if(sneaks)
|
||||
if(pose == FlatteningWrapper.EntityPose.SNEAKING)
|
||||
status |= 2;
|
||||
if(Core.getVersion() == 8 && bowDrawn)
|
||||
status |= 0x10;
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren