mirror of
https://github.com/GTNewHorizons/Applied-Energistics-2-Unofficial.git
synced 2026-10-25 20:22:23 +00:00
add ignore mode (#1719)
Co-authored-by: Martin Robertz <dream-master@gmx.net>
This commit is contained in:
1 parent
b70c08983b
commit
1ee52dfda9
5 files changed
+59
-27
No files matched your search
@@ -60,6 +60,8 @@ public enum PlayerMessages implements Localization {
|
||||
ItemFlowNotFound,
|
||||
PatternRepeaterProvider,
|
||||
PatternRepeaterAccessor,
|
||||
PatternRepeaterRouteOutputTrue,
|
||||
PatternRepeaterRouteOutputFalse,
|
||||
|
||||
WirelessHighlighted,
|
||||
WirelessInOtherDim,
|
||||
|
||||
@@ -59,7 +59,9 @@ public enum WailaText implements Localization {
|
||||
|
||||
Waiting,
|
||||
Provider,
|
||||
Accessor;
|
||||
Accessor,
|
||||
RouteOutputTrue,
|
||||
RouteOutputFalse;
|
||||
|
||||
private final String formatedName;
|
||||
|
||||
|
||||
+8
-3
@@ -1,5 +1,9 @@
|
||||
package appeng.integration.modules.waila.part;
|
||||
|
||||
import static appeng.parts.misc.PartPatternRepeater.NBT_MODE;
|
||||
import static appeng.parts.misc.PartPatternRepeater.NBT_ROUTE_OUTPUT;
|
||||
import static appeng.parts.misc.PartPatternRepeater.NBT_WAITING_STACKS;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -19,15 +23,13 @@ import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
|
||||
public class PartPatternRepeaterDataProvider extends BasePartWailaDataProvider {
|
||||
|
||||
private static final String NBT_MODE = "provider";
|
||||
private static final String NBT_WAITING_STACKS = "waitingStacks";
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(IPart part, List<String> currentToolTip, IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
if (part instanceof PartPatternRepeater) {
|
||||
if (accessor.getNBTData().hasKey(NBT_MODE)) {
|
||||
currentToolTip.add(accessor.getNBTData().getString(NBT_MODE));
|
||||
currentToolTip.add(accessor.getNBTData().getString(NBT_ROUTE_OUTPUT));
|
||||
|
||||
if (accessor.getNBTData().hasKey(NBT_WAITING_STACKS)) {
|
||||
currentToolTip.add(WailaText.Waiting.getLocal());
|
||||
@@ -48,6 +50,9 @@ public class PartPatternRepeaterDataProvider extends BasePartWailaDataProvider {
|
||||
int x, int y, int z) {
|
||||
if (part instanceof PartPatternRepeater ppr) {
|
||||
tag.setString(NBT_MODE, ppr.isProvider() ? WailaText.Provider.getLocal() : WailaText.Accessor.getLocal());
|
||||
tag.setString(
|
||||
NBT_ROUTE_OUTPUT,
|
||||
ppr.isRouteOutput() ? WailaText.RouteOutputTrue.getLocal() : WailaText.RouteOutputFalse.getLocal());
|
||||
|
||||
IItemList<IAEStack<?>> waitingStacks = ppr.getWaitingStacks();
|
||||
if (!waitingStacks.isEmpty()) {
|
||||
|
||||
@@ -1,13 +1,3 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2. Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. Applied
|
||||
* Energistics 2 is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General
|
||||
* Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
|
||||
* later version. Applied Energistics 2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||
* Public License for more details. You should have received a copy of the GNU Lesser General Public License along with
|
||||
* Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.parts.misc;
|
||||
|
||||
import static appeng.util.Platform.convertStack;
|
||||
@@ -83,6 +73,10 @@ import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap;
|
||||
public class PartPatternRepeater extends PartBasicState
|
||||
implements ICraftingWatcherHost, ICraftingProvider, IStorageInterceptor, ICraftingPostPatternChangeListener {
|
||||
|
||||
public static final String NBT_ROUTE_OUTPUT = "routeOutput";
|
||||
public static final String NBT_MODE = "provider";
|
||||
public static final String NBT_WAITING_STACKS = "waitingStacks";
|
||||
|
||||
private final Set<ICraftingPatternDetails> craftingList = new HashSet<>();
|
||||
private final Object2BooleanMap<IAEStack<?>> emitableCrafting = new Object2BooleanOpenHashMap<>();
|
||||
private IItemList<IAEStack<?>> waitingStacks = AEApi.instance().storage().createAEStackList();
|
||||
@@ -90,6 +84,7 @@ public class PartPatternRepeater extends PartBasicState
|
||||
private CraftingGridCache currentCraftingGrid = null;
|
||||
private AENetworkProxy targetNetworkProxy = null;
|
||||
private boolean provider = false;
|
||||
private boolean routeOutput = true;
|
||||
private PartPatternRepeater pairPatternRepeater = null;
|
||||
|
||||
private ICraftingWatcher myCraftingWatcher = null;
|
||||
@@ -228,14 +223,16 @@ public class PartPatternRepeater extends PartBasicState
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound data) {
|
||||
data.setTag("waitingStacks", writeAEStackListNBT(this.waitingStacks));
|
||||
data.setBoolean("provider", this.provider);
|
||||
data.setTag(NBT_WAITING_STACKS, writeAEStackListNBT(this.waitingStacks));
|
||||
data.setBoolean(NBT_MODE, this.provider);
|
||||
data.setBoolean(NBT_ROUTE_OUTPUT, this.routeOutput);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound data) {
|
||||
this.waitingStacks = readAEStackListNBT((NBTTagList) data.getTag("waitingStacks"));
|
||||
this.provider = data.getBoolean("provider");
|
||||
this.waitingStacks = readAEStackListNBT((NBTTagList) data.getTag(NBT_WAITING_STACKS));
|
||||
this.provider = data.getBoolean(NBT_MODE);
|
||||
if (data.hasKey(NBT_ROUTE_OUTPUT)) this.routeOutput = data.getBoolean(NBT_ROUTE_OUTPUT);
|
||||
}
|
||||
|
||||
public boolean pushPattern(final ICraftingPatternDetails patternDetails, final InventoryCrafting table) {
|
||||
@@ -257,19 +254,23 @@ public class PartPatternRepeater extends PartBasicState
|
||||
if (pushRepeater.targetCraftingGrid != null
|
||||
&& !visitedRepeaters.contains(pushRepeater.targetCraftingGrid)
|
||||
&& pushRepeater.pushPatternToRepeater(patternDetails, table, visitedRepeaters)) {
|
||||
for (IAEStack<?> outputStack : patternDetails.getCondensedAEOutputs()) {
|
||||
waitingStacks.add(outputStack.copy());
|
||||
if (this.routeOutput) {
|
||||
for (IAEStack<?> outputStack : patternDetails.getCondensedAEOutputs()) {
|
||||
waitingStacks.add(outputStack.copy());
|
||||
}
|
||||
this.addInterception();
|
||||
}
|
||||
this.addInterception();
|
||||
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (medium.pushPattern(patternDetails, table)) {
|
||||
for (IAEStack<?> outputStack : patternDetails.getCondensedAEOutputs()) {
|
||||
waitingStacks.add(outputStack.copy());
|
||||
if (this.routeOutput) {
|
||||
for (IAEStack<?> outputStack : patternDetails.getCondensedAEOutputs()) {
|
||||
waitingStacks.add(outputStack.copy());
|
||||
}
|
||||
this.addInterception();
|
||||
}
|
||||
this.addInterception();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -368,7 +369,17 @@ public class PartPatternRepeater extends PartBasicState
|
||||
if (Platform.isClient()) return true;
|
||||
|
||||
if (player.isSneaking()) {
|
||||
this.waitingStacks.resetStatus();
|
||||
this.routeOutput = !this.routeOutput;
|
||||
if (this.routeOutput) {
|
||||
player.addChatMessage(PlayerMessages.PatternRepeaterRouteOutputTrue.toChat());
|
||||
this.addInterception();
|
||||
} else {
|
||||
player.addChatMessage(PlayerMessages.PatternRepeaterRouteOutputFalse.toChat());
|
||||
this.waitingStacks.resetStatus();
|
||||
}
|
||||
|
||||
this.getHost().markForSave();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -388,6 +399,8 @@ public class PartPatternRepeater extends PartBasicState
|
||||
|
||||
this.gridChanged();
|
||||
|
||||
this.getHost().markForSave();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -406,13 +419,14 @@ public class PartPatternRepeater extends PartBasicState
|
||||
|
||||
@Override
|
||||
public boolean canAccept(IAEStack<?> stack) {
|
||||
return !injecting && this.isRequesting(stack);
|
||||
return this.routeOutput && !this.injecting && this.isRequesting(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
public IAEStack<?> injectItems(final IAEStack<?> input, final Actionable type, final BaseActionSource src) {
|
||||
if (input == null) return null;
|
||||
if (!this.routeOutput) return input;
|
||||
if (injecting) return input;
|
||||
injecting = true;
|
||||
|
||||
@@ -452,10 +466,11 @@ public class PartPatternRepeater extends PartBasicState
|
||||
|
||||
@Override
|
||||
public boolean shouldRemoveInterceptor(IAEStack<?> stack) {
|
||||
return this.waitingStacks.isEmpty() && !this.emitableCrafting.containsValue(true);
|
||||
return !this.routeOutput || (this.waitingStacks.isEmpty() && !this.emitableCrafting.containsValue(true));
|
||||
}
|
||||
|
||||
private void addInterception() {
|
||||
if (!this.routeOutput) return;
|
||||
if (this.targetNetworkProxy == null) return;
|
||||
|
||||
List<IAEStackType<?>> types = new ArrayList<>(AEStackTypeRegistry.getAllTypes());
|
||||
@@ -601,4 +616,8 @@ public class PartPatternRepeater extends PartBasicState
|
||||
public void onRequestChange(final ICraftingGrid craftingGrid, IAEStack<?> what) {
|
||||
this.updateEmitableStatus(what);
|
||||
}
|
||||
|
||||
public boolean isRouteOutput() {
|
||||
return this.routeOutput;
|
||||
}
|
||||
}
|
||||
@@ -155,6 +155,8 @@ chat.appliedenergistics2.ItemFlowInOtherDim=%s flow (%s) is located in dimension
|
||||
chat.appliedenergistics2.ItemFlowNotFound=No recent network flow found for %s
|
||||
chat.appliedenergistics2.PatternRepeaterProvider=§5Provider§r - provides the pattern to the current system from the §5Accessor§r in front.
|
||||
chat.appliedenergistics2.PatternRepeaterAccessor=§5Accessor§r - provides the pattern to the §5Provider§r in front.
|
||||
chat.appliedenergistics2.PatternRepeaterRouteOutputTrue=Route pattern output.
|
||||
chat.appliedenergistics2.PatternRepeaterRouteOutputFalse=Ignore pattern output.
|
||||
chat.appliedenergistics2.WirelessHighlighted=%d §e"%d§e"§r is now highlighted at %d, %d, %d
|
||||
chat.appliedenergistics2.WirelessInOtherDim=%d §e"%d§e"§r located in dimension: %d and can't be highlighted
|
||||
chat.appliedenergistics2.WirelessHighlighterPrefix=Wireless
|
||||
@@ -939,6 +941,8 @@ waila.appliedenergistics2.Disconnected=Disconnected
|
||||
waila.appliedenergistics2.Singularity=Singularity
|
||||
waila.appliedenergistics2.Provider=§5Provider§r
|
||||
waila.appliedenergistics2.Accessor=§5Accessor§r
|
||||
waila.appliedenergistics2.RouteOutputTrue=§5Route Output§r
|
||||
waila.appliedenergistics2.RouteOutputFalse=§5Ignore Output§r
|
||||
waila.appliedenergistics2.Waiting=Waiting:
|
||||
waila.appliedenergistics2.IOBusSpeed=Speed: %s %s/t
|
||||
|
||||
|
||||
Reference in new issue
Block a user