mirror of
https://github.com/GTNewHorizons/Applied-Energistics-2-Unofficial.git
synced 2026-10-25 20:22:23 +00:00
Disassemble cells (#1271)
This commit is contained in:
1 parent
f7803ec420
commit
06c3bdd87b
2 files changed
+22
-16
No files matched your search
+3
-3
@@ -28,7 +28,7 @@ dependencies {
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.10.22:dev') { transitive = false }
|
||||
compileOnly(rfg.deobf('curse.maven:mekanism-268560:2475797')) // https://www.curseforge.com/minecraft/mc-mods/mekanism/files/2475797
|
||||
compileOnly(rfg.deobf('maven.modrinth:immibis-microblocks:59.1.2')) // https://modrinth.com/mod/immibis-microblocks/version/59.1.2
|
||||
compileOnly('com.github.GTNewHorizons:AE2FluidCraft-Rework:1.5.71-gtnh:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:AE2FluidCraft-Rework:1.5.81-gtnh:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:ae2stuff:0.10.19-GTNH:dev') {
|
||||
exclude module: "Applied-Energistics-2-Unofficial"
|
||||
}
|
||||
@@ -62,8 +62,8 @@ dependencies {
|
||||
runtimeOnlyNonPublishable('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') {
|
||||
exclude module: "Baubles"
|
||||
}
|
||||
runtimeOnlyNonPublishable('com.github.GTNewHorizons:ThaumicEnergistics:1.7.41-GTNH:dev') { transitive = false }
|
||||
runtimeOnlyNonPublishable('com.github.GTNewHorizons:AE2FluidCraft-Rework:1.5.71-gtnh:dev') { transitive = false }
|
||||
runtimeOnlyNonPublishable('com.github.GTNewHorizons:ThaumicEnergistics:1.7.47-GTNH:dev') { transitive = false }
|
||||
runtimeOnlyNonPublishable('com.github.GTNewHorizons:AE2FluidCraft-Rework:1.5.81-gtnh:dev') { transitive = false }
|
||||
runtimeOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughEnergistics:1.7.26:dev') {
|
||||
exclude module: "Applied-Energistics-2-Unofficial"
|
||||
exclude module: "waila"
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package appeng.items;
|
||||
|
||||
import static appeng.util.item.AEItemStackType.ITEM_STACK_TYPE;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
@@ -36,7 +34,6 @@ import appeng.api.implementations.items.IUpgradeModule;
|
||||
import appeng.api.storage.ICellHandler;
|
||||
import appeng.api.storage.ICellInventoryHandler;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IAEStackType;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
@@ -320,16 +317,20 @@ public abstract class AEBaseCell extends AEBaseItem implements IStorageCell, IIt
|
||||
}
|
||||
final InventoryPlayer playerInventory = player.inventory;
|
||||
final IMEInventoryHandler inv = AEApi.instance().registries().cell()
|
||||
.getCellInventory(stack, null, ITEM_STACK_TYPE);
|
||||
.getCellInventory(stack, null, this.getStackType());
|
||||
if (inv != null && playerInventory.getCurrentItem() == stack) {
|
||||
final InventoryAdaptor ia = InventoryAdaptor.getAdaptor(player, ForgeDirection.UNKNOWN);
|
||||
final IItemList<IAEItemStack> list = inv
|
||||
.getAvailableItems(ITEM_STACK_TYPE.createList(), IterationCounter.fetchNewId());
|
||||
final IItemList<?> list = inv
|
||||
.getAvailableItems(this.getStackType().createList(), IterationCounter.fetchNewId());
|
||||
if (list.isEmpty() && ia != null) {
|
||||
playerInventory.setInventorySlotContents(playerInventory.currentItem, null);
|
||||
|
||||
final ItemStack comp = this.getComponent();
|
||||
|
||||
if (comp == null) return false;
|
||||
|
||||
// drop core
|
||||
final ItemStack extraB = ia.addItems(this.component.stack(1));
|
||||
final ItemStack extraB = ia.addItems(comp);
|
||||
if (extraB != null) {
|
||||
player.dropPlayerItemWithRandomChoice(extraB, false);
|
||||
}
|
||||
@@ -345,12 +346,9 @@ public abstract class AEBaseCell extends AEBaseItem implements IStorageCell, IIt
|
||||
}
|
||||
|
||||
// drop empty storage cell case
|
||||
for (final ItemStack storageCellStack : getStorageCellCase().maybeStack(1).asSet()) {
|
||||
final ItemStack extraA = ia.addItems(storageCellStack);
|
||||
if (extraA != null) {
|
||||
player.dropPlayerItemWithRandomChoice(extraA, false);
|
||||
}
|
||||
}
|
||||
final ItemStack storageCellStack = this.getHousing();
|
||||
final ItemStack extraA = ia.addItems(storageCellStack);
|
||||
if (extraA != null) player.dropPlayerItemWithRandomChoice(extraA, false);
|
||||
|
||||
if (player.inventoryContainer != null) {
|
||||
player.inventoryContainer.detectAndSendChanges();
|
||||
@@ -363,6 +361,14 @@ public abstract class AEBaseCell extends AEBaseItem implements IStorageCell, IIt
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemStack getHousing() {
|
||||
return this.getStorageCellCase().maybeStack(1).orNull();
|
||||
}
|
||||
|
||||
public ItemStack getComponent() {
|
||||
return this.component.stack(1);
|
||||
}
|
||||
|
||||
protected IItemDefinition getStorageCellCase() {
|
||||
return AEApi.instance().definitions().materials().emptyStorageCell();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user