Configurable Channel Limits (#295)

* Channel Config Test

* Update AEConfig.java

* userDefinedChannelAmounts

config option added for the dense and normal channel amounts - will need to be refined to match everything but not sure what I would need to do to make it match the other config options

rebound all hard coded checks for channel amounts and linked them to the config options

redefined how the channel amounts are noted in all applicable api integrations
This commit is contained in:
0mega24
2023-07-28 09:26:41 -04:00
committed by GitHub
parent 13ba399418
commit 59c7dd1285
8 changed files with 32 additions and 14 deletions
@@ -22,6 +22,7 @@ package appeng.client.render.cablebus;
import appeng.api.util.AECableType;
import appeng.api.util.AEColor;
import appeng.core.AppEng;
import appeng.core.AEConfig;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
@@ -327,8 +328,8 @@ class CableBuilder {
TextureAtlasSprite texture = this.connectionTextures.get(AECableType.SMART).get(cableColor);
cubeBuilder.setTexture(texture);
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels(channels);
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8)));
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8)));
// For to-machine connections, use a thicker end-cap for the connection
if (connectionType != AECableType.GLASS && !cableBusAdjacent) {
@@ -374,8 +375,8 @@ class CableBuilder {
addStraightCoveredCableSizedCube(facing, cubeBuilder);
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels(channels);
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8)));
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8)));
// Render the channel indicators brightly lit at night
cubeBuilder.setRenderFullBright(true);
@@ -403,8 +404,8 @@ class CableBuilder {
addCoveredCableSizedCube(facing, distanceFromEdge, cubeBuilder);
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels(channels);
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8)));
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8)));
// Render the channel indicators brightly lit at night
cubeBuilder.setRenderFullBright(true);
@@ -464,7 +465,7 @@ class CableBuilder {
addDenseCableSizedCube(facing, cubeBuilder);
// Dense cables show used channels in groups of 4, rounded up
channels = (channels + 3) / 4;
channels = (int) ((channels + 3) / 4) / (AEConfig.instance().getDenseChannelCapacity() / 32);
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels(channels);
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
@@ -508,7 +509,7 @@ class CableBuilder {
addStraightDenseCableSizedCube(facing, cubeBuilder);
// Dense cables show used channels in groups of 4, rounded up
channels = (channels + 3) / 4;
channels = (int) ((channels + 3) / 4) / (AEConfig.instance().getDenseChannelCapacity() / 32);
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels(channels);
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
+16
View File
@@ -83,6 +83,7 @@ public final class AEConfig extends Configuration implements IConfigurableObject
private int craftingCalculationTimePerTick = 5;
private PowerUnits selectedPowerUnit = PowerUnits.AE;
private boolean showCraftableTooltip = true;
// Spatial IO/Dimension
private int storageProviderID = -1;
private int storageDimensionID = -1;
@@ -122,6 +123,9 @@ public final class AEConfig extends Configuration implements IConfigurableObject
private int maxControllerSizeY = 7;
private int maxControllerSizeZ = 7;
private int normalChannelCapacity = 8;
private int denseChannelCapacity = 32;
private AEConfig(final File configFile) {
super(configFile);
this.configFile = configFile;
@@ -139,6 +143,8 @@ public final class AEConfig extends Configuration implements IConfigurableObject
CondenserOutput.SINGULARITY.requiredPower = this.get("Condenser", "Singularity", 256000).getInt(256000);
this.removeCrashingItemsOnLoad = this.get("general", "removeCrashingItemsOnLoad", false, "Will auto-remove items that crash when being loaded from storage. This will destroy those items instead of crashing the game!").getBoolean();
this.normalChannelCapacity = this.get("general", "normalChannelCapacity", this.normalChannelCapacity).getInt(this.normalChannelCapacity);
this.denseChannelCapacity = this.get("general", "denseChannelCapacity", this.denseChannelCapacity).getInt(this.denseChannelCapacity);
this.setCategoryComment("BlockingMode", "Map of items to not block when blockingmode is enabled.\n[modid]\nmodid:item:metadata(optional,default:0)\nSupports more than one modid, so you can block different things between, for example, gregtech or enderio");
this.nonBlockingItems = this.get("BlockingMode", "nonBlockingItems", nonBlockingItems, "NonBlockingItems").getStringList();
@@ -189,6 +195,8 @@ public final class AEConfig extends Configuration implements IConfigurableObject
this.maxControllerSizeY = Math.min(Math.max(this.get("ControllerSize", "maxControllerSizeY", this.maxControllerSizeY).getInt(this.maxControllerSizeY), 1), 63);
this.maxControllerSizeZ = Math.min(Math.max(this.get("ControllerSize", "maxControllerSizeZ", this.maxControllerSizeZ).getInt(this.maxControllerSizeZ), 1), 63);
this.clientSync();
this.addCustomCategoryComment("features", "Warning: Disabling a feature may disable other features depending on it.");
@@ -676,4 +684,12 @@ public final class AEConfig extends Configuration implements IConfigurableObject
public int getMaxControllerSizeZ() {
return this.maxControllerSizeZ;
}
public int getNormalChannelCapacity() {
return this.normalChannelCapacity;
}
public int getDenseChannelCapacity() {
return this.denseChannelCapacity;
}
}
@@ -43,7 +43,7 @@ public class ChannelInfoProvider implements IPartProbInfoProvider {
}
if (part instanceof PartDenseCableSmart || part instanceof PartCableSmart) {
final int usedChannels;
final int maxChannels = (part instanceof PartDenseCableSmart) ? 32 : 8;
final int maxChannels = (part instanceof PartDenseCableSmart) ? AEConfig.instance().getDenseChannelCapacity() : AEConfig.instance().getNormalChannelCapacity();
if (part.getGridNode().isActive()) {
final NBTTagCompound tmp = new NBTTagCompound();
@@ -81,7 +81,7 @@ public final class ChannelWailaDataProvider extends BasePartWailaDataProvider {
final byte usedChannels = this.getUsedChannels(part, tag, this.cache);
if (usedChannels >= 0) {
final byte maxChannels = (byte) ((part instanceof PartDenseCableSmart) ? 32 : 8);
final byte maxChannels = (byte) ((part instanceof PartDenseCableSmart) ? AEConfig.instance().getDenseChannelCapacity() : AEConfig.instance().getNormalChannelCapacity());
final String formattedToolTip = String.format(WailaText.Channels.getLocal(), usedChannels, maxChannels);
currentToolTip.add(formattedToolTip);
+1 -1
View File
@@ -145,7 +145,7 @@ public class GridConnection implements IGridConnection, IPathItem {
@Override
public boolean canSupportMoreChannels() {
return this.getLastUsedChannels() < 32; // max, PERIOD.
return this.getLastUsedChannels() < AEConfig.instance().getDenseChannelCapacity(); // max, PERIOD.
}
@Override
+1 -1
View File
@@ -48,7 +48,7 @@ import java.util.*;
public class GridNode implements IGridNode, IPathItem {
private static final MENetworkChannelsChanged EVENT = new MENetworkChannelsChanged();
private static final int[] CHANNEL_COUNT = {0, 8, 32};
private static final int[] CHANNEL_COUNT = {0, AEConfig.instance().getNormalChannelCapacity(), AEConfig.instance().getDenseChannelCapacity()};
private final List<IGridConnection> connections = new ArrayList<>();
private final IGridBlock gridProxy;
+1 -1
View File
@@ -83,7 +83,7 @@ public class PathGridCache implements IPathingGrid {
if (this.controllerState == ControllerState.NO_CONTROLLER) {
final int requiredChannels = this.calculateRequiredChannels();
int used = requiredChannels;
if (AEConfig.instance().isFeatureEnabled(AEFeature.CHANNELS) && requiredChannels > 8) {
if (AEConfig.instance().isFeatureEnabled(AEFeature.CHANNELS) && requiredChannels > AEConfig.instance().getNormalChannelCapacity()) {
used = 0;
}
@@ -34,6 +34,7 @@ import appeng.client.render.cablebus.CableBusRenderState;
import appeng.client.render.cablebus.CableCoreType;
import appeng.client.render.cablebus.FacadeRenderState;
import appeng.core.AELog;
import appeng.core.AEConfig;
import appeng.facade.FacadeContainer;
import appeng.helpers.AEMultiTile;
import appeng.me.GridConnection;
@@ -1022,7 +1023,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
}
int length = (int) part.getCableConnectionLength(null);
if (length > 0 && length <= 8) {
if (length > 0 && length <= AEConfig.instance().getNormalChannelCapacity()) {
renderState.getAttachmentConnections().put(facing, length);
}
}