forked from SteamWar/SteamWar
Fix REntity.bowDrawnWatcher
This commit is contained in:
@@ -300,10 +300,10 @@ public class FlatteningWrapper14 implements FlatteningWrapper.IFlatteningWrapper
|
||||
return head;
|
||||
}
|
||||
|
||||
private static final Class<?> entityPose = Reflection.getClass("net.minecraft.world.entity.Pose");
|
||||
private static final Object standing = entityPose.getEnumConstants()[0];
|
||||
private static final Object swimming = entityPose.getEnumConstants()[3];
|
||||
private static final Object sneaking = entityPose.getEnumConstants()[5];
|
||||
protected static final Class<?> entityPose = Reflection.getClass("net.minecraft.world.entity.Pose");
|
||||
protected static final Object standing = entityPose.getEnumConstants()[0];
|
||||
protected static final Object swimming = entityPose.getEnumConstants()[3];
|
||||
protected static final Object sneaking = entityPose.getEnumConstants()[5];
|
||||
@Override
|
||||
public Object getPose(FlatteningWrapper.EntityPose pose) {
|
||||
switch (pose) {
|
||||
|
||||
@@ -43,4 +43,11 @@ public class FlatteningWrapper21 extends FlatteningWrapper14 implements Flatteni
|
||||
});
|
||||
return head;
|
||||
}
|
||||
|
||||
protected static final Object shooting = entityPose.getEnumConstants()[16];
|
||||
@Override
|
||||
public Object getPose(FlatteningWrapper.EntityPose pose) {
|
||||
if (pose == FlatteningWrapper.EntityPose.SHOOTING) return shooting;
|
||||
return super.getPose(pose);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,8 @@ public class FlatteningWrapper {
|
||||
public enum EntityPose {
|
||||
NORMAL,
|
||||
SNEAKING,
|
||||
SWIMMING;
|
||||
SWIMMING,
|
||||
SHOOTING,
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ 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(FlatteningWrapper.EntityPose.NORMAL).getClass());
|
||||
private static final Object bowDrawnWatcher = BountifulWrapper.impl.getDataWatcherObject(Core.getVersion() > 12 ? 7 : 6, Byte.class);
|
||||
private static final Object bowDrawnWatcher = Core.getVersion() >= 21 ? BountifulWrapper.impl.getDataWatcherObject(6, FlatteningWrapper.impl.getPose(FlatteningWrapper.EntityPose.NORMAL).getClass()) : 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);
|
||||
|
||||
@@ -219,7 +219,9 @@ public class REntity {
|
||||
|
||||
public void setBowDrawn(boolean drawn, boolean offHand) {
|
||||
bowDrawn = drawn;
|
||||
if(Core.getVersion() > 8){
|
||||
if (Core.getVersion() >= 21) {
|
||||
server.updateEntity(this, getDataWatcherPacket(bowDrawnWatcher, FlatteningWrapper.impl.getPose(FlatteningWrapper.EntityPose.SHOOTING)));
|
||||
} else if(Core.getVersion() > 8){
|
||||
server.updateEntity(this, getDataWatcherPacket(bowDrawnWatcher, (byte) ((drawn ? 1 : 0) + (offHand ? 2 : 0))));
|
||||
}else{
|
||||
server.updateEntity(this, getDataWatcherPacket(entityStatusWatcher, getEntityStatus()));
|
||||
|
||||
Reference in New Issue
Block a user