fix copy-pasting interfaces with memory cards between interfaces with differing amount of expansion cards

This commit is contained in:
PrototypeTrousers
2023-07-04 23:57:12 -03:00
parent d407ec4922
commit f631858be6
2 changed files with 5 additions and 3 deletions
@@ -305,6 +305,7 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
PlayerMainInvWrapper playerInv = new PlayerMainInvWrapper(player.inventory);
final IMaterials materials = AEApi.instance().definitions().materials();
int missingPatternsToEncode = 0;
int amountPatternSlots = 8 + this.getInstalledUpgrades(Upgrades.PATTERN_EXPANSION) * 9;
for (int i = 0; i < inv.getSlots(); i++) {
if (target.getStackInSlot(i).getItem() instanceof ItemEncodedPattern) {
@@ -316,7 +317,7 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
}
}
for (int x = 0; x < tmp.getSlots(); x++) {
for (int x = 0; x < amountPatternSlots; x++) {
if (!tmp.getStackInSlot(x).isEmpty()) {
boolean found = false;
for (int i = 0; i < playerInv.getSlots(); i++) {
@@ -343,6 +343,7 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, II
PlayerMainInvWrapper playerInv = new PlayerMainInvWrapper(player.inventory);
final IMaterials materials = AEApi.instance().definitions().materials();
int missingPatternsToEncode = 0;
int amountPatternSlots = 8 + this.getInstalledUpgrades(Upgrades.PATTERN_EXPANSION) * 9;
for (int i = 0; i < inv.getSlots(); i++) {
if (target.getStackInSlot(i).getItem() instanceof ItemEncodedPattern) {
@@ -354,8 +355,7 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, II
}
}
for (int x = 0; x < tmp.getSlots(); x++) {
for (int x = 0; x < amountPatternSlots; x++) {
if (!tmp.getStackInSlot(x).isEmpty()) {
boolean found = false;
for (int i = 0; i < playerInv.getSlots(); i++) {
@@ -371,6 +371,7 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, II
}
}
}
if (Platform.isServer() && missingPatternsToEncode > 0) {
player.sendMessage(PlayerMessages.MissingPatternsToEncode.get());
}