Compare commits

..

14 Commits

Author SHA1 Message Date
PrototypeTrousers ebe3341bfe refactor AutoRotatingModel 2023-08-27 08:33:51 -03:00
PrototypeTrousers 7566b3e2fc update pattern terminal crafting result after crafting 2023-08-11 10:40:57 -03:00
PrototypeTrousers 30c074021b terminal woes 2023-08-11 10:27:15 -03:00
PrototypeTrousers e6586ac360 attempt to fix ore dict storage bus freezing the client 2023-08-08 00:29:52 -03:00
PrototypeTrousers 0429fe5f21 schedule a refreshed view when changing view cells in terminals 2023-08-05 19:16:02 -03:00
PrototypeTrousers e16d90333b fix channel display 2023-07-31 02:58:34 -03:00
0mega24 59c7dd1285 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
2023-07-28 10:26:41 -03:00
PrototypeTrousers 13ba399418 fix NPE. Fix fix gradle issue due to cofh dick move 2023-07-25 17:18:42 -03:00
PrototypeTrousers 8d152afcd3 actually add the access transformer to the jar 2023-07-14 23:20:38 -03:00
PrototypeTrousers 9fdfbbea54 more null checks 2023-07-13 21:57:39 -03:00
PrototypeTrousers f4303fc1ec add checks to 0 sized stacks 2023-07-12 15:00:59 -03:00
PrototypeTrousers 3c62ac79c3 bump version 2023-07-08 21:39:38 -03:00
PrototypeTrousers e42863643d crafting microoptimization 2023-07-08 21:35:27 -03:00
PrototypeTrousers ace7c7d660 Merge branch 'rfg' into origin/AE2-Omnifactory 2023-07-08 18:21:44 -03:00
29 changed files with 380 additions and 280 deletions
+1 -1
View File
@@ -522,7 +522,7 @@ jar {
include "assets/**"
include "mcmod.info"
include "pack.mcmeta"
include "META-INF/appeng_at.cfg"
include "META-INF/appliedenergistics2_at.cfg"
}
// Create API library jar
+1 -4
View File
@@ -3,8 +3,6 @@ aechannel=stable
aebuild=7
aegroup=appeng
aebasename=appliedenergistics2
extended=extended_life
extendedversion=v0.55.16
#########################################################
# Versions #
#########################################################
@@ -22,7 +20,6 @@ jei_version=4.16.1.302
tesla_version=1.0.63
ic2_version=2.8.73-ex112
top_version=1.12-1.4.23-16
cofhcore_version=1.12.2-4.5.2.19
crafttweaker_version=4.1.20.684
ctm_version=MC1.12.2-0.3.1.16
forestry_version=5.8.2.387
@@ -42,7 +39,7 @@ modId=appliedenergistics2
modGroup=appeng
# Version of your mod.
# This field can be left empty if you want your mod's version to be determined by the latest git tag instead.
modVersion=rv6-stable-7-extended_life-v0.55.16
modVersion=rv6-stable-7-extended_life-v0.55.21
# Whether to use the old jar naming structure (modid-mcversion-version) instead of the new version (modid-version)
includeMCVersionJar=false
# The name of your jar when you produce builds, not including any versioning info
+5 -5
View File
@@ -81,11 +81,11 @@ configurations {
dependencies {
// deobfCompile "gregtechce:gregtech:1.12.2:1.15.1.735"
// installable runtime dependencies
implementation rfg.deobf ("curse.maven:gregtechceu-557242:4429261")
implementation rfg.deobf("curse.maven:gregtechceu-557242:4429261")
compileOnly "curse.maven:chisel-235279:2915375"
implementation rfg.deobf ("curse.maven:baubles-227083:2518667")
implementation rfg.deobf("curse.maven:baubles-227083:2518667")
//mods "mcp.mobius.waila:Hwyla:${hwyla_version}"
mods "curse.maven:hwyla-253449:2568751"
mods "net.industrial-craft:industrialcraft-2:${ic2_version}:dev"
@@ -96,7 +96,7 @@ dependencies {
//compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}"
compileOnly "curse.maven:hwyla-253449:2568751"
//Code chicken lib, GTCE dependency
implementation rfg.deobf ("curse.maven:CCL-242818:2779848")
implementation rfg.deobf("curse.maven:CCL-242818:2779848")
compileOnly "curse.maven:recipe-stages-280554:3405072"
compileOnly "curse.maven:item-stages-280316:2696769"
@@ -104,13 +104,13 @@ dependencies {
compileOnly "net.darkhax.tesla:Tesla-1.12.2:${tesla_version}"
compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api"
compileOnly "cofh:CoFHCore:${cofhcore_version}:deobf"
compileOnly "curse.maven:CoFHCore-69162:2920433"
compileOnly "CraftTweaker2:CraftTweaker2-API:${crafttweaker_version}"
compileOnly "curse.maven:inventory-tweaks-223094:2482482"
compileOnly "curse.maven:inventory-bogo-sorter-632327:4399738"
compileOnly "team.chisel.ctm:CTM:${ctm_version}"
compileOnly "de.ellpeck.actuallyadditions:ActuallyAdditions:1.12.2-r152.16:api"
implementation rfg.deobf ("net.sengir.forestry:forestry_${minecraft_version}:$forestry_version")
implementation rfg.deobf("net.sengir.forestry:forestry_${minecraft_version}:$forestry_version")
// at runtime, use the full JEI jar
runtimeOnly "mezz.jei:jei_${minecraft_version}:${jei_version}"
@@ -34,7 +34,7 @@ public class GuiOreDictStorageBus extends AEBaseGui {
private GuiImgButton partition;
private GuiImgButton storageFilter;
private GuiImgButton rwMode;
private static final Pattern ORE_DICTIONARY_FILTER = Pattern.compile("[(!]* *[0-9a-zA-Z*]* *\\)*( *[&|^]? *[(!]* *[0-9a-zA-Z*]* *\\)*)*");
private static final Pattern ORE_DICTIONARY_FILTER = Pattern.compile("[0-9a-zA-Z* &|^!()]*");
private MEGuiTextField searchFieldInputs;
public GuiOreDictStorageBus(final InventoryPlayer inventoryPlayer, final PartOreDicStorageBus te) {
+1 -1
View File
@@ -104,7 +104,7 @@ public class ItemRepo {
public void setViewCell(final ItemStack[] list) {
this.myPartitionList = ItemViewCell.createFilter(list);
this.updateView();
this.changed = true;
}
public void updateView() {
@@ -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);
@@ -21,7 +21,6 @@ package appeng.client.render.model;
import appeng.block.AEBaseTileBlock;
import appeng.client.render.FacingToRotation;
import com.google.common.base.Objects;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
@@ -31,22 +30,19 @@ import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.block.model.ItemOverrideList;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.renderer.vertex.VertexFormatElement;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.resources.IResourceManagerReloadListener;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.Vec3i;
import net.minecraftforge.client.model.pipeline.IVertexConsumer;
import net.minecraftforge.client.model.pipeline.QuadGatheringTransformer;
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
import net.minecraftforge.common.property.IExtendedBlockState;
import javax.vecmath.Vector3f;
import javax.vecmath.Matrix4f;
import javax.vecmath.Tuple4f;
import javax.vecmath.Vector4f;
import java.util.ArrayList;
import java.util.List;
import static net.minecraft.util.EnumFacing.DOWN;
public class AutoRotatingModel implements IBakedModel, IResourceManagerReloadListener {
@@ -68,34 +64,171 @@ public class AutoRotatingModel implements IBakedModel, IResourceManagerReloadLis
FacingToRotation f2r = FacingToRotation.get(forward, up);
List<BakedQuad> original = AutoRotatingModel.this.parent.getQuads(state, f2r.resultingRotate(side), 0);
List<BakedQuad> rotated = new ArrayList<>(original.size());
for (BakedQuad quad : original) {
VertexFormat format = quad.getFormat();
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format);
VertexRotator rot = new VertexRotator(f2r, quad.getFace());
rot.setParent(builder);
quad.pipe(rot);
if (quad.getFace() != null) {
builder.setQuadOrientation(f2r.rotate(quad.getFace()));
} else {
builder.setQuadOrientation(null);
}
BakedQuad unpackedQuad = builder.build();
final Matrix4f transformMatrix = new Matrix4f();
final Tuple4f vertexTransformingVec = new Vector4f();
// Make a copy of it to resolve the vertex data and throw away the unpacked stuff
// This also fixes a bug in Forge's UnpackedBakedQuad, which unpacks a byte-based normal like 0,0,-1
// to 0,0,-0.99607843. We replace these normals with the proper 0,0,-1 when rotation, which
// causes a bug in the AO lighter, if an unpacked quad pipes this value back to it.
// Packing it back to the vanilla vertex format will fix this inconsistency because it converts
// the normal back to a byte-based format, which then re-applies Forge's own bug when piping it
// to the AO lighter, thus fixing our problem.
BakedQuad packedQuad = new BakedQuad(unpackedQuad.getVertexData(), quad.getTintIndex(), unpackedQuad.getFace(), quad.getSprite(), quad
.shouldApplyDiffuseLighting(), quad.getFormat());
rotated.add(packedQuad);
// Transform the matrix so the top and front facings of the model matches the block in-world
transformMatrixByFacings(transformMatrix, up, forward);
for (BakedQuad b : original) {
EnumFacing newFace = f2r.rotate(b.getFace());
rotated.add(rebakeQuad(b, newFace, transformMatrix, vertexTransformingVec));
}
return rotated;
}
private void transformMatrixByFacings(Matrix4f transformMatrix, EnumFacing topFacing, EnumFacing frontFacing) {
Matrix4f intermediaryMatrix = new Matrix4f();
transformMatrix.setIdentity();
moveToPivot(transformMatrix, intermediaryMatrix, true);
if (topFacing.getAxis() == EnumFacing.Axis.Y) {
switch (frontFacing) {
case NORTH:
rotateY(transformMatrix, intermediaryMatrix, (float) (0));
break;
case SOUTH:
rotateY(transformMatrix, intermediaryMatrix, (float) (-Math.PI));
break;
case EAST:
rotateY(transformMatrix, intermediaryMatrix, (float) (-Math.PI / 2));
break;
case WEST:
rotateY(transformMatrix, intermediaryMatrix, (float) (Math.PI / 2));
break;
}
if (topFacing == DOWN) {
rotateX(transformMatrix, intermediaryMatrix, (float) (Math.PI));
rotateY(transformMatrix, intermediaryMatrix, (float) (Math.PI));
}
} else {
switch (topFacing) {
case WEST:
rotateZ(transformMatrix, intermediaryMatrix, (float) (Math.PI / 2));
switch (frontFacing) {
case DOWN:
rotateY(transformMatrix, intermediaryMatrix, (float) (-Math.PI / 2));
break;
case UP:
rotateY(transformMatrix, intermediaryMatrix, (float) (+Math.PI / 2));
break;
case SOUTH:
rotateY(transformMatrix, intermediaryMatrix, (float) (Math.PI));
}
break;
case EAST:
rotateZ(transformMatrix, intermediaryMatrix, (float) (-Math.PI / 2));
switch (frontFacing) {
case DOWN:
rotateY(transformMatrix, intermediaryMatrix, (float) (Math.PI / 2));
break;
case UP:
rotateY(transformMatrix, intermediaryMatrix, (float) (-Math.PI / 2));
break;
case SOUTH:
rotateY(transformMatrix, intermediaryMatrix, (float) (-Math.PI));
}
break;
case NORTH:
rotateX(transformMatrix, intermediaryMatrix, (float) (-Math.PI / 2));
switch (frontFacing) {
case DOWN:
rotateY(transformMatrix, intermediaryMatrix, (float) (Math.PI));
break;
case EAST:
rotateY(transformMatrix, intermediaryMatrix, (float) (-Math.PI / 2));
break;
case WEST:
rotateY(transformMatrix, intermediaryMatrix, (float) (Math.PI / 2));
}
break;
default:
rotateX(transformMatrix, intermediaryMatrix, (float) (Math.PI / 2));
switch (frontFacing) {
case UP:
rotateY(transformMatrix, intermediaryMatrix, (float) (Math.PI));
break;
case EAST:
rotateY(transformMatrix, intermediaryMatrix, (float) (-Math.PI / 2));
break;
case SOUTH:
rotateY(transformMatrix, intermediaryMatrix, (float) (Math.PI / 2));
break;
case WEST:
rotateY(transformMatrix, intermediaryMatrix, (float) (Math.PI / 2));
break;
}
}
if (frontFacing.getAxis() == EnumFacing.Axis.Y) {
//rotateX(transformMatrix, intermediaryMatrix, (float) (Math.PI));
rotateY(transformMatrix, intermediaryMatrix, (float) (Math.PI));
}
}
moveToPivot(transformMatrix, intermediaryMatrix, false);
}
private void moveToPivot(Matrix4f matrix, Matrix4f intermediary, boolean positive) {
intermediary.setIdentity();
float pivot = positive ? .5F : -.5F;
intermediary.m03 = pivot;
intermediary.m13 = pivot;
intermediary.m23 = pivot;
matrix.mul(intermediary);
}
private void rotateX(Matrix4f matrix, Matrix4f intermediary, float angle) {
intermediary.setIdentity();
intermediary.rotX(angle);
matrix.mul(intermediary);
}
private void rotateY(Matrix4f matrix, Matrix4f intermediary, float angle) {
intermediary.setIdentity();
intermediary.rotY(angle);
matrix.mul(intermediary);
}
private void rotateZ(Matrix4f matrix, Matrix4f intermediary, float angle) {
intermediary.setIdentity();
intermediary.rotZ(angle);
matrix.mul(intermediary);
}
private BakedQuad rebakeQuad(BakedQuad b, EnumFacing newFacing, Matrix4f transformMatrix, Tuple4f vertexTransformingVec) {
int[] newQuad = new int[28];
int[] quadData = b.getVertexData();
for (int k = 0; k < 4; ++k) {
// Getting the offset for the current vertex.
int vertexIndex = k * 7;
vertexTransformingVec.x = Float.intBitsToFloat(quadData[vertexIndex]);
vertexTransformingVec.y = Float.intBitsToFloat(quadData[vertexIndex + 1]);
vertexTransformingVec.z = Float.intBitsToFloat(quadData[vertexIndex + 2]);
vertexTransformingVec.w = 1;
// Transforming it by the model matrix.
transformMatrix.transform(vertexTransformingVec);
// Converting the new data to ints.
int x = Float.floatToRawIntBits(vertexTransformingVec.x);
int y = Float.floatToRawIntBits(vertexTransformingVec.y);
int z = Float.floatToRawIntBits(vertexTransformingVec.z);
// Vertex position data
newQuad[vertexIndex] = x;
newQuad[vertexIndex + 1] = y;
newQuad[vertexIndex + 2] = z;
newQuad[vertexIndex + 3] = quadData[vertexIndex + 3];
newQuad[vertexIndex + 4] = quadData[vertexIndex + 4]; //texture
newQuad[vertexIndex + 5] = quadData[vertexIndex + 5];
// Vertex brightness
newQuad[vertexIndex + 6] = 0x81818181;
}
return new BakedQuad(newQuad, b.getTintIndex(), newFacing, b.getSprite(), b.shouldApplyDiffuseLighting(), b.getFormat());
}
@Override
public boolean isAmbientOcclusion() {
return this.parent.isAmbientOcclusion();
@@ -159,140 +292,4 @@ public class AutoRotatingModel implements IBakedModel, IResourceManagerReloadLis
this.quadCache.invalidateAll();
}
public static class VertexRotator extends QuadGatheringTransformer {
private final FacingToRotation f2r;
private final EnumFacing face;
public VertexRotator(FacingToRotation f2r, EnumFacing face) {
this.f2r = f2r;
this.face = face;
}
@Override
public void setParent(IVertexConsumer parent) {
super.setParent(parent);
if (Objects.equal(this.getVertexFormat(), parent.getVertexFormat())) {
return;
}
this.setVertexFormat(parent.getVertexFormat());
}
@Override
protected void processQuad() {
VertexFormat format = this.parent.getVertexFormat();
int count = format.getElementCount();
for (int v = 0; v < 4; v++) {
for (int e = 0; e < count; e++) {
VertexFormatElement element = format.getElement(e);
if (element.getUsage() == VertexFormatElement.EnumUsage.POSITION) {
this.parent.put(e, this.transform(this.quadData[e][v]));
} else if (element.getUsage() == VertexFormatElement.EnumUsage.NORMAL) {
this.parent.put(e, this.transformNormal(this.quadData[e][v]));
} else {
this.parent.put(e, this.quadData[e][v]);
}
}
}
}
private float[] transform(float[] fs) {
switch (fs.length) {
case 3:
Vector3f vec = new Vector3f(fs[0], fs[1], fs[2]);
vec.x -= 0.5f;
vec.y -= 0.5f;
vec.z -= 0.5f;
this.f2r.getMat().transform(vec);
vec.x += 0.5f;
vec.y += 0.5f;
vec.z += 0.5f;
return new float[]{vec.x, vec.y, vec.z
};
case 4:
Vector4f vecc = new Vector4f(fs[0], fs[1], fs[2], fs[3]);
vecc.x -= 0.5f;
vecc.y -= 0.5f;
vecc.z -= 0.5f;
this.f2r.getMat().transform(vecc);
vecc.x += 0.5f;
vecc.y += 0.5f;
vecc.z += 0.5f;
return new float[]{vecc.x, vecc.y, vecc.z, vecc.w
};
default:
return fs;
}
}
private float[] transformNormal(float[] fs) {
if (this.face == null) {
switch (fs.length) {
case 3:
Vector3f vec = new Vector3f(fs);
this.f2r.getMat().transform(vec);
return new float[]{
vec.getX(),
vec.getY(),
vec.getZ()
};
case 4:
Vector4f vec4 = new Vector4f(fs);
this.f2r.getMat().transform(vec4);
return new float[]{
vec4.getX(),
vec4.getY(),
vec4.getZ(),
0
};
default:
return fs;
}
} else {
switch (fs.length) {
case 3:
Vec3i vec = this.f2r.rotate(this.face).getDirectionVec();
return new float[]{
vec.getX(),
vec.getY(),
vec.getZ()
};
case 4:
Vector4f veccc = new Vector4f(fs[0], fs[1], fs[2], fs[3]);
Vec3i vecc = this.f2r.rotate(this.face).getDirectionVec();
return new float[]{
vecc.getX(),
vecc.getY(),
vecc.getZ(),
veccc.w
};
default:
return fs;
}
}
}
@Override
public void setQuadTint(int tint) {
this.parent.setQuadTint(tint);
}
@Override
public void setQuadOrientation(EnumFacing orientation) {
this.parent.setQuadOrientation(orientation);
}
@Override
public void setApplyDiffuseLighting(boolean diffuse) {
this.parent.setApplyDiffuseLighting(diffuse);
}
@Override
public void setTexture(TextureAtlasSprite texture) {
this.parent.setTexture(texture);
}
}
}
@@ -21,26 +21,33 @@ package appeng.client.render.model;
import appeng.block.storage.BlockDrive;
import appeng.block.storage.DriveSlotState;
import appeng.block.storage.DriveSlotsState;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.block.model.ItemOverrideList;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.resources.IResourceManagerReloadListener;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
import net.minecraftforge.common.property.IExtendedBlockState;
import javax.annotation.Nullable;
import javax.vecmath.Matrix4f;
import javax.vecmath.Tuple4f;
import javax.vecmath.Vector3f;
import javax.vecmath.Vector4f;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class DriveBakedModel implements IBakedModel {
public class DriveBakedModel implements IBakedModel, IResourceManagerReloadListener {
private final IBakedModel bakedBase;
private final Map<DriveSlotState, IBakedModel> bakedCells;
private final Int2ObjectMap<Map<DriveSlotState, List<BakedQuad>>> slot2DSMap = new Int2ObjectOpenHashMap<>();
public DriveBakedModel(IBakedModel bakedBase, Map<DriveSlotState, IBakedModel> bakedCells) {
this.bakedBase = bakedBase;
@@ -52,8 +59,7 @@ public class DriveBakedModel implements IBakedModel {
List<BakedQuad> result = new ArrayList<>(this.bakedBase.getQuads(state, side, rand));
if (side == null && state instanceof IExtendedBlockState) {
IExtendedBlockState extState = (IExtendedBlockState) state;
if (side == null && state instanceof IExtendedBlockState extState) {
if (!extState.getUnlistedNames().contains(BlockDrive.SLOTS_STATE)) {
return result;
@@ -61,31 +67,38 @@ public class DriveBakedModel implements IBakedModel {
DriveSlotsState slotsState = extState.getValue(BlockDrive.SLOTS_STATE);
for (int row = 0; row < 5; row++) {
for (int col = 0; col < 2; col++) {
DriveSlotState slotState = slotsState.getState(row * 2 + col);
int slot = row * 2 + col;
IBakedModel bakedCell = this.bakedCells.get(slotState);
DriveSlotState slotState = slotsState.getState(slot);
Matrix4f transform = new Matrix4f();
transform.setIdentity();
slot2DSMap.putIfAbsent(slot, new Object2ObjectOpenHashMap<>());
int finalCol = col;
int finalRow = row;
List<BakedQuad> lbq = slot2DSMap.get(slot).computeIfAbsent(slotState, q -> {
List<BakedQuad> res = new ArrayList<>();
IBakedModel bakedCell = this.bakedCells.get(slotState);
// Position this drive model copy at the correct slot. The transform is based on
// the
// cell-model being in slot 0,0 at the top left of the drive.
float xOffset = -col * 8 / 16.0f;
float yOffset = -row * 3 / 16.0f;
final Matrix4f transformMatrix = new Matrix4f();
transformMatrix.setIdentity();
final Tuple4f transform = new Vector4f();
transform.setTranslation(new Vector3f(xOffset, yOffset, 0));
// Position this drive model copy at the correct slot. The transform is based on
// the
// cell-model being in slot 0,0 at the top left of the drive.
float xOffset = -finalCol * 8 / 16.0f;
float yOffset = -finalRow * 3 / 16.0f;
MatrixVertexTransformer transformer = new MatrixVertexTransformer(transform);
for (BakedQuad bakedQuad : bakedCell.getQuads(state, null, rand)) {
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(bakedQuad.getFormat());
transformer.setParent(builder);
transformer.setVertexFormat(builder.getVertexFormat());
bakedQuad.pipe(transformer);
result.add(builder.build());
}
transformMatrix.setTranslation(new Vector3f(xOffset, yOffset, 0));
for (BakedQuad bakedQuad : bakedCell.getQuads(state, null, rand)) {
res.add(rebakeQuad(bakedQuad, transformMatrix, transform));
}
return res;
});
result.addAll(lbq);
}
}
}
@@ -93,6 +106,41 @@ public class DriveBakedModel implements IBakedModel {
return result;
}
private BakedQuad rebakeQuad(BakedQuad b, Matrix4f transformMatrix, Tuple4f vertexTransformingVec) {
int[] newQuad = new int[28];
int[] quadData = b.getVertexData();
for (int k = 0; k < 4; ++k) {
// Getting the offset for the current vertex.
int vertexIndex = k * 7;
vertexTransformingVec.x = Float.intBitsToFloat(quadData[vertexIndex]);
vertexTransformingVec.y = Float.intBitsToFloat(quadData[vertexIndex + 1]);
vertexTransformingVec.z = Float.intBitsToFloat(quadData[vertexIndex + 2]);
vertexTransformingVec.w = 1;
// Transforming it by the model matrix.
transformMatrix.transform(vertexTransformingVec);
// Converting the new data to ints.
int x = Float.floatToRawIntBits(vertexTransformingVec.x);
int y = Float.floatToRawIntBits(vertexTransformingVec.y);
int z = Float.floatToRawIntBits(vertexTransformingVec.z);
// Vertex position data
newQuad[vertexIndex] = x;
newQuad[vertexIndex + 1] = y;
newQuad[vertexIndex + 2] = z;
newQuad[vertexIndex + 3] = quadData[vertexIndex + 3];
newQuad[vertexIndex + 4] = quadData[vertexIndex + 4]; //texture
newQuad[vertexIndex + 5] = quadData[vertexIndex + 5];
// Vertex brightness
newQuad[vertexIndex + 6] = 0x81818181;
}
return new BakedQuad(newQuad, b.getTintIndex(), b.getFace(), b.getSprite(), b.shouldApplyDiffuseLighting(), b.getFormat());
}
@Override
public boolean isAmbientOcclusion() {
return this.bakedBase.isAmbientOcclusion();
@@ -122,4 +170,9 @@ public class DriveBakedModel implements IBakedModel {
public ItemOverrideList getOverrides() {
return this.bakedBase.getOverrides();
}
@Override
public void onResourceManagerReload(IResourceManager resourceManager) {
slot2DSMap.clear();
}
}
@@ -23,6 +23,7 @@ import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.SecurityPermissions;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridNode;
import appeng.api.networking.crafting.ICraftingCPU;
import appeng.api.networking.crafting.ICraftingGrid;
import appeng.api.networking.crafting.ICraftingJob;
@@ -125,7 +126,19 @@ public class ContainerCraftConfirm extends AEBaseContainer {
return;
}
final ICraftingGrid cc = this.getGrid().getCache(ICraftingGrid.class);
final IActionHost h = ((IActionHost) this.getTarget());
if (h == null) {
this.setValidContainer(false);
return;
}
IGridNode node = h.getActionableNode();
if (node == null) {
this.setValidContainer(false);
return;
}
IGrid grid = node.getGrid();
final ICraftingGrid cc = grid.getCache(ICraftingGrid.class);
final ImmutableSet<ICraftingCPU> cpuSet = cc.getCpus();
int matches = 0;
@@ -199,7 +212,7 @@ public class ContainerCraftConfirm extends AEBaseContainer {
p.reset();
p.setStackSize(out.getCountRequestable());
final IStorageGrid sg = this.getGrid().getCache(IStorageGrid.class);
final IStorageGrid sg = grid.getCache(IStorageGrid.class);
final IMEInventory<IAEItemStack> items = sg.getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
IAEItemStack m = null;
@@ -252,11 +265,6 @@ public class ContainerCraftConfirm extends AEBaseContainer {
this.verifyPermissions(SecurityPermissions.CRAFT, false);
}
private IGrid getGrid() {
final IActionHost h = ((IActionHost) this.getTarget());
return h.getActionableNode().getGrid();
}
private boolean cpuMatches(final ICraftingCPU c) {
return c.getAvailableStorage() >= this.getUsedBytes() && !c.isBusy();
}
@@ -301,12 +309,22 @@ public class ContainerCraftConfirm extends AEBaseContainer {
originalGui = GuiBridge.GUI_EXPANDED_PROCESSING_PATTERN_TERMINAL;
}
final IActionHost h = ((IActionHost) this.getTarget());
if (h == null) {
return;
}
IGridNode node = h.getActionableNode();
if (node == null) {
return;
}
IGrid grid = node.getGrid();
if (this.result != null && !this.isSimulation()) {
final ICraftingGrid cc = this.getGrid().getCache(ICraftingGrid.class);
final ICraftingGrid cc = grid.getCache(ICraftingGrid.class);
final ICraftingLink g = cc.submitJob(this.result, null, this.getSelectedCpu() == -1 ? null : this.cpus.get(this.getSelectedCpu()).getCpu(), true, this.getActionSrc());
this.setAutoStart(false);
if (g == null) {
this.setJob(cc.beginCraftingJob(this.getWorld(), this.getGrid(), this.getActionSrc(), this.result.getOutput(), null));
this.setJob(cc.beginCraftingJob(this.getWorld(), grid, this.getActionSrc(), this.result.getOutput(), null));
} else if (originalGui != null && this.getOpenContext() != null) {
final TileEntity te = this.getOpenContext().getTile();
if (te != null) {
@@ -36,7 +36,7 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable implements I
private int ticks = 0;
public ContainerMEPortableCell(InventoryPlayer ip, IPortableCell guiObject) {
super(ip, guiObject, guiObject, true);
super(ip, guiObject, guiObject, false);
if (guiObject != null) {
final int slotIndex = ((IInventorySlotAware) guiObject).getInventorySlot();
if (!((IInventorySlotAware) guiObject).isBaubleSlot()) {
@@ -47,6 +47,9 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable implements I
this.slot = -1;
this.lockPlayerInventorySlot(ip.currentItem);
}
this.bindPlayerInventory(ip, 0, 0);
this.portableCell = guiObject;
}
@@ -65,6 +65,9 @@ public class ContainerMEPortableTerminal extends ContainerMEMonitorable implemen
this.slot = -1;
this.lockPlayerInventorySlot(ip.currentItem);
}
this.bindPlayerInventory(ip, 0, 0);
this.wirelessTerminalGUIObject = guiObject;
this.upgrades = new StackUpgradeInventory(wirelessTerminalGUIObject.getItemStack(), this, 2);
this.loadFromNBT();
@@ -107,7 +110,7 @@ public class ContainerMEPortableTerminal extends ContainerMEMonitorable implemen
if (wirelessTerminalGUIObject.isBaubleSlot()) {
BaublesApi.getBaublesHandler(this.getPlayerInv().player).setStackInSlot(this.slot, this.wirelessTerminalGUIObject.getItemStack());
} else {
this.getPlayerInv().setInventorySlotContents(this.getPlayerInv().currentItem, this.wirelessTerminalGUIObject.getItemStack());
this.getPlayerInv().setInventorySlotContents(this.slot, this.wirelessTerminalGUIObject.getItemStack());
}
} else {
this.setValidContainer(false);
@@ -191,6 +191,9 @@ public abstract class ContainerPatternEncoder extends ContainerMEMonitorable imp
}
this.detectAndSendChanges();
}
if (s == this.craftSlot && Platform.isClient()) {
this.getAndUpdateOutput();
}
}
public void encodeAndMoveToInventory() {
@@ -50,7 +50,7 @@ public class ContainerWirelessCraftingTerminal extends ContainerMEPortableTermin
private IRecipe currentRecipe;
public ContainerWirelessCraftingTerminal(final InventoryPlayer ip, final WirelessTerminalGuiObject gui) {
super(ip, gui, true);
super(ip, gui, false);
final IItemHandler crafting = this.craftingGrid;
@@ -63,6 +63,8 @@ public class ContainerWirelessCraftingTerminal extends ContainerMEPortableTermin
this.addSlotToContainer(this.outputSlot = new SlotCraftingTerm(this.getPlayerInv().player, this.getActionSource(), this
.getPowerSource(), this.wirelessTerminalGUIObject, crafting, crafting, this.output, 131, -72 + 18, this));
this.bindPlayerInventory(ip, 0, 0);
this.onCraftMatrixChanged(new WrapperInvItemHandler(crafting));
}
@@ -138,7 +138,7 @@ public class ContainerWirelessPatternTerminal extends ContainerPatternEncoder im
if (wirelessTerminalGUIObject.isBaubleSlot()) {
BaublesApi.getBaublesHandler(this.getPlayerInv().player).setStackInSlot(this.slot, this.wirelessTerminalGUIObject.getItemStack());
} else {
this.getPlayerInv().setInventorySlotContents(this.getPlayerInv().currentItem, this.wirelessTerminalGUIObject.getItemStack());
this.getPlayerInv().setInventorySlotContents(this.slot, this.wirelessTerminalGUIObject.getItemStack());
}
} else {
this.setValidContainer(false);
@@ -26,6 +26,6 @@ import net.minecraft.entity.player.InventoryPlayer;
public class ContainerWirelessTerm extends ContainerMEPortableTerminal {
public ContainerWirelessTerm(final InventoryPlayer ip, final WirelessTerminalGuiObject gui) {
super(ip, gui, true);
super(ip, gui, false);
}
}
+15
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 = Math.min(this.get("general", "normalChannelCapacity", this.normalChannelCapacity, "Max channel number may not exceed 256").getInt(this.normalChannelCapacity), 256);
this.denseChannelCapacity = Math.min(this.get("general", "denseChannelCapacity", this.denseChannelCapacity, "Max channel number may not exceed 256").getInt(this.denseChannelCapacity), 256);
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,7 @@ 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 +683,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;
}
}
@@ -200,6 +200,9 @@ public class PacketJEIRecipe extends AppEngPacket {
if (request.getItem().isDamageable() || Platform.isGTDamageableItem(request.getItem())) {
Collection<IAEItemStack> outList = inv.getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)).getStorageList().findFuzzy(request, FuzzyMode.IGNORE_ALL);
for (IAEItemStack is : outList) {
if (is.getStackSize() == 0) {
continue;
}
if (Platform.isGTDamageableItem(request.getItem())) {
if (!(is.getDefinition().getMetadata() == request.getDefinition().getMetadata())) {
continue;
@@ -33,12 +33,14 @@ import appeng.core.sync.packets.PacketInformPlayer;
import appeng.me.cluster.implementations.CraftingCPUCluster;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
import appeng.util.item.MeaningfulItemIterator;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -110,32 +112,37 @@ public class CraftingTreeNode {
if (this.parent.details.canSubstitute()) {
for (IAEItemStack subs : this.parent.details.getSubstituteInputs(this.slot)) {
if (damageableItem) {
for (IAEItemStack i : inventoryList.findFuzzy(subs, FuzzyMode.IGNORE_ALL)) {
itemList.add(i);
Iterator<IAEItemStack> it = new MeaningfulItemIterator<>(inventoryList.findFuzzy(this.what, FuzzyMode.IGNORE_ALL));
while (it.hasNext()) {
IAEItemStack i = it.next();
if (i.getStackSize() > 0) {
itemList.add(i);
}
}
}
subs = inventoryList.findPrecise(subs);
if (subs != null) {
if (subs != null && subs.getStackSize() > 0) {
itemList.add(subs);
}
}
} else {
if (damageableItem) {
for (IAEItemStack i : inventoryList.findFuzzy(this.what, FuzzyMode.IGNORE_ALL)) {
itemList.add(i);
Iterator<IAEItemStack> it = new MeaningfulItemIterator<>(inventoryList.findFuzzy(this.what, FuzzyMode.IGNORE_ALL));
while (it.hasNext()) {
IAEItemStack i = it.next();
if (i.getStackSize() > 0) {
itemList.add(i);
}
}
} else {
final IAEItemStack item = inventoryList.findPrecise(this.what);
if (item != null) {
if (item != null && item.getStackSize() > 0) {
itemList.add(item);
}
}
}
for (IAEItemStack fuzz : itemList) {
if (fuzz.getStackSize() == 0) {
continue;
}
if (this.parent.details.isValidItemForSlot(this.getSlot(), fuzz.getDefinition(), this.world)) {
fuzz = fuzz.copy();
fuzz.setStackSize(l);
@@ -166,7 +166,7 @@ public class ContainerMEPortableFluidCell extends AEBaseContainer implements IAE
if (wirelessTerminalGUIObject.isBaubleSlot()) {
BaublesApi.getBaublesHandler(this.getPlayerInv().player).setStackInSlot(this.slot, this.wirelessTerminalGUIObject.getItemStack());
} else {
this.getPlayerInv().setInventorySlotContents(this.getPlayerInv().currentItem, this.wirelessTerminalGUIObject.getItemStack());
this.getPlayerInv().setInventorySlotContents(this.slot, this.wirelessTerminalGUIObject.getItemStack());
}
} else {
this.setValidContainer(false);
@@ -109,8 +109,7 @@ public class JEIMissingItem implements IRecipeTransferError {
@Override
public void showError(Minecraft minecraft, int mouseX, int mouseY, @Nonnull IRecipeLayout recipeLayout, int recipeX, int recipeY) {
Container c = minecraft.player.openContainer;
if (c instanceof ContainerMEMonitorable) {
ContainerMEMonitorable container = (ContainerMEMonitorable) c;
if (c instanceof ContainerMEMonitorable container) {
IItemList<IAEItemStack> ir = ((ContainerMEMonitorable) c).items;
boolean found = false;
boolean foundAny = false;
@@ -148,8 +147,7 @@ public class JEIMissingItem implements IRecipeTransferError {
if (i.isInput()) {
List<?> allIngredients = i.getAllIngredients();
for (Object allIngredient : allIngredients) {
if (allIngredient instanceof ItemStack) {
ItemStack stack = (ItemStack) allIngredient;
if (allIngredient instanceof ItemStack stack) {
if (!stack.isEmpty()) {
IAEItemStack search = AEItemStack.fromItemStack(stack);
if (stack.getItem().isDamageable() || Platform.isGTDamageableItem(stack.getItem())) {
@@ -179,7 +177,7 @@ public class JEIMissingItem implements IRecipeTransferError {
if (ext.getStackSize() > 0 && (usedStack == null || usedStack.getStackSize() < ext.getStackSize())) {
used.add(ext.copy().setStackSize(1));
if (craftable) {
valid = null;
valid.resetStatus();
}
valid.add(ext.copy().setStackSize(1));
found = true;
@@ -199,13 +197,13 @@ public class JEIMissingItem implements IRecipeTransferError {
continue;
}
ArrayList<ItemStack> validStacks = new ArrayList<>();
if (valid != null) {
valid.forEach(v -> {
valid.forEach(v -> {
if (v.getStackSize() > 0) {
ItemStack validStack = v.createItemStack();
validStack.setCount(1);
validStacks.add(validStack);
});
}
}
});
if (!found) {
if (craftable) {
i.drawHighlight(minecraft, new Color(0.0f, 0.0f, 1.0f, 0.4f), recipeX, recipeY);
@@ -43,12 +43,12 @@ 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();
part.writeToNBT(tmp);
usedChannels = tmp.getByte("usedChannels");
usedChannels = tmp.getInteger("usedChannels");
} else {
usedChannels = 0;
}
@@ -26,7 +26,8 @@ import appeng.core.localization.WailaText;
import appeng.parts.networking.PartCableSmart;
import appeng.parts.networking.PartDenseCableSmart;
import it.unimi.dsi.fastutil.objects.Object2ByteMap;
import it.unimi.dsi.fastutil.objects.Object2ByteOpenHashMap;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import net.minecraft.entity.player.EntityPlayerMP;
@@ -59,7 +60,7 @@ public final class ChannelWailaDataProvider extends BasePartWailaDataProvider {
* <p/>
* The cache will be updated from the server.
*/
private final Object2ByteMap<IPart> cache = new Object2ByteOpenHashMap<>();
private final Object2IntMap<IPart> cache = new Object2IntOpenHashMap<>();
/**
* Adds the used and max channel to the tool tip
@@ -78,10 +79,10 @@ public final class ChannelWailaDataProvider extends BasePartWailaDataProvider {
if (part instanceof PartCableSmart || part instanceof PartDenseCableSmart) {
final NBTTagCompound tag = accessor.getNBTData();
final byte usedChannels = this.getUsedChannels(part, tag, this.cache);
final int usedChannels = this.getUsedChannels(part, tag, this.cache);
if (usedChannels >= 0) {
final byte maxChannels = (byte) ((part instanceof PartDenseCableSmart) ? 32 : 8);
final int maxChannels = ((part instanceof PartDenseCableSmart) ? AEConfig.instance().getDenseChannelCapacity() : AEConfig.instance().getNormalChannelCapacity());
final String formattedToolTip = String.format(WailaText.Channels.getLocal(), usedChannels, maxChannels);
currentToolTip.add(formattedToolTip);
@@ -102,11 +103,11 @@ public final class ChannelWailaDataProvider extends BasePartWailaDataProvider {
* @param cache cache with previous knowledge
* @return used channels on the cable
*/
private byte getUsedChannels(final IPart part, final NBTTagCompound tag, final Object2ByteMap<IPart> cache) {
final byte usedChannels;
private int getUsedChannels(final IPart part, final NBTTagCompound tag, final Object2IntMap<IPart> cache) {
final int usedChannels;
if (tag.hasKey(ID_USED_CHANNELS)) {
usedChannels = tag.getByte(ID_USED_CHANNELS);
usedChannels = tag.getInteger(ID_USED_CHANNELS);
this.cache.put(part, usedChannels);
} else if (this.cache.containsKey(part)) {
usedChannels = this.cache.get(part);
@@ -139,9 +140,9 @@ public final class ChannelWailaDataProvider extends BasePartWailaDataProvider {
part.writeToNBT(tempTag);
if (tempTag.hasKey(ID_USED_CHANNELS)) {
final byte usedChannels = tempTag.getByte(ID_USED_CHANNELS);
final int usedChannels = tempTag.getInteger(ID_USED_CHANNELS);
tag.setByte(ID_USED_CHANNELS, usedChannels);
tag.setInteger(ID_USED_CHANNELS, usedChannels);
}
}
+8 -8
View File
@@ -47,7 +47,8 @@ public class GridConnection implements IGridConnection, IPathItem {
private static final String EXISTING_CONNECTION_MESSAGE = "Connection between node [machine=%s, %s] and [machine=%s, %s] on [%s] already exists.";
private static final MENetworkChannelsChanged EVENT = new MENetworkChannelsChanged();
private int channelData = 0;
private int usedChannels = 0;
private int lastUsedChannels = 0;
private Object visitorIterationNumber = null;
private GridNode sideA;
private AEPartLocation fromAtoB;
@@ -118,7 +119,7 @@ public class GridConnection implements IGridConnection, IPathItem {
@Override
public int getUsedChannels() {
return (this.channelData >> 8) & 0xff;
return usedChannels;
}
@Override
@@ -132,7 +133,7 @@ public class GridConnection implements IGridConnection, IPathItem {
@Override
public void setControllerRoute(final IPathItem fast, final boolean zeroOut) {
if (zeroOut) {
this.channelData &= ~0xff;
this.lastUsedChannels = 0;
}
if (this.sideB == fast) {
@@ -145,7 +146,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
@@ -155,7 +156,7 @@ public class GridConnection implements IGridConnection, IPathItem {
@Override
public void incrementChannelCount(final int usedChannels) {
this.channelData += usedChannels;
this.lastUsedChannels += usedChannels;
}
@Override
@@ -166,8 +167,7 @@ public class GridConnection implements IGridConnection, IPathItem {
@Override
public void finalizeChannels() {
if (this.getUsedChannels() != this.getLastUsedChannels()) {
this.channelData &= 0xff;
this.channelData |= this.channelData << 8;
this.usedChannels = this.lastUsedChannels;
if (this.sideA.getInternalGrid() != null) {
this.sideA.getInternalGrid().postEventTo(this.sideA, EVENT);
@@ -180,7 +180,7 @@ public class GridConnection implements IGridConnection, IPathItem {
}
private int getLastUsedChannels() {
return this.channelData & 0xff;
return lastUsedChannels;
}
Object getVisitorIterationNumber() {
+3 -7
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;
@@ -77,7 +77,7 @@ public class GridNode implements IGridNode, IPathItem {
}
public int usedChannels() {
return this.lastUsedChannels;
return this.usedChannels;
}
Class<? extends IGridHost> getMachineClass() {
@@ -545,7 +545,7 @@ public class GridNode implements IGridNode, IPathItem {
return;
}
if (this.getLastUsedChannels() != this.getUsedChannels()) {
if (this.lastUsedChannels != this.usedChannels) {
this.lastUsedChannels = this.usedChannels;
if (this.getInternalGrid() != null) {
@@ -554,10 +554,6 @@ public class GridNode implements IGridNode, IPathItem {
}
}
private int getLastUsedChannels() {
return this.lastUsedChannels;
}
public long getLastSecurityKey() {
return this.lastSecurityKey;
}
+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);
}
}
@@ -132,23 +132,25 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
continue;
}
if( this.craftOnly() )
{
this.didSomething = this.craftingTracker.handleCrafting( slotToExport, this.itemToSend, ais, destination, this.getTile().getWorld(), this.getProxy().getGrid(), cg, this.mySrc ) || this.didSomething;
continue;
}
if (this.craftOnly()) {
this.didSomething = this.craftingTracker.handleCrafting(slotToExport, this.itemToSend, ais, destination, this.getTile().getWorld(), this.getProxy().getGrid(), cg, this.mySrc) || this.didSomething;
continue;
}
final long before = this.itemToSend;
if (this.getInstalledUpgrades(Upgrades.FUZZY) > 0) {
for (final IAEItemStack o : ImmutableList.copyOf(inv.getStorageList().findFuzzy(ais, fzMode))) {
this.pushItemIntoTarget(destination, energy, inv, o);
if (this.itemToSend <= 0) {
break;
if (o.getStackSize() > 0) {
this.pushItemIntoTarget(destination, energy, inv, o);
if (this.itemToSend <= 0) {
break;
}
}
}
} else {
if (inv.getStorageList().findPrecise(ais) != null) {
final IAEItemStack o = inv.getStorageList().findPrecise(ais);
if (o != null && o.getStackSize() > 0) {
this.pushItemIntoTarget(destination, energy, inv, ais);
}
}
@@ -234,7 +234,7 @@ public class PartCable extends AEBasePart implements IPartCable {
howMany = Math.max(gc.getUsedChannels(), howMany);
}
data.setByte("usedChannels", (byte) howMany);
data.setInteger("usedChannels", howMany);
}
}
}
@@ -113,7 +113,7 @@ public class IMEAdaptor extends InventoryAdaptor {
IAEItemStack out = null;
for (final IAEItemStack req : ImmutableList.copyOf(this.getList().findFuzzy(reqFilter, fuzzyMode))) {
if (req != null) {
if (req != null && req.getStackSize() > 0) {
req.setStackSize(amount);
out = this.target.extractItems(req, type, this.src);
if (out != null) {