Fix bugs
This commit is contained in:
@@ -3,8 +3,6 @@ package refinedstorage.container.slot;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import refinedstorage.RefinedStorageItems;
|
import refinedstorage.RefinedStorageItems;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
public class UpgradeItemValidator implements IItemValidator {
|
public class UpgradeItemValidator implements IItemValidator {
|
||||||
private int[] allowedUpgrades;
|
private int[] allowedUpgrades;
|
||||||
|
|
||||||
@@ -14,6 +12,14 @@ public class UpgradeItemValidator implements IItemValidator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid(ItemStack stack) {
|
public boolean isValid(ItemStack stack) {
|
||||||
return stack.getItem() == RefinedStorageItems.UPGRADE && Arrays.asList(allowedUpgrades).contains(stack.getMetadata());
|
if (stack.getItem() == RefinedStorageItems.UPGRADE) {
|
||||||
|
for (int upgrade : allowedUpgrades) {
|
||||||
|
if (upgrade == stack.getMetadata()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ public class ItemWirelessGrid extends ItemEnergyContainer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) {
|
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) {
|
||||||
if (!world.isRemote && getDimensionId(stack) == player.dimension) {
|
if (!world.isRemote && hasValidNBT(stack) && getDimensionId(stack) == player.dimension) {
|
||||||
TileEntity tile = world.getTileEntity(new BlockPos(getX(stack), getY(stack), getZ(stack)));
|
TileEntity tile = world.getTileEntity(new BlockPos(getX(stack), getY(stack), getZ(stack)));
|
||||||
|
|
||||||
if (tile instanceof TileController) {
|
if (tile instanceof TileController) {
|
||||||
@@ -191,6 +191,22 @@ public class ItemWirelessGrid extends ItemEnergyContainer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) {
|
public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) {
|
||||||
|
if (oldStack.getItem() == newStack.getItem()) {
|
||||||
|
if (hasValidNBT(oldStack) && hasValidNBT(newStack)) {
|
||||||
|
int x1 = getX(oldStack);
|
||||||
|
int y1 = getY(oldStack);
|
||||||
|
int z1 = getZ(oldStack);
|
||||||
|
int dim1 = getDimensionId(oldStack);
|
||||||
|
int x2 = getX(newStack);
|
||||||
|
int y2 = getY(newStack);
|
||||||
|
int z2 = getZ(newStack);
|
||||||
|
int dim2 = getDimensionId(newStack);
|
||||||
|
|
||||||
|
if (x1 == x2 && y1 == y2 && z1 == z2 && dim1 == dim2) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return slotChanged;
|
return slotChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Reference in New Issue
Block a user