mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-23 13:30:04 +00:00
Compare commits
35
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e98976cdac | ||
|
|
51874d4b59 | ||
|
|
9f20656711 | ||
|
|
48bb05cb19 | ||
|
|
536c922c5a | ||
|
|
fc165a7f6f | ||
|
|
5079ba1d70 | ||
|
|
b2be6bca47 | ||
|
|
49adbe3271 | ||
|
|
40a086ce16 | ||
|
|
4a5e763170 | ||
|
|
a3392db769 | ||
|
|
877316fcb3 | ||
|
|
cc1718c9b0 | ||
|
|
83054a773a | ||
|
|
a90fab0318 | ||
|
|
68c0fb6797 | ||
|
|
e585e6779f | ||
|
|
e32da01619 | ||
|
|
bd4644dd01 | ||
|
|
b2a5c95974 | ||
|
|
31e88fa1ff | ||
|
|
880c5d3d70 | ||
|
|
5907154d8e | ||
|
|
5092dcc3d3 | ||
|
|
8d9a9c7e8c | ||
|
|
0f9796b73c | ||
|
|
bd128f59db | ||
|
|
e187ef370e | ||
|
|
2876db6772 | ||
|
|
51d6de3242 | ||
|
|
30c3ab100d | ||
|
|
d0005adcf8 | ||
|
|
0cd4f49d50 | ||
|
|
b6b03cfbd8 |
No files matched your search
+5
-5
@@ -34,8 +34,8 @@
|
||||
* For more details, see https://docs.gradle.org/8.0.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph
|
||||
*/
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:NotEnoughItems:2.7.15-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-518-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:NotEnoughItems:2.7.18-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-520-GTNH-pre:dev')
|
||||
api('curse.maven:cofh-core-69162:2388751')
|
||||
api('com.github.GTNewHorizons:waila:1.8.2:dev')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.6.1:dev")
|
||||
@@ -49,15 +49,15 @@ dependencies {
|
||||
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.35:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.10.1:dev')
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.9.2:dev')
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.61:dev') {
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.67:dev') {
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'AE2FluidCraft-Rework'
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial'
|
||||
}
|
||||
|
||||
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
|
||||
compileOnly('com.gregoriust.gregtech:gregtech_1.7.10:6.14.23:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.11.3-GTNH:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.7.2-GTNH:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.11.4-GTNH:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.7.4-GTNH:dev') { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.6.13:dev") { transitive = false }
|
||||
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.3.4:dev")
|
||||
|
||||
@@ -81,6 +81,7 @@ public class FluidCraft {
|
||||
RecipeLoader.addInfiniteWaterCell();
|
||||
}
|
||||
RecipeLoader.runTerminalRecipe();
|
||||
RecipeLoader.addDisassembleRecipe();
|
||||
|
||||
if (ModAndClassUtil.isV2) {
|
||||
CalculatorV2PluginLoader.installCalculatorV2Plugins();
|
||||
|
||||
@@ -587,6 +587,18 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
|
||||
memoryText = this.searchField.getText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleKeyboardInput() {
|
||||
super.handleKeyboardInput();
|
||||
|
||||
// Pause the terminal when holding shift
|
||||
this.repo.setPaused(hasShiftDown());
|
||||
}
|
||||
|
||||
private boolean hasShiftDown() {
|
||||
return Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
|
||||
}
|
||||
|
||||
public void bindTextureBack(final String file) {
|
||||
final ResourceLocation loc = new ResourceLocation(FluidCraft.MODID, "textures/" + file);
|
||||
this.mc.getTextureManager().bindTexture(loc);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.glodblock.github.client.me;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.crossmod.thaumcraft.AspectUtil;
|
||||
@@ -15,7 +15,6 @@ import appeng.api.config.SearchBoxMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.SortOrder;
|
||||
import appeng.api.config.ViewItems;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.gui.widgets.IScrollSource;
|
||||
import appeng.client.gui.widgets.ISortSource;
|
||||
@@ -30,12 +29,61 @@ public class EssentiaRepo extends FluidRepo {
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void updateView() {
|
||||
this.view.clear();
|
||||
if (this.paused) {
|
||||
// Update existing view with new data
|
||||
for (int i = 0; i < this.view.size(); i++) {
|
||||
IAEItemStack entry = this.view.get(i);
|
||||
IAEItemStack serverEntry = this.list.findPrecise(entry);
|
||||
if (serverEntry == null) {
|
||||
entry.setStackSize(0);
|
||||
} else {
|
||||
this.view.set(i, serverEntry);
|
||||
}
|
||||
}
|
||||
|
||||
// Append newly added item stacks to the end of the view
|
||||
Set<IAEItemStack> viewSet = new HashSet<>(this.view);
|
||||
ArrayList<IAEItemStack> entriesToAdd = new ArrayList<>();
|
||||
for (IAEItemStack serverEntry : this.list) {
|
||||
if (!viewSet.contains(serverEntry)) {
|
||||
entriesToAdd.add(serverEntry);
|
||||
}
|
||||
}
|
||||
addEntriesToView(entriesToAdd);
|
||||
} else {
|
||||
this.view.clear();
|
||||
this.view.ensureCapacity(this.list.size());
|
||||
addEntriesToView(this.list);
|
||||
}
|
||||
|
||||
// Do not sort if paused
|
||||
if (!this.paused) {
|
||||
final Enum<?> SortBy = this.sortSrc.getSortBy();
|
||||
final Enum<?> SortDir = this.sortSrc.getSortDir();
|
||||
|
||||
FluidSorters.setDirection((appeng.api.config.SortDir) SortDir);
|
||||
FluidSorters.init();
|
||||
|
||||
if (SortBy == SortOrder.MOD) {
|
||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_MOD);
|
||||
} else if (SortBy == SortOrder.AMOUNT) {
|
||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_SIZE);
|
||||
} else if (SortBy == SortOrder.INVTWEAKS) {
|
||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_INV_TWEAKS);
|
||||
} else {
|
||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
// Update the display
|
||||
this.dsp.clear();
|
||||
|
||||
this.view.ensureCapacity(this.list.size());
|
||||
this.dsp.ensureCapacity(this.list.size());
|
||||
for (final IAEItemStack is : this.view) {
|
||||
this.dsp.add(is.getItemStack());
|
||||
}
|
||||
}
|
||||
|
||||
private void addEntriesToView(Iterable<IAEItemStack> entries) {
|
||||
final Enum<?> viewMode = this.sortSrc.getSortDisplay();
|
||||
final Enum<?> searchMode = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
|
||||
if (searchMode == SearchBoxMode.NEI_AUTOSEARCH || searchMode == SearchBoxMode.NEI_MANUAL_SEARCH) {
|
||||
@@ -59,7 +107,11 @@ public class EssentiaRepo extends FluidRepo {
|
||||
}
|
||||
}
|
||||
|
||||
for (IAEItemStack is : this.list) {
|
||||
for (IAEItemStack is : entries) {
|
||||
if (!AspectUtil.isEssentiaGas(ItemFluidDrop.getAeFluidStack(is))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this.myPartitionList != null) {
|
||||
if (!this.myPartitionList.isListed(is)) {
|
||||
continue;
|
||||
@@ -88,40 +140,6 @@ public class EssentiaRepo extends FluidRepo {
|
||||
this.view.add(is);
|
||||
}
|
||||
}
|
||||
|
||||
final Enum<?> SortBy = this.sortSrc.getSortBy();
|
||||
final Enum<?> SortDir = this.sortSrc.getSortDir();
|
||||
|
||||
FluidSorters.setDirection((appeng.api.config.SortDir) SortDir);
|
||||
FluidSorters.init();
|
||||
|
||||
if (SortBy == SortOrder.MOD) {
|
||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_MOD);
|
||||
} else if (SortBy == SortOrder.AMOUNT) {
|
||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_SIZE);
|
||||
} else if (SortBy == SortOrder.INVTWEAKS) {
|
||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_INV_TWEAKS);
|
||||
} else {
|
||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_NAME);
|
||||
}
|
||||
|
||||
for (final IAEItemStack is : this.view) {
|
||||
this.dsp.add(is.getItemStack());
|
||||
}
|
||||
Iterator<IAEItemStack> it1 = this.view.iterator();
|
||||
while (it1.hasNext()) {
|
||||
IAEFluidStack fluid = ItemFluidDrop.getAeFluidStack(it1.next());
|
||||
if (!AspectUtil.isEssentiaGas(fluid)) {
|
||||
it1.remove();
|
||||
}
|
||||
}
|
||||
Iterator<ItemStack> it2 = this.dsp.iterator();
|
||||
while (it2.hasNext()) {
|
||||
FluidStack fluid = ItemFluidDrop.getFluidStack(it2.next());
|
||||
if (!AspectUtil.isEssentiaGas(fluid)) {
|
||||
it2.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,6 +13,8 @@ package com.glodblock.github.client.me;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -52,6 +54,7 @@ public class FluidRepo implements IDisplayRepo {
|
||||
|
||||
protected String searchString = "";
|
||||
protected IPartitionList<IAEItemStack> myPartitionList;
|
||||
protected boolean paused = false;
|
||||
private String NEIWord = null;
|
||||
private boolean hasPower;
|
||||
|
||||
@@ -100,12 +103,60 @@ public class FluidRepo implements IDisplayRepo {
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void updateView() {
|
||||
this.view.clear();
|
||||
if (this.paused) {
|
||||
// Update existing view with new data
|
||||
for (int i = 0; i < this.view.size(); i++) {
|
||||
IAEItemStack entry = this.view.get(i);
|
||||
IAEItemStack serverEntry = this.list.findPrecise(entry);
|
||||
if (serverEntry == null) {
|
||||
entry.setStackSize(0);
|
||||
} else {
|
||||
this.view.set(i, serverEntry);
|
||||
}
|
||||
}
|
||||
|
||||
// Append newly added item stacks to the end of the view
|
||||
Set<IAEItemStack> viewSet = new HashSet<>(this.view);
|
||||
ArrayList<IAEItemStack> entriesToAdd = new ArrayList<>();
|
||||
for (IAEItemStack serverEntry : this.list) {
|
||||
if (!viewSet.contains(serverEntry)) {
|
||||
entriesToAdd.add(serverEntry);
|
||||
}
|
||||
}
|
||||
addEntriesToView(entriesToAdd);
|
||||
} else {
|
||||
this.view.clear();
|
||||
this.view.ensureCapacity(this.list.size());
|
||||
addEntriesToView(this.list);
|
||||
}
|
||||
|
||||
// Do not sort if paused
|
||||
if (!paused) {
|
||||
final Enum<?> SortBy = this.sortSrc.getSortBy();
|
||||
final Enum<?> SortDir = this.sortSrc.getSortDir();
|
||||
|
||||
FluidSorters.setDirection((appeng.api.config.SortDir) SortDir);
|
||||
FluidSorters.init();
|
||||
|
||||
if (SortBy == SortOrder.MOD) {
|
||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_MOD);
|
||||
} else if (SortBy == SortOrder.AMOUNT) {
|
||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_SIZE);
|
||||
} else if (SortBy == SortOrder.INVTWEAKS) {
|
||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_INV_TWEAKS);
|
||||
} else {
|
||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
this.dsp.clear();
|
||||
|
||||
this.view.ensureCapacity(this.list.size());
|
||||
this.dsp.ensureCapacity(this.list.size());
|
||||
for (final IAEItemStack is : this.view) {
|
||||
this.dsp.add(is.getItemStack());
|
||||
}
|
||||
}
|
||||
|
||||
private void addEntriesToView(Iterable<IAEItemStack> entries) {
|
||||
final Enum<?> viewMode = this.sortSrc.getSortDisplay();
|
||||
final Enum<?> searchMode = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
|
||||
if (searchMode == SearchBoxMode.NEI_AUTOSEARCH || searchMode == SearchBoxMode.NEI_MANUAL_SEARCH) {
|
||||
@@ -131,7 +182,7 @@ public class FluidRepo implements IDisplayRepo {
|
||||
}
|
||||
}
|
||||
|
||||
for (IAEItemStack is : this.list) {
|
||||
for (IAEItemStack is : entries) {
|
||||
if (this.myPartitionList != null) {
|
||||
if (!this.myPartitionList.isListed(is)) {
|
||||
continue;
|
||||
@@ -168,26 +219,6 @@ public class FluidRepo implements IDisplayRepo {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final Enum<?> SortBy = this.sortSrc.getSortBy();
|
||||
final Enum<?> SortDir = this.sortSrc.getSortDir();
|
||||
|
||||
FluidSorters.setDirection((appeng.api.config.SortDir) SortDir);
|
||||
FluidSorters.init();
|
||||
|
||||
if (SortBy == SortOrder.MOD) {
|
||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_MOD);
|
||||
} else if (SortBy == SortOrder.AMOUNT) {
|
||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_SIZE);
|
||||
} else if (SortBy == SortOrder.INVTWEAKS) {
|
||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_INV_TWEAKS);
|
||||
} else {
|
||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_NAME);
|
||||
}
|
||||
|
||||
for (final IAEItemStack is : this.view) {
|
||||
this.dsp.add(is.getItemStack());
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateNEI(final String filter) {
|
||||
@@ -245,4 +276,21 @@ public class FluidRepo implements IDisplayRepo {
|
||||
public void setSearchString(@Nonnull final String searchString) {
|
||||
this.searchString = searchString;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPaused() {
|
||||
return this.paused;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPaused(boolean paused) {
|
||||
if (this.paused != paused) {
|
||||
this.paused = paused;
|
||||
|
||||
// Update view when un-paused
|
||||
if (!paused) {
|
||||
updateView();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -64,6 +64,7 @@ import appeng.helpers.IPriorityHost;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.cache.GridStorageCache;
|
||||
import appeng.me.storage.MEInventoryHandler;
|
||||
import appeng.me.storage.StorageBusInventoryHandler;
|
||||
import appeng.parts.automation.PartUpgradeable;
|
||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||
import appeng.tile.inventory.InvOperation;
|
||||
@@ -374,7 +375,7 @@ public class PartFluidStorageBus extends PartUpgradeable
|
||||
this.monitor = h;
|
||||
}
|
||||
if (inv != null) {
|
||||
this.handler = new MEInventoryHandler(inv, StorageChannel.FLUIDS);
|
||||
this.handler = new StorageBusInventoryHandler(inv, StorageChannel.FLUIDS);
|
||||
AccessRestriction currentAccess = (AccessRestriction) this.getConfigManager().getSetting(Settings.ACCESS);
|
||||
this.handler.setBaseAccess(currentAccess);
|
||||
this.handler.setWhitelist(
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import com.glodblock.github.api.registries.ILevelViewable;
|
||||
import com.glodblock.github.common.Config;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.crossmod.thaumcraft.ThaumicEnergisticsCrafting;
|
||||
import com.glodblock.github.inventory.AeItemStackHandler;
|
||||
import com.glodblock.github.inventory.AeStackInventory;
|
||||
import com.glodblock.github.inventory.AeStackInventoryImpl;
|
||||
@@ -169,19 +170,41 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
if (!isEnable || batchSize == 0) requests.updateState(i, State.None);
|
||||
if (batchSize > 0) {
|
||||
IAEItemStack craftItem = requests.getCraftItem(i);
|
||||
|
||||
if (craftItem != null && ThaumicEnergisticsCrafting.isAspectStack(craftItem.getItemStack())) {
|
||||
craftItem = ThaumicEnergisticsCrafting.convertAspectStack(craftItem);
|
||||
}
|
||||
|
||||
IAEItemStack aeItem = inv.findPrecise(craftItem);
|
||||
|
||||
long stackSize = aeItem == null ? 0 : aeItem.getStackSize();
|
||||
|
||||
if (aeItem != null && ThaumicEnergisticsCrafting.isAspectStack(aeItem.getItemStack())) {
|
||||
stackSize = ThaumicEnergisticsCrafting.getEssentiaAmount(aeItem, grid);
|
||||
}
|
||||
|
||||
boolean isDone = requests.isDone(i);
|
||||
boolean isCraftable = aeItem != null && aeItem.isCraftable();
|
||||
boolean shouldCraft = isCraftable && aeItem.getStackSize() < quantity;
|
||||
boolean shouldCraft = isCraftable && stackSize < quantity;
|
||||
|
||||
if (isDone) requests.updateState(i, State.Idle);
|
||||
if (!isCraftable) requests.updateState(i, State.Error);
|
||||
if (allBusy || !isDone
|
||||
|| !shouldCraft
|
||||
|| craftingGrid.canEmitFor(craftItem)
|
||||
|| craftingGrid.isRequesting(craftItem))
|
||||
|
||||
if (allBusy || !isDone || !shouldCraft) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (craftingGrid.canEmitFor(craftItem)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (craftingGrid.isRequesting(craftItem)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// do crafting
|
||||
Future<ICraftingJob> jobTask = requests.getJob(i);
|
||||
|
||||
if (jobTask == null) {
|
||||
if (itemToBegin == null) {
|
||||
itemToBegin = craftItem;
|
||||
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
package com.glodblock.github.crossmod.thaumcraft;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumicenergistics.api.grid.IEssentiaGrid;
|
||||
import thaumicenergistics.common.items.ItemCraftingAspect;
|
||||
|
||||
public class ThaumicEnergisticsCrafting {
|
||||
|
||||
public static Item neiAddonAspect, thaumicEnergisticsAspect;
|
||||
|
||||
public static void postInit() {
|
||||
neiAddonAspect = GameRegistry.findItem("thaumcraftneiplugin", "Aspect");
|
||||
thaumicEnergisticsAspect = GameRegistry.findItem("thaumicenergistics", "crafting.aspect");
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a stack is an aspect preview (nei addon or thaumic energistics). Does not mean that the stack contains
|
||||
* an aspect.
|
||||
*/
|
||||
public static boolean isAspectStack(ItemStack stack) {
|
||||
if (stack == null) return false;
|
||||
|
||||
return stack.getItem() == neiAddonAspect || stack.getItem() == thaumicEnergisticsAspect;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Method(modid = "thaumicenergistics")
|
||||
public static String getAspectName(ItemStack stack) {
|
||||
if (stack == null) return null;
|
||||
|
||||
if (stack.getItem() == neiAddonAspect) {
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
if (tag == null || !(tag.getTag("Aspects") instanceof NBTTagList aspects)) return null;
|
||||
if (aspects.tagCount() != 1) return null;
|
||||
String aspect = aspects.getCompoundTagAt(0).getString("key");
|
||||
if (aspect.isEmpty()) return null;
|
||||
|
||||
return aspect;
|
||||
}
|
||||
|
||||
if (stack.getItem() == thaumicEnergisticsAspect) {
|
||||
return ItemCraftingAspect.getAspect(stack).getTag();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Method(modid = "thaumicenergistics")
|
||||
public static ItemStack getAspectStack(String aspectName, int stackSize) {
|
||||
return ItemCraftingAspect.createStackForAspect(Aspect.getAspect(aspectName), stackSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an aspect stack into a thaumic energistics stack.
|
||||
*/
|
||||
public static IAEItemStack convertAspectStack(IAEItemStack stack) {
|
||||
if (stack == null) return null;
|
||||
|
||||
String aspect = getAspectName(stack.getItemStack());
|
||||
|
||||
if (aspect == null) return stack;
|
||||
|
||||
return Objects.requireNonNull(AEItemStack.create(getAspectStack(aspect, 1))).setStackSize(stack.getStackSize());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the amount of essentia stored in a grid for a given aspect preview.
|
||||
*/
|
||||
@Method(modid = "thaumicenergistics")
|
||||
public static long getEssentiaAmount(IAEItemStack stack, IGrid grid) {
|
||||
String aspectName = getAspectName(stack.getItemStack());
|
||||
|
||||
if (aspectName == null) return 0;
|
||||
|
||||
Aspect aspect = Aspect.getAspect(aspectName);
|
||||
|
||||
if (aspect == null) return 0;
|
||||
|
||||
IEssentiaGrid essentiaGrid = grid.getCache(IEssentiaGrid.class);
|
||||
|
||||
return essentiaGrid.getEssentiaAmount(aspect);
|
||||
}
|
||||
}
|
||||
@@ -71,6 +71,7 @@ import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
import com.glodblock.github.common.Config;
|
||||
import com.glodblock.github.common.item.FCBaseItemCell;
|
||||
import com.glodblock.github.common.storage.CellType;
|
||||
import com.glodblock.github.loader.recipe.DisassembleRecipe;
|
||||
import com.glodblock.github.loader.recipe.WirelessTerminalEnergyRecipe;
|
||||
import com.glodblock.github.loader.recipe.WirelessTerminalQuantumBridgeRecipe;
|
||||
import com.glodblock.github.loader.recipe.WirelessTerminalRecipe;
|
||||
@@ -757,4 +758,8 @@ public class RecipeLoader implements Runnable {
|
||||
Arrays.stream(term).filter(Objects::nonNull).toArray());
|
||||
|
||||
}
|
||||
|
||||
public static void addDisassembleRecipe() {
|
||||
GameRegistry.addRecipe(new DisassembleRecipe());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
package com.glodblock.github.loader.recipe;
|
||||
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.util.IterationCounter;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class DisassembleRecipe implements IRecipe {
|
||||
|
||||
private final Map<ItemStack, ItemStack> cellMappings;
|
||||
private final Map<ItemStack, ItemStack> nonCellMappings;
|
||||
|
||||
public DisassembleRecipe() {
|
||||
this.cellMappings = new HashMap<>(16);
|
||||
this.nonCellMappings = new HashMap<>(1);
|
||||
|
||||
this.cellMappings.put(new ItemStack(CELL1K), new ItemStack(CELL_PART, 1, 0));
|
||||
this.cellMappings.put(new ItemStack(CELL4K), new ItemStack(CELL_PART, 1, 1));
|
||||
this.cellMappings.put(new ItemStack(CELL16K), new ItemStack(CELL_PART, 1, 2));
|
||||
this.cellMappings.put(new ItemStack(CELL64K), new ItemStack(CELL_PART, 1, 3));
|
||||
this.cellMappings.put(new ItemStack(CELL256K), new ItemStack(CELL_PART, 1, 4));
|
||||
this.cellMappings.put(new ItemStack(CELL1024K), new ItemStack(CELL_PART, 1, 5));
|
||||
this.cellMappings.put(new ItemStack(CELL4096K), new ItemStack(CELL_PART, 1, 6));
|
||||
this.cellMappings.put(new ItemStack(CELL16384K), new ItemStack(CELL_PART, 1, 7));
|
||||
|
||||
this.cellMappings.put(new ItemStack(CELL1KM), new ItemStack(CELL_PART, 1, 0));
|
||||
this.cellMappings.put(new ItemStack(CELL4KM), new ItemStack(CELL_PART, 1, 1));
|
||||
this.cellMappings.put(new ItemStack(CELL16KM), new ItemStack(CELL_PART, 1, 2));
|
||||
this.cellMappings.put(new ItemStack(CELL64KM), new ItemStack(CELL_PART, 1, 3));
|
||||
this.cellMappings.put(new ItemStack(CELL256KM), new ItemStack(CELL_PART, 1, 4));
|
||||
this.cellMappings.put(new ItemStack(CELL1024KM), new ItemStack(CELL_PART, 1, 5));
|
||||
this.cellMappings.put(new ItemStack(CELL4096KM), new ItemStack(CELL_PART, 1, 6));
|
||||
this.cellMappings.put(new ItemStack(CELL16384KM), new ItemStack(CELL_PART, 1, 7));
|
||||
|
||||
this.nonCellMappings.put(
|
||||
new ItemStack(PATTERN),
|
||||
AEApi.instance().definitions().materials().blankPattern().maybeStack(1).get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(final InventoryCrafting inv, final World w) {
|
||||
return this.getOutput(inv) != null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private ItemStack getOutput(final IInventory inventory) {
|
||||
int itemCount = 0;
|
||||
ItemStack output = null;
|
||||
|
||||
for (int slotIndex = 0; slotIndex < inventory.getSizeInventory(); slotIndex++) {
|
||||
final ItemStack stackInSlot = inventory.getStackInSlot(slotIndex);
|
||||
if (stackInSlot != null) {
|
||||
// needs a single input in the recipe
|
||||
itemCount++;
|
||||
if (itemCount > 1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// handle storage cells
|
||||
final ItemStack storageCellStack = this.getCellOutput(stackInSlot);
|
||||
if (storageCellStack != null) {
|
||||
// make sure the storage cell stackInSlot empty...
|
||||
final IMEInventory<IAEFluidStack> cellInv = AEApi.instance().registries().cell()
|
||||
.getCellInventory(stackInSlot, null, StorageChannel.FLUIDS);
|
||||
if (cellInv != null) {
|
||||
final IItemList<IAEFluidStack> list = cellInv
|
||||
.getAvailableItems(StorageChannel.FLUIDS.createList(), IterationCounter.fetchNewId());
|
||||
if (!list.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
output = storageCellStack;
|
||||
}
|
||||
|
||||
// handle crafting storage blocks
|
||||
final ItemStack craftingStorageStack = this.getNonCellOutput(stackInSlot);
|
||||
if (craftingStorageStack != null) {
|
||||
output = craftingStorageStack;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
private ItemStack getCellOutput(final ItemStack compared) {
|
||||
for (final Map.Entry<ItemStack, ItemStack> entry : this.cellMappings.entrySet()) {
|
||||
if (Platform.isSameItemType(compared, entry.getKey())) {
|
||||
return entry.getValue().copy();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private ItemStack getNonCellOutput(final ItemStack compared) {
|
||||
for (final Map.Entry<ItemStack, ItemStack> entry : this.nonCellMappings.entrySet()) {
|
||||
if (Platform.isSameItemType(compared, entry.getKey())) {
|
||||
return entry.getValue().copy();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack getCraftingResult(final InventoryCrafting inv) {
|
||||
return this.getOutput(inv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() // no default output..
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import com.glodblock.github.common.tile.TileFluidInterface;
|
||||
import com.glodblock.github.common.tile.TileWalrus;
|
||||
import com.glodblock.github.crossmod.extracells.EC2Replacer;
|
||||
import com.glodblock.github.crossmod.thaumcraft.AspectUtil;
|
||||
import com.glodblock.github.crossmod.thaumcraft.ThaumicEnergisticsCrafting;
|
||||
import com.glodblock.github.inventory.external.AEFluidInterfaceHandler;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.network.SPacketMEUpdateBuffer;
|
||||
@@ -46,6 +47,9 @@ public class CommonProxy {
|
||||
if (!ModAndClassUtil.EC2 && Config.replaceEC2) {
|
||||
EC2Replacer.initReplacer();
|
||||
}
|
||||
if (ModAndClassUtil.ThE) {
|
||||
ThaumicEnergisticsCrafting.postInit();
|
||||
}
|
||||
if (ModAndClassUtil.isBigInterface) {
|
||||
Upgrades.PATTERN_CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_INTERFACE), 3);
|
||||
Upgrades.PATTERN_CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.INTERFACE), 3);
|
||||
|
||||
Reference in new issue
Block a user