Fix NoSuchMethodError in reobf

This commit is contained in:
Marcel Konrad
2020-07-01 23:19:34 +02:00
parent 1a349a2ce2
commit d369c1058a

View File

@@ -1,5 +1,6 @@
package exopandora.worldhandler.builder.component.impl;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@@ -7,8 +8,6 @@ import java.util.Set;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.apache.commons.lang3.ArrayUtils;
import exopandora.worldhandler.builder.component.IBuilderComponent;
import exopandora.worldhandler.builder.impl.EnumAttributes;
import exopandora.worldhandler.builder.impl.EnumAttributes.Applyable;
@@ -174,7 +173,7 @@ public class EntityNBT implements IBuilderComponent
public void setArmorItem(int index, ResourceLocation location)
{
if(ArrayUtils.isArrayIndexValid(this.armorItems, index) && location != null)
if(EntityNBT.isArrayIndexValid(this.armorItems, index) && location != null)
{
this.armorItems[index] = location;
}
@@ -188,7 +187,7 @@ public class EntityNBT implements IBuilderComponent
@Nonnull
public ResourceLocation getArmorItem(int slot)
{
if(ArrayUtils.isArrayIndexValid(this.armorItems, slot))
if(EntityNBT.isArrayIndexValid(this.armorItems, slot))
{
return this.armorItems[slot];
}
@@ -208,7 +207,7 @@ public class EntityNBT implements IBuilderComponent
public void setHandItem(int index, ResourceLocation location)
{
if(ArrayUtils.isArrayIndexValid(this.handItems, index) && location != null)
if(EntityNBT.isArrayIndexValid(this.handItems, index) && location != null)
{
this.handItems[index] = location;
}
@@ -217,7 +216,7 @@ public class EntityNBT implements IBuilderComponent
@Nonnull
public ResourceLocation getHandItem(int slot)
{
if(ArrayUtils.isArrayIndexValid(this.handItems, slot))
if(EntityNBT.isArrayIndexValid(this.handItems, slot))
{
return this.handItems[slot];
}
@@ -428,4 +427,14 @@ public class EntityNBT implements IBuilderComponent
{
return null;
}
private static boolean isArrayIndexValid(Object[] array, int index)
{
if(array != null && (Array.getLength(array) == 0 || array.length <= index))
{
return false;
}
return index >= 0;
}
}