mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-10-26 14:24:23 +00:00
quick copy paste (#341)
This commit is contained in:
1 parent
03140c9d9a
commit
7aaa651632
2 files changed
+67
-39
No files matched your search
+1
-1
@@ -35,7 +35,7 @@
|
|||||||
*/
|
*/
|
||||||
dependencies {
|
dependencies {
|
||||||
api('com.github.GTNewHorizons:NotEnoughItems:2.8.6-GTNH:dev')
|
api('com.github.GTNewHorizons:NotEnoughItems:2.8.6-GTNH:dev')
|
||||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-711-GTNH:dev')
|
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-717-GTNH:dev')
|
||||||
api('curse.maven:cofh-core-69162:2388751')
|
api('curse.maven:cofh-core-69162:2388751')
|
||||||
api('com.github.GTNewHorizons:waila:1.9.0:dev')
|
api('com.github.GTNewHorizons:waila:1.9.0:dev')
|
||||||
api("com.github.GTNewHorizons:GTNHLib:0.7.0:dev")
|
api("com.github.GTNewHorizons:GTNHLib:0.7.0:dev")
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import com.google.common.collect.ImmutableSet;
|
|||||||
|
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.config.Upgrades;
|
import appeng.api.config.Upgrades;
|
||||||
|
import appeng.api.implementations.items.IMemoryCard;
|
||||||
import appeng.api.implementations.tiles.ITileStorageMonitorable;
|
import appeng.api.implementations.tiles.ITileStorageMonitorable;
|
||||||
import appeng.api.networking.IGridNode;
|
import appeng.api.networking.IGridNode;
|
||||||
import appeng.api.networking.crafting.ICraftingLink;
|
import appeng.api.networking.crafting.ICraftingLink;
|
||||||
@@ -48,7 +49,6 @@ import appeng.api.networking.security.BaseActionSource;
|
|||||||
import appeng.api.networking.ticking.IGridTickable;
|
import appeng.api.networking.ticking.IGridTickable;
|
||||||
import appeng.api.networking.ticking.TickRateModulation;
|
import appeng.api.networking.ticking.TickRateModulation;
|
||||||
import appeng.api.networking.ticking.TickingRequest;
|
import appeng.api.networking.ticking.TickingRequest;
|
||||||
import appeng.api.parts.IPart;
|
|
||||||
import appeng.api.storage.IMEMonitor;
|
import appeng.api.storage.IMEMonitor;
|
||||||
import appeng.api.storage.IStorageMonitorable;
|
import appeng.api.storage.IStorageMonitorable;
|
||||||
import appeng.api.storage.data.IAEFluidStack;
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
@@ -307,9 +307,13 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void pasteMemoryCardData(PartP2PTunnel<?> newTunnel, NBTTagCompound data) throws GridAccessException {
|
public PartP2PTunnel<?> applyMemoryCard(EntityPlayer player, IMemoryCard memoryCard, ItemStack is) {
|
||||||
this.duality.getConfigManager().readFromNBT(data);
|
PartP2PTunnel<?> newTunnel = super.applyMemoryCard(player, memoryCard, is);
|
||||||
super.pasteMemoryCardData(newTunnel, data);
|
NBTTagCompound data = memoryCard.getData(is);
|
||||||
|
if (newTunnel instanceof PartFluidP2PInterface p2PInterface) {
|
||||||
|
p2PInterface.duality.getConfigManager().readFromNBT(data);
|
||||||
|
}
|
||||||
|
return newTunnel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -345,41 +349,7 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPartActivate(final EntityPlayer p, final Vec3 pos) {
|
public boolean onPartActivate(final EntityPlayer p, final Vec3 pos) {
|
||||||
AppEngInternalInventory patterns = this.duality.getPatterns();
|
|
||||||
|
|
||||||
if (super.onPartActivate(p, pos)) {
|
if (super.onPartActivate(p, pos)) {
|
||||||
ArrayList<ItemStack> drops = new ArrayList<>();
|
|
||||||
for (int i = 0; i < patterns.getSizeInventory(); i++) {
|
|
||||||
if (patterns.getStackInSlot(i) == null) continue;
|
|
||||||
drops.add(patterns.getStackInSlot(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
final IPart tile = this.getHost().getPart(this.getSide());
|
|
||||||
if (tile instanceof PartFluidP2PInterface dualTile) {
|
|
||||||
DualityInterface newDuality = dualTile.duality;
|
|
||||||
// Copy interface storage, upgrades, and settings over
|
|
||||||
UpgradeInventory upgrades = (UpgradeInventory) duality.getInventoryByName("upgrades");
|
|
||||||
dualTile.duality.getStorage();
|
|
||||||
UpgradeInventory newUpgrade = (UpgradeInventory) newDuality.getInventoryByName("upgrades");
|
|
||||||
for (int i = 0; i < upgrades.getSizeInventory(); ++i) {
|
|
||||||
newUpgrade.setInventorySlotContents(i, upgrades.getStackInSlot(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!duality.sharedInventory) {
|
|
||||||
IInventory storage = duality.getStorage();
|
|
||||||
IInventory newStorage = newDuality.getStorage();
|
|
||||||
for (int i = 0; i < storage.getSizeInventory(); ++i) {
|
|
||||||
newStorage.setInventorySlotContents(i, storage.getStackInSlot(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IConfigManager config = duality.getConfigManager();
|
|
||||||
config.getSettings().forEach(
|
|
||||||
setting -> newDuality.getConfigManager().putSetting(setting, config.getSetting(setting)));
|
|
||||||
}
|
|
||||||
TileEntity te = getTileEntity();
|
|
||||||
Platform.spawnDrops(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, drops);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -399,6 +369,64 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void dropPatterns(final PartFluidP2PInterface p2p) {
|
||||||
|
final AppEngInternalInventory patterns = p2p.duality.getPatterns();
|
||||||
|
final List<ItemStack> drops = new ArrayList<>();
|
||||||
|
for (int i = 0; i < patterns.getSizeInventory(); i++) {
|
||||||
|
if (patterns.getStackInSlot(i) == null) continue;
|
||||||
|
drops.add(patterns.getStackInSlot(i));
|
||||||
|
}
|
||||||
|
if (!drops.isEmpty()) {
|
||||||
|
final TileEntity te = p2p.getTileEntity();
|
||||||
|
Platform.spawnDrops(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, drops);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void copyContents(final PartP2PTunnel<?> from) {
|
||||||
|
if (from instanceof PartFluidP2PInterface fromInterface) {
|
||||||
|
DualityInterface newDuality = this.duality;
|
||||||
|
// Copy interface storage, upgrades, and settings over
|
||||||
|
UpgradeInventory upgrades = (UpgradeInventory) fromInterface.duality.getInventoryByName("upgrades");
|
||||||
|
UpgradeInventory newUpgrade = (UpgradeInventory) newDuality.getInventoryByName("upgrades");
|
||||||
|
for (int i = 0; i < upgrades.getSizeInventory(); ++i) {
|
||||||
|
newUpgrade.setInventorySlotContents(i, upgrades.getStackInSlot(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!fromInterface.duality.sharedInventory) {
|
||||||
|
IInventory storage = fromInterface.duality.getStorage();
|
||||||
|
IInventory newStorage = newDuality.getStorage();
|
||||||
|
for (int i = 0; i < storage.getSizeInventory(); ++i) {
|
||||||
|
newStorage.setInventorySlotContents(i, storage.getStackInSlot(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
AppEngInternalInventory patterns = fromInterface.duality.getPatterns();
|
||||||
|
boolean drop = true;
|
||||||
|
if (!from.isOutput() && !this.isOutput()) { // input to input
|
||||||
|
for (int i = 0; i < patterns.getSizeInventory(); i++) {
|
||||||
|
newDuality.getPatterns().setInventorySlotContents(i, patterns.getStackInSlot(i));
|
||||||
|
}
|
||||||
|
drop = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (drop) {
|
||||||
|
this.dropPatterns(fromInterface);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void copySettings(final PartP2PTunnel<?> from) {
|
||||||
|
if (from instanceof PartFluidP2PInterface fromInterface) {
|
||||||
|
DualityInterface newDuality = this.duality;
|
||||||
|
|
||||||
|
IConfigManager config = fromInterface.duality.getConfigManager();
|
||||||
|
config.getSettings()
|
||||||
|
.forEach(setting -> newDuality.getConfigManager().putSetting(setting, config.getSetting(setting)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getBreakingTexture() {
|
public IIcon getBreakingTexture() {
|
||||||
return this.getItemStack().getIconIndex();
|
return this.getItemStack().getIconIndex();
|
||||||
|
|||||||
Reference in new issue
Block a user