diff --git a/src/main/java/appeng/api/config/Upgrades.java b/src/main/java/appeng/api/config/Upgrades.java index dd7827eb735..da995a2d4a0 100644 --- a/src/main/java/appeng/api/config/Upgrades.java +++ b/src/main/java/appeng/api/config/Upgrades.java @@ -43,7 +43,8 @@ public enum Upgrades { PATTERN_CAPACITY(1), ORE_FILTER(1), ADVANCED_BLOCKING(1), - LOCK_CRAFTING(1); + LOCK_CRAFTING(1), + FAKE_CRAFTING(1); /** * @deprecated use {@link Upgrades#getTier()} diff --git a/src/main/java/appeng/api/definitions/IMaterials.java b/src/main/java/appeng/api/definitions/IMaterials.java index f17fc6012dd..d2cc7dfa14b 100644 --- a/src/main/java/appeng/api/definitions/IMaterials.java +++ b/src/main/java/appeng/api/definitions/IMaterials.java @@ -149,4 +149,6 @@ public interface IMaterials { IItemDefinition cardAdvancedBlocking(); IItemDefinition cardLockCrafting(); + + IItemDefinition cardFakeCrafting(); } diff --git a/src/main/java/appeng/core/Registration.java b/src/main/java/appeng/core/Registration.java index e17bd2f3d09..8b72dcd80e5 100644 --- a/src/main/java/appeng/core/Registration.java +++ b/src/main/java/appeng/core/Registration.java @@ -611,6 +611,8 @@ void postInit(final FMLPostInitializationEvent event) { Upgrades.PATTERN_CAPACITY.registerItem(parts.p2PTunnelMEInterface(), 3); Upgrades.ADVANCED_BLOCKING.registerItem(parts.iface(), 1); Upgrades.ADVANCED_BLOCKING.registerItem(blocks.iface(), 1); + Upgrades.FAKE_CRAFTING.registerItem(parts.iface(), 1); + Upgrades.FAKE_CRAFTING.registerItem(blocks.iface(), 1); Upgrades.LOCK_CRAFTING.registerItem(parts.iface(), 1); Upgrades.LOCK_CRAFTING.registerItem(blocks.iface(), 1); Upgrades.LOCK_CRAFTING.registerItem(parts.p2PTunnelMEInterface(), 1); diff --git a/src/main/java/appeng/core/api/definitions/ApiMaterials.java b/src/main/java/appeng/core/api/definitions/ApiMaterials.java index f707621f96d..8e629c3a134 100644 --- a/src/main/java/appeng/core/api/definitions/ApiMaterials.java +++ b/src/main/java/appeng/core/api/definitions/ApiMaterials.java @@ -76,6 +76,7 @@ public final class ApiMaterials implements IMaterials { private final IItemDefinition cardPatternRefiller; private final IItemDefinition cardAdvancedBlocking; private final IItemDefinition cardLockCrafting; + private final IItemDefinition cardFakeCrafting; private final IItemDefinition enderDust; private final IItemDefinition flour; private final IItemDefinition goldDust; @@ -181,6 +182,8 @@ public ApiMaterials(final DefinitionConstructor constructor) { itemMultiMaterial.createMaterial(MaterialType.CardAdvancedBlocking)); this.cardLockCrafting = new DamagedItemDefinition( itemMultiMaterial.createMaterial(MaterialType.CardLockCrafting)); + this.cardFakeCrafting = new DamagedItemDefinition( + itemMultiMaterial.createMaterial(MaterialType.CardFakeCrafting)); this.enderDust = new DamagedItemDefinition(itemMultiMaterial.createMaterial(MaterialType.EnderDust)); this.flour = new DamagedItemDefinition(itemMultiMaterial.createMaterial(MaterialType.Flour)); @@ -546,4 +549,9 @@ public IItemDefinition cardAdvancedBlocking() { public IItemDefinition cardLockCrafting() { return this.cardLockCrafting; } + + @Override + public IItemDefinition cardFakeCrafting() { + return this.cardFakeCrafting; + } } diff --git a/src/main/java/appeng/helpers/DualityInterface.java b/src/main/java/appeng/helpers/DualityInterface.java index cbc6679890b..bc7ca4bd794 100644 --- a/src/main/java/appeng/helpers/DualityInterface.java +++ b/src/main/java/appeng/helpers/DualityInterface.java @@ -1038,6 +1038,10 @@ private InsertionMode getInsertionMode() { return (InsertionMode) cm.getSetting(Settings.INSERTION_MODE); } + public boolean isFakeCraftingMode() { + return this.getInstalledUpgrades(Upgrades.FAKE_CRAFTING) != 0; + } + private static boolean acceptsItems(final InventoryAdaptor ad, final InventoryCrafting table, final InsertionMode insertionMode) { for (int x = 0; x < table.getSizeInventory(); x++) { diff --git a/src/main/java/appeng/items/materials/ItemMultiMaterial.java b/src/main/java/appeng/items/materials/ItemMultiMaterial.java index 5c2d6ff2381..7a98f9ac463 100644 --- a/src/main/java/appeng/items/materials/ItemMultiMaterial.java +++ b/src/main/java/appeng/items/materials/ItemMultiMaterial.java @@ -145,6 +145,7 @@ public Upgrades getType(final ItemStack itemstack) { case CardAdvancedBlocking -> Upgrades.ADVANCED_BLOCKING; case CardLockCrafting -> Upgrades.LOCK_CRAFTING; case CardSticky -> Upgrades.STICKY; + case CardFakeCrafting -> Upgrades.FAKE_CRAFTING; default -> null; }; } diff --git a/src/main/java/appeng/items/materials/MaterialType.java b/src/main/java/appeng/items/materials/MaterialType.java index 7bfb1cb0c66..2097b10a64c 100644 --- a/src/main/java/appeng/items/materials/MaterialType.java +++ b/src/main/java/appeng/items/materials/MaterialType.java @@ -117,7 +117,8 @@ public enum MaterialType { CardPatternRefiller(62), CardAdvancedBlocking(63), CardSticky(64), - CardLockCrafting(65); + CardLockCrafting(65), + CardFakeCrafting(66); private final EnumSet features; // IIcon for the material. diff --git a/src/main/java/appeng/me/cluster/implementations/CraftingCPUCluster.java b/src/main/java/appeng/me/cluster/implementations/CraftingCPUCluster.java index b71e8b9184d..a37e7f694c2 100644 --- a/src/main/java/appeng/me/cluster/implementations/CraftingCPUCluster.java +++ b/src/main/java/appeng/me/cluster/implementations/CraftingCPUCluster.java @@ -145,6 +145,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU { private boolean isComplete = true; private int remainingOperations; private boolean somethingChanged; + private boolean isFakeCrafting; private long lastTime; private long elapsedTime; @@ -497,6 +498,7 @@ private void completeJob() { } craftCompleteListeners.forEach(f -> f.apply(this.finalOutput.getItemStack(), this.numsOfOutput, elapsedTime)); + this.isFakeCrafting = false; this.usedStorage = 0; this.remainingItemCount = 0; this.startItemCount = 0; @@ -688,6 +690,21 @@ public void updateCraftingLogic(final IGrid grid, final IEnergyGrid eg, final Cr if (this.remainingOperations > 0 && !this.somethingChanged) { this.waiting = true; } + + if (this.isFakeCrafting) { + final IAEItemStack is = this.waitingFor.findPrecise(this.finalOutput); + if (is != null) { + long stackSize = is.getStackSize(); + is.decStackSize(stackSize); + this.markDirty(); + this.postCraftingStatusChange(is); + this.finalOutput.decStackSize(stackSize); + if (this.finalOutput.getStackSize() <= 0) { + this.completeJob(); + } + this.updateCPU(); + } + } } private void executeCrafting(final IEnergyGrid eg, final CraftingGridCache cc) { @@ -787,6 +804,7 @@ private void executeCrafting(final IEnergyGrid eg, final CraftingGridCache cc) { this.somethingChanged = true; this.remainingOperations--; pushedPattern = true; + this.isFakeCrafting = (m instanceof DualityInterface di && di.isFakeCraftingMode()); for (final IAEItemStack out : details.getCondensedOutputs()) { this.postChange(out, this.machineSrc); @@ -816,7 +834,6 @@ private void executeCrafting(final IEnergyGrid eg, final CraftingGridCache cc) { Platform.getPlayer((WorldServer) this.getWorld()), details.getOutput(ic, this.getWorld()), ic); - for (int x = 0; x < ic.getSizeInventory(); x++) { final ItemStack output = Platform.getContainerItem(ic.getStackInSlot(x)); if (output != null) { @@ -934,6 +951,7 @@ public ICraftingLink submitJob(final IGrid g, final ICraftingJob job, final Base // when it comes to a new craft, if (job.getOutput() != null) { this.finalOutput = job.getOutput(); + this.isFakeCrafting = false; this.waiting = false; this.isComplete = false; this.usedStorage = job.getByteTotal(); diff --git a/src/main/java/appeng/parts/automation/UpgradeInventory.java b/src/main/java/appeng/parts/automation/UpgradeInventory.java index 65fef7aee16..6c9a88c01e1 100644 --- a/src/main/java/appeng/parts/automation/UpgradeInventory.java +++ b/src/main/java/appeng/parts/automation/UpgradeInventory.java @@ -38,6 +38,7 @@ public abstract class UpgradeInventory extends AppEngInternalInventory implement private int patternCapacityUpgrades = 0; private int advancedBlockingUpgrades = 0; private int lockCraftingUpgrades = 0; + private int fakeCraftingUpgrades = 0; private int stickyUpgrades = 0; public UpgradeInventory(final IAEAppEngInventory parent, final int s) { @@ -89,6 +90,7 @@ public int getInstalledUpgrades(final Upgrades u) { case ADVANCED_BLOCKING -> this.advancedBlockingUpgrades; case LOCK_CRAFTING -> this.lockCraftingUpgrades; case STICKY -> this.stickyUpgrades; + case FAKE_CRAFTING -> this.fakeCraftingUpgrades; default -> 0; }; } @@ -97,7 +99,7 @@ public int getInstalledUpgrades(final Upgrades u) { private void updateUpgradeInfo() { this.cached = true; - this.patternCapacityUpgrades = this.stickyUpgrades = this.inverterUpgrades = this.capacityUpgrades = this.redstoneUpgrades = this.speedUpgrades = this.superSpeedUpgrades = this.fuzzyUpgrades = this.craftingUpgrades = this.oreFilterUpgrades = this.advancedBlockingUpgrades = this.lockCraftingUpgrades = 0; + this.patternCapacityUpgrades = this.stickyUpgrades = this.inverterUpgrades = this.capacityUpgrades = this.redstoneUpgrades = this.speedUpgrades = this.superSpeedUpgrades = this.fuzzyUpgrades = this.craftingUpgrades = this.oreFilterUpgrades = this.advancedBlockingUpgrades = this.lockCraftingUpgrades = this.fakeCraftingUpgrades = 0; for (final ItemStack is : this) { if (is == null || is.getItem() == null || !(is.getItem() instanceof IUpgradeModule)) { @@ -118,6 +120,7 @@ private void updateUpgradeInfo() { case ADVANCED_BLOCKING -> this.advancedBlockingUpgrades++; case LOCK_CRAFTING -> this.lockCraftingUpgrades++; case STICKY -> this.stickyUpgrades++; + case FAKE_CRAFTING -> this.fakeCraftingUpgrades++; default -> {} } } @@ -135,6 +138,7 @@ private void updateUpgradeInfo() { this.advancedBlockingUpgrades = Math .min(this.advancedBlockingUpgrades, this.getMaxInstalled(Upgrades.ADVANCED_BLOCKING)); this.lockCraftingUpgrades = Math.min(this.lockCraftingUpgrades, this.getMaxInstalled(Upgrades.LOCK_CRAFTING)); + this.fakeCraftingUpgrades = Math.min(this.fakeCraftingUpgrades, this.getMaxInstalled(Upgrades.FAKE_CRAFTING)); this.stickyUpgrades = Math.min(this.stickyUpgrades, this.getMaxInstalled(Upgrades.STICKY)); } diff --git a/src/main/resources/assets/appliedenergistics2/lang/en_US.lang b/src/main/resources/assets/appliedenergistics2/lang/en_US.lang index ee615767977..46c8cb4a719 100644 --- a/src/main/resources/assets/appliedenergistics2/lang/en_US.lang +++ b/src/main/resources/assets/appliedenergistics2/lang/en_US.lang @@ -626,6 +626,7 @@ item.appliedenergistics2.ItemMaterial.CardPatternRefiller.name=Pattern Refiller item.appliedenergistics2.ItemMaterial.CardAdvancedBlocking.name=Advanced Blocking Card item.appliedenergistics2.ItemMaterial.CardLockCrafting.name=Locking Card item.appliedenergistics2.ItemMaterial.CardSticky.name=Sticky Card +item.appliedenergistics2.ItemMaterial.CardFakeCrafting.name=Fake Crafting Card item.appliedenergistics2.ItemMaterial.Cell2SpatialPart.name=2³ Spatial Component item.appliedenergistics2.ItemMaterial.Cell16SpatialPart.name=16³ Spatial Component diff --git a/src/main/resources/assets/appliedenergistics2/lang/zh_CN.lang b/src/main/resources/assets/appliedenergistics2/lang/zh_CN.lang index 68343ff299a..c48e2735603 100644 --- a/src/main/resources/assets/appliedenergistics2/lang/zh_CN.lang +++ b/src/main/resources/assets/appliedenergistics2/lang/zh_CN.lang @@ -620,6 +620,7 @@ item.appliedenergistics2.ItemMaterial.CardPatternRefiller.name=空白样板重 item.appliedenergistics2.ItemMaterial.CardAdvancedBlocking.name=高级阻挡卡 item.appliedenergistics2.ItemMaterial.CardLockCrafting.name=Locking Card item.appliedenergistics2.ItemMaterial.CardSticky.name=粘性卡 +item.appliedenergistics2.ItemMaterial.CardFakeCrafting.name=伪合成卡 item.appliedenergistics2.ItemMaterial.Cell2SpatialPart.name=2³-空间组件 item.appliedenergistics2.ItemMaterial.Cell16SpatialPart.name=16³-空间组件 diff --git a/src/main/resources/assets/appliedenergistics2/textures/items/ItemMaterial.CardFakeCrafting.png b/src/main/resources/assets/appliedenergistics2/textures/items/ItemMaterial.CardFakeCrafting.png new file mode 100644 index 00000000000..4e0c11553e4 Binary files /dev/null and b/src/main/resources/assets/appliedenergistics2/textures/items/ItemMaterial.CardFakeCrafting.png differ