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