Totally stable optimizations that wont cause any problems at all.

This commit is contained in:
Daniel Mills
2021-07-14 16:40:20 -04:00
parent 886553a923
commit 7d423fa49d
260 changed files with 2329 additions and 3058 deletions

View File

@@ -33,7 +33,7 @@ import java.lang.reflect.Method;
*
* @author MrMicky
*/
@SuppressWarnings("deprecation")
@SuppressWarnings({"deprecation", "JavaReflectionInvocation"})
class ParticleSenderLegacy implements ParticleSender {
private static final boolean SERVER_IS_1_8;
@@ -158,20 +158,18 @@ class ParticleSenderLegacy implements ParticleSender {
private int[] toData(ParticleType particle, Object data) {
Class<?> dataType = particle.getDataType();
if (dataType == ItemStack.class) {
if (!(data instanceof ItemStack)) {
if (!(data instanceof ItemStack itemStack)) {
return SERVER_IS_1_8 ? new int[2] : new int[]{1, 0};
}
ItemStack itemStack = (ItemStack) data;
return new int[]{itemStack.getType().getId(), itemStack.getDurability()};
}
if (dataType == MaterialData.class) {
if (!(data instanceof MaterialData)) {
if (!(data instanceof MaterialData materialData)) {
return SERVER_IS_1_8 ? new int[1] : new int[]{1, 0};
}
MaterialData materialData = (MaterialData) data;
if (SERVER_IS_1_8) {
return new int[]{materialData.getItemType().getId() + (materialData.getData() << 12)};
} else {