Merge pull request #4442 from AppliedEnergistics/cleanups

Reduce Importance of PartType and Fix Upgrade Card Tooltip Grouping
This commit is contained in:
shartte
2020-07-02 09:41:00 +02:00
committed by GitHub
18 changed files with 368 additions and 596 deletions
@@ -31,7 +31,6 @@ import net.minecraft.crash.CrashReportCategory;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.PacketBuffer;
@@ -67,8 +66,6 @@ import appeng.api.util.DimensionalCoord;
import appeng.api.util.IConfigManager;
import appeng.helpers.ICustomNameObject;
import appeng.helpers.IPriorityHost;
import appeng.items.parts.PartItem;
import appeng.items.parts.PartType;
import appeng.me.helpers.AENetworkProxy;
import appeng.me.helpers.IGridProxyable;
import appeng.parts.networking.CablePart;
@@ -96,15 +93,6 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
return this.host;
}
public PartType getType() {
Item item = this.is.getItem();
if (!(item instanceof PartItem)) {
return PartType.INVALID_TYPE;
}
return ((PartItem<?>) item).getType();
}
@Override
public IGridNode getGridNode(final AEPartLocation dir) {
return this.proxy.getNode();
@@ -36,17 +36,12 @@ public class BlockUpgradeInventory extends UpgradeInventory {
@Override
public int getMaxInstalled(final Upgrades upgrades) {
int max = 0;
for (final ItemStack is : upgrades.getSupported().keySet()) {
final Item encodedItem = is.getItem();
if (encodedItem instanceof BlockItem && Block.getBlockFromItem(encodedItem) == this.block) {
max = upgrades.getSupported().get(is);
break;
for (final Upgrades.Supported supported : upgrades.getSupported()) {
if (supported.isSupported(block)) {
return supported.getMaxCount();
}
}
return max;
return 0;
}
}
@@ -35,15 +35,12 @@ public final class DefinitionUpgradeInventory extends UpgradeInventory {
@Override
public int getMaxInstalled(final Upgrades upgrades) {
int max = 0;
for (final ItemStack stack : upgrades.getSupported().keySet()) {
if (this.definition.isSameAs(stack)) {
max = upgrades.getSupported().get(stack);
break;
for (final Upgrades.Supported supported : upgrades.getSupported()) {
if (supported.isSupported(definition.item())) {
return supported.getMaxCount();
}
}
return max;
return 0;
}
}
@@ -33,15 +33,12 @@ public class StackUpgradeInventory extends UpgradeInventory {
@Override
public int getMaxInstalled(final Upgrades upgrades) {
int max = 0;
for (final ItemStack is : upgrades.getSupported().keySet()) {
if (ItemStack.areItemsEqual(this.stack, is)) {
max = upgrades.getSupported().get(is);
break;
for (final Upgrades.Supported supported : upgrades.getSupported()) {
if (supported.isSupported(stack.getItem())) {
return supported.getMaxCount();
}
}
return max;
return 0;
}
}