make rotation data creations a bit shorter
This commit is contained in:
		
							parent
							
								
									6b943d1059
								
							
						
					
					
						commit
						886b5c1f92
					
				
					 6 changed files with 41 additions and 33 deletions
				
			
		|  | @ -32,31 +32,31 @@ public class V1_10MetadataFactory extends V1_9MetadataFactory { | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandHeadRotation(Vector3f headRotation) { |     public EntityData armorStandHeadRotation(Vector3f headRotation) { | ||||||
|         return newEntityData(12, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(headRotation.getX(), headRotation.getY(), headRotation.getZ())); |         return createRotations(12, headRotation); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandBodyRotation(Vector3f bodyRotation) { |     public EntityData armorStandBodyRotation(Vector3f bodyRotation) { | ||||||
|         return newEntityData(13, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(bodyRotation.getX(), bodyRotation.getY(), bodyRotation.getZ())); |         return createRotations(13, bodyRotation); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandLeftArmRotation(Vector3f leftArmRotation) { |     public EntityData armorStandLeftArmRotation(Vector3f leftArmRotation) { | ||||||
|         return newEntityData(14, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(leftArmRotation.getX(), leftArmRotation.getY(), leftArmRotation.getZ())); |         return createRotations(14, leftArmRotation); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandRightArmRotation(Vector3f rightArmRotation) { |     public EntityData armorStandRightArmRotation(Vector3f rightArmRotation) { | ||||||
|         return newEntityData(15, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(rightArmRotation.getX(), rightArmRotation.getY(), rightArmRotation.getZ())); |         return createRotations(15, rightArmRotation); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandLeftLegRotation(Vector3f leftLegRotation) { |     public EntityData armorStandLeftLegRotation(Vector3f leftLegRotation) { | ||||||
|         return newEntityData(16, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(leftLegRotation.getX(), leftLegRotation.getY(), leftLegRotation.getZ())); |         return createRotations(16, leftLegRotation); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandRightLegRotation(Vector3f rightLegRotation) { |     public EntityData armorStandRightLegRotation(Vector3f rightLegRotation) { | ||||||
|         return newEntityData(17, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(rightLegRotation.getX(), rightLegRotation.getY(), rightLegRotation.getZ())); |         return createRotations(17, rightLegRotation); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -38,31 +38,31 @@ public class V1_14MetadataFactory extends V1_13MetadataFactory { | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandHeadRotation(Vector3f headRotation) { |     public EntityData armorStandHeadRotation(Vector3f headRotation) { | ||||||
|         return newEntityData(14, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(headRotation.getX(), headRotation.getY(), headRotation.getZ())); |         return createRotations(14, headRotation); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandBodyRotation(Vector3f bodyRotation) { |     public EntityData armorStandBodyRotation(Vector3f bodyRotation) { | ||||||
|         return newEntityData(15, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(bodyRotation.getX(), bodyRotation.getY(), bodyRotation.getZ())); |         return createRotations(15, bodyRotation); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandLeftArmRotation(Vector3f leftArmRotation) { |     public EntityData armorStandLeftArmRotation(Vector3f leftArmRotation) { | ||||||
|         return newEntityData(16, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(leftArmRotation.getX(), leftArmRotation.getY(), leftArmRotation.getZ())); |         return createRotations(16, leftArmRotation); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandRightArmRotation(Vector3f rightArmRotation) { |     public EntityData armorStandRightArmRotation(Vector3f rightArmRotation) { | ||||||
|         return newEntityData(17, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(rightArmRotation.getX(), rightArmRotation.getY(), rightArmRotation.getZ())); |         return createRotations(17, rightArmRotation); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandLeftLegRotation(Vector3f leftLegRotation) { |     public EntityData armorStandLeftLegRotation(Vector3f leftLegRotation) { | ||||||
|         return newEntityData(18, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(leftLegRotation.getX(), leftLegRotation.getY(), leftLegRotation.getZ())); |         return createRotations(18, leftLegRotation); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandRightLegRotation(Vector3f rightLegRotation) { |     public EntityData armorStandRightLegRotation(Vector3f rightLegRotation) { | ||||||
|         return newEntityData(19, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(rightLegRotation.getX(), rightLegRotation.getY(), rightLegRotation.getZ())); |         return createRotations(19, rightLegRotation); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -12,31 +12,31 @@ public class V1_15MetadataFactory extends V1_14MetadataFactory { | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandHeadRotation(Vector3f headRotation) { |     public EntityData armorStandHeadRotation(Vector3f headRotation) { | ||||||
|         return newEntityData(15, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(headRotation.getX(), headRotation.getY(), headRotation.getZ())); |         return createRotations(15, headRotation); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandBodyRotation(Vector3f bodyRotation) { |     public EntityData armorStandBodyRotation(Vector3f bodyRotation) { | ||||||
|         return newEntityData(16, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(bodyRotation.getX(), bodyRotation.getY(), bodyRotation.getZ())); |         return createRotations(16, bodyRotation); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandLeftArmRotation(Vector3f leftArmRotation) { |     public EntityData armorStandLeftArmRotation(Vector3f leftArmRotation) { | ||||||
|         return newEntityData(17, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(leftArmRotation.getX(), leftArmRotation.getY(), leftArmRotation.getZ())); |         return createRotations(17, leftArmRotation); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandRightArmRotation(Vector3f rightArmRotation) { |     public EntityData armorStandRightArmRotation(Vector3f rightArmRotation) { | ||||||
|         return newEntityData(18, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(rightArmRotation.getX(), rightArmRotation.getY(), rightArmRotation.getZ())); |         return createRotations(18, rightArmRotation); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandLeftLegRotation(Vector3f leftLegRotation) { |     public EntityData armorStandLeftLegRotation(Vector3f leftLegRotation) { | ||||||
|         return newEntityData(19, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(leftLegRotation.getX(), leftLegRotation.getY(), leftLegRotation.getZ())); |         return createRotations(19, leftLegRotation); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandRightLegRotation(Vector3f rightLegRotation) { |     public EntityData armorStandRightLegRotation(Vector3f rightLegRotation) { | ||||||
|         return newEntityData(20, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(rightLegRotation.getX(), rightLegRotation.getY(), rightLegRotation.getZ())); |         return createRotations(20, rightLegRotation); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -42,33 +42,31 @@ public class V1_17MetadataFactory extends V1_16MetadataFactory { | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandHeadRotation(Vector3f headRotation) { |     public EntityData armorStandHeadRotation(Vector3f headRotation) { | ||||||
|         return newEntityData(16, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(headRotation.getX(), headRotation.getY(), headRotation.getZ())); |         return createRotations(16, headRotation); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandBodyRotation(Vector3f bodyRotation) { |     public EntityData armorStandBodyRotation(Vector3f bodyRotation) { | ||||||
|         return newEntityData(17, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(bodyRotation.getX(), bodyRotation.getY(), bodyRotation.getZ())); |         return createRotations(17, bodyRotation); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandLeftArmRotation(Vector3f leftArmRotation) { |     public EntityData armorStandLeftArmRotation(Vector3f leftArmRotation) { | ||||||
|         return newEntityData(18, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(leftArmRotation.getX(), leftArmRotation.getY(), leftArmRotation.getZ())); |         return createRotations(18, leftArmRotation); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandRightArmRotation(Vector3f rightArmRotation) { |     public EntityData armorStandRightArmRotation(Vector3f rightArmRotation) { | ||||||
|         return newEntityData(19, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(rightArmRotation.getX(), rightArmRotation.getY(), rightArmRotation.getZ())); |         return createRotations(19, rightArmRotation); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandLeftLegRotation(Vector3f leftLegRotation) { |     public EntityData armorStandLeftLegRotation(Vector3f leftLegRotation) { | ||||||
|         return newEntityData(20, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(leftLegRotation.getX(), leftLegRotation.getY(), leftLegRotation.getZ())); |         return createRotations(20, leftLegRotation); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandRightLegRotation(Vector3f rightLegRotation) { |     public EntityData armorStandRightLegRotation(Vector3f rightLegRotation) { | ||||||
|         return newEntityData(21, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(rightLegRotation.getX(), rightLegRotation.getY(), rightLegRotation.getZ())); |         return createRotations(21, rightLegRotation); | ||||||
|     } |     } | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -66,32 +66,32 @@ public class V1_8MetadataFactory implements MetadataFactory { | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandHeadRotation(Vector3f headRotation) { |     public EntityData armorStandHeadRotation(Vector3f headRotation) { | ||||||
|         return newEntityData(11, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(headRotation.getX(), headRotation.getY(), headRotation.getZ())); |         return createRotations(11, headRotation); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandBodyRotation(Vector3f bodyRotation) { |     public EntityData armorStandBodyRotation(Vector3f bodyRotation) { | ||||||
|         return newEntityData(12, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(bodyRotation.getX(), bodyRotation.getY(), bodyRotation.getZ())); |         return createRotations(12, bodyRotation); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandLeftArmRotation(Vector3f leftArmRotation) { |     public EntityData armorStandLeftArmRotation(Vector3f leftArmRotation) { | ||||||
|         return newEntityData(13, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(leftArmRotation.getX(), leftArmRotation.getY(), leftArmRotation.getZ())); |         return createRotations(13, leftArmRotation); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandRightArmRotation(Vector3f rightArmRotation) { |     public EntityData armorStandRightArmRotation(Vector3f rightArmRotation) { | ||||||
|         return newEntityData(14, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(rightArmRotation.getX(), rightArmRotation.getY(), rightArmRotation.getZ())); |         return createRotations(14, rightArmRotation); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandLeftLegRotation(Vector3f leftLegRotation) { |     public EntityData armorStandLeftLegRotation(Vector3f leftLegRotation) { | ||||||
|         return newEntityData(15, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(leftLegRotation.getX(), leftLegRotation.getY(), leftLegRotation.getZ())); |         return createRotations(15, leftLegRotation); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData armorStandRightLegRotation(Vector3f rightLegRotation) { |     public EntityData armorStandRightLegRotation(Vector3f rightLegRotation) { | ||||||
|         return newEntityData(16, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(rightLegRotation.getX(), rightLegRotation.getY(), rightLegRotation.getZ())); |         return createRotations(16, rightLegRotation); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|  | @ -114,4 +114,8 @@ public class V1_8MetadataFactory implements MetadataFactory { | ||||||
|     protected <T> EntityData newEntityData(int index, EntityDataType<T> type, T value) { |     protected <T> EntityData newEntityData(int index, EntityDataType<T> type, T value) { | ||||||
|         return new EntityData(index, type, value); |         return new EntityData(index, type, value); | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     protected EntityData createRotations(int index, Vector3f rotations) { | ||||||
|  |         return newEntityData(index, EntityDataTypes.ROTATION, new com.github.retrooper.packetevents.util.Vector3f(rotations.getX(), rotations.getY(), rotations.getZ())); | ||||||
|  |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -13,7 +13,13 @@ public class V1_9MetadataFactory extends V1_8MetadataFactory { | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public EntityData effects(boolean onFire, boolean glowing, boolean invisible, boolean usingElytra, boolean usingItemLegacy) { |     public EntityData effects(boolean onFire, boolean glowing, boolean invisible, boolean usingElytra, boolean usingItemLegacy) { | ||||||
|         return newEntityData(0, EntityDataTypes.BYTE, (byte) ((onFire ? 0x01 : 0) | (usingItemLegacy ? 0x10 : 0) | (invisible ? 0x20 : 0) | (glowing ? 0x40 : 0) | (usingElytra ? 0x80 : 0))); |         return newEntityData(0, EntityDataTypes.BYTE, (byte) ( | ||||||
|  |                 (onFire ? 0x01 : 0) | | ||||||
|  |                 (usingItemLegacy ? 0x10 : 0) | | ||||||
|  |                 (invisible ? 0x20 : 0) | | ||||||
|  |                 (glowing ? 0x40 : 0) | | ||||||
|  |                 (usingElytra ? 0x80 : 0) | ||||||
|  |         )); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue