mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-09 20:30:28 +01:00
Implementation for the new rotation values. Fixes SPIGOT-93
This commit is contained in:
parent
d2c2630307
commit
0d5693dec5
@ -49,16 +49,24 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame {
|
||||
Rotation toBukkitRotation(int value) {
|
||||
// Translate NMS rotation integer to Bukkit API
|
||||
switch (value) {
|
||||
case 0:
|
||||
return Rotation.NONE;
|
||||
case 1:
|
||||
return Rotation.CLOCKWISE;
|
||||
case 2:
|
||||
return Rotation.FLIPPED;
|
||||
case 3:
|
||||
return Rotation.COUNTER_CLOCKWISE;
|
||||
default:
|
||||
throw new AssertionError("Unknown rotation " + value + " for " + getHandle());
|
||||
case 0:
|
||||
return Rotation.NONE;
|
||||
case 1:
|
||||
return Rotation.CLOCKWISE_45;
|
||||
case 2:
|
||||
return Rotation.CLOCKWISE;
|
||||
case 3:
|
||||
return Rotation.CLOCKWISE_135;
|
||||
case 4:
|
||||
return Rotation.FLIPPED;
|
||||
case 5:
|
||||
return Rotation.FLIPPED_45;
|
||||
case 6:
|
||||
return Rotation.COUNTER_CLOCKWISE;
|
||||
case 7:
|
||||
return Rotation.COUNTER_CLOCKWISE_45;
|
||||
default:
|
||||
throw new AssertionError("Unknown rotation " + value + " for " + getHandle());
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,16 +78,24 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame {
|
||||
static int toInteger(Rotation rotation) {
|
||||
// Translate Bukkit API rotation to NMS integer
|
||||
switch (rotation) {
|
||||
case NONE:
|
||||
return 0;
|
||||
case CLOCKWISE:
|
||||
return 1;
|
||||
case FLIPPED:
|
||||
return 2;
|
||||
case COUNTER_CLOCKWISE:
|
||||
return 3;
|
||||
default:
|
||||
throw new IllegalArgumentException(rotation + " is not applicable to an ItemFrame");
|
||||
case NONE:
|
||||
return 0;
|
||||
case CLOCKWISE_45:
|
||||
return 1;
|
||||
case CLOCKWISE:
|
||||
return 2;
|
||||
case CLOCKWISE_135:
|
||||
return 3;
|
||||
case FLIPPED:
|
||||
return 4;
|
||||
case FLIPPED_45:
|
||||
return 5;
|
||||
case COUNTER_CLOCKWISE:
|
||||
return 6;
|
||||
case COUNTER_CLOCKWISE_45:
|
||||
return 7;
|
||||
default:
|
||||
throw new IllegalArgumentException(rotation + " is not applicable to an ItemFrame");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user