Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ebe3341bfe | |||
| 7566b3e2fc | |||
| 30c074021b | |||
| e6586ac360 | |||
| 0429fe5f21 | |||
| e16d90333b | |||
| 59c7dd1285 | |||
| 13ba399418 | |||
| 8d152afcd3 | |||
| 9fdfbbea54 | |||
| f4303fc1ec | |||
| 3c62ac79c3 | |||
| e42863643d | |||
| ace7c7d660 |
+1
-1
@@ -522,7 +522,7 @@ jar {
|
|||||||
include "assets/**"
|
include "assets/**"
|
||||||
include "mcmod.info"
|
include "mcmod.info"
|
||||||
include "pack.mcmeta"
|
include "pack.mcmeta"
|
||||||
include "META-INF/appeng_at.cfg"
|
include "META-INF/appliedenergistics2_at.cfg"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create API library jar
|
// Create API library jar
|
||||||
|
|||||||
+1
-4
@@ -3,8 +3,6 @@ aechannel=stable
|
|||||||
aebuild=7
|
aebuild=7
|
||||||
aegroup=appeng
|
aegroup=appeng
|
||||||
aebasename=appliedenergistics2
|
aebasename=appliedenergistics2
|
||||||
extended=extended_life
|
|
||||||
extendedversion=v0.55.16
|
|
||||||
#########################################################
|
#########################################################
|
||||||
# Versions #
|
# Versions #
|
||||||
#########################################################
|
#########################################################
|
||||||
@@ -22,7 +20,6 @@ jei_version=4.16.1.302
|
|||||||
tesla_version=1.0.63
|
tesla_version=1.0.63
|
||||||
ic2_version=2.8.73-ex112
|
ic2_version=2.8.73-ex112
|
||||||
top_version=1.12-1.4.23-16
|
top_version=1.12-1.4.23-16
|
||||||
cofhcore_version=1.12.2-4.5.2.19
|
|
||||||
crafttweaker_version=4.1.20.684
|
crafttweaker_version=4.1.20.684
|
||||||
ctm_version=MC1.12.2-0.3.1.16
|
ctm_version=MC1.12.2-0.3.1.16
|
||||||
forestry_version=5.8.2.387
|
forestry_version=5.8.2.387
|
||||||
@@ -42,7 +39,7 @@ modId=appliedenergistics2
|
|||||||
modGroup=appeng
|
modGroup=appeng
|
||||||
# Version of your mod.
|
# 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.
|
# 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)
|
# Whether to use the old jar naming structure (modid-mcversion-version) instead of the new version (modid-version)
|
||||||
includeMCVersionJar=false
|
includeMCVersionJar=false
|
||||||
# The name of your jar when you produce builds, not including any versioning info
|
# The name of your jar when you produce builds, not including any versioning info
|
||||||
|
|||||||
@@ -81,11 +81,11 @@ configurations {
|
|||||||
dependencies {
|
dependencies {
|
||||||
// deobfCompile "gregtechce:gregtech:1.12.2:1.15.1.735"
|
// deobfCompile "gregtechce:gregtech:1.12.2:1.15.1.735"
|
||||||
// installable runtime dependencies
|
// 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"
|
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 "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
||||||
mods "curse.maven:hwyla-253449:2568751"
|
mods "curse.maven:hwyla-253449:2568751"
|
||||||
mods "net.industrial-craft:industrialcraft-2:${ic2_version}:dev"
|
mods "net.industrial-craft:industrialcraft-2:${ic2_version}:dev"
|
||||||
@@ -96,7 +96,7 @@ dependencies {
|
|||||||
//compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
//compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
||||||
compileOnly "curse.maven:hwyla-253449:2568751"
|
compileOnly "curse.maven:hwyla-253449:2568751"
|
||||||
//Code chicken lib, GTCE dependency
|
//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:recipe-stages-280554:3405072"
|
||||||
compileOnly "curse.maven:item-stages-280316:2696769"
|
compileOnly "curse.maven:item-stages-280316:2696769"
|
||||||
@@ -104,13 +104,13 @@ dependencies {
|
|||||||
compileOnly "net.darkhax.tesla:Tesla-1.12.2:${tesla_version}"
|
compileOnly "net.darkhax.tesla:Tesla-1.12.2:${tesla_version}"
|
||||||
compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
|
compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
|
||||||
compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_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 "CraftTweaker2:CraftTweaker2-API:${crafttweaker_version}"
|
||||||
compileOnly "curse.maven:inventory-tweaks-223094:2482482"
|
compileOnly "curse.maven:inventory-tweaks-223094:2482482"
|
||||||
compileOnly "curse.maven:inventory-bogo-sorter-632327:4399738"
|
compileOnly "curse.maven:inventory-bogo-sorter-632327:4399738"
|
||||||
compileOnly "team.chisel.ctm:CTM:${ctm_version}"
|
compileOnly "team.chisel.ctm:CTM:${ctm_version}"
|
||||||
compileOnly "de.ellpeck.actuallyadditions:ActuallyAdditions:1.12.2-r152.16:api"
|
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
|
// at runtime, use the full JEI jar
|
||||||
runtimeOnly "mezz.jei:jei_${minecraft_version}:${jei_version}"
|
runtimeOnly "mezz.jei:jei_${minecraft_version}:${jei_version}"
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class GuiOreDictStorageBus extends AEBaseGui {
|
|||||||
private GuiImgButton partition;
|
private GuiImgButton partition;
|
||||||
private GuiImgButton storageFilter;
|
private GuiImgButton storageFilter;
|
||||||
private GuiImgButton rwMode;
|
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;
|
private MEGuiTextField searchFieldInputs;
|
||||||
|
|
||||||
public GuiOreDictStorageBus(final InventoryPlayer inventoryPlayer, final PartOreDicStorageBus te) {
|
public GuiOreDictStorageBus(final InventoryPlayer inventoryPlayer, final PartOreDicStorageBus te) {
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ public class ItemRepo {
|
|||||||
|
|
||||||
public void setViewCell(final ItemStack[] list) {
|
public void setViewCell(final ItemStack[] list) {
|
||||||
this.myPartitionList = ItemViewCell.createFilter(list);
|
this.myPartitionList = ItemViewCell.createFilter(list);
|
||||||
this.updateView();
|
this.changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateView() {
|
public void updateView() {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ package appeng.client.render.cablebus;
|
|||||||
import appeng.api.util.AECableType;
|
import appeng.api.util.AECableType;
|
||||||
import appeng.api.util.AEColor;
|
import appeng.api.util.AEColor;
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
|
import appeng.core.AEConfig;
|
||||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||||
@@ -327,8 +328,8 @@ class CableBuilder {
|
|||||||
TextureAtlasSprite texture = this.connectionTextures.get(AECableType.SMART).get(cableColor);
|
TextureAtlasSprite texture = this.connectionTextures.get(AECableType.SMART).get(cableColor);
|
||||||
cubeBuilder.setTexture(texture);
|
cubeBuilder.setTexture(texture);
|
||||||
|
|
||||||
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels(channels);
|
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8)));
|
||||||
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
|
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8)));
|
||||||
|
|
||||||
// For to-machine connections, use a thicker end-cap for the connection
|
// For to-machine connections, use a thicker end-cap for the connection
|
||||||
if (connectionType != AECableType.GLASS && !cableBusAdjacent) {
|
if (connectionType != AECableType.GLASS && !cableBusAdjacent) {
|
||||||
@@ -374,8 +375,8 @@ class CableBuilder {
|
|||||||
|
|
||||||
addStraightCoveredCableSizedCube(facing, cubeBuilder);
|
addStraightCoveredCableSizedCube(facing, cubeBuilder);
|
||||||
|
|
||||||
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels(channels);
|
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8)));
|
||||||
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
|
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8)));
|
||||||
|
|
||||||
// Render the channel indicators brightly lit at night
|
// Render the channel indicators brightly lit at night
|
||||||
cubeBuilder.setRenderFullBright(true);
|
cubeBuilder.setRenderFullBright(true);
|
||||||
@@ -403,8 +404,8 @@ class CableBuilder {
|
|||||||
|
|
||||||
addCoveredCableSizedCube(facing, distanceFromEdge, cubeBuilder);
|
addCoveredCableSizedCube(facing, distanceFromEdge, cubeBuilder);
|
||||||
|
|
||||||
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels(channels);
|
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8)));
|
||||||
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
|
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8)));
|
||||||
|
|
||||||
// Render the channel indicators brightly lit at night
|
// Render the channel indicators brightly lit at night
|
||||||
cubeBuilder.setRenderFullBright(true);
|
cubeBuilder.setRenderFullBright(true);
|
||||||
@@ -464,7 +465,7 @@ class CableBuilder {
|
|||||||
addDenseCableSizedCube(facing, cubeBuilder);
|
addDenseCableSizedCube(facing, cubeBuilder);
|
||||||
|
|
||||||
// Dense cables show used channels in groups of 4, rounded up
|
// 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 oddChannel = this.smartCableTextures.getOddTextureForChannels(channels);
|
||||||
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
|
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
|
||||||
@@ -508,7 +509,7 @@ class CableBuilder {
|
|||||||
addStraightDenseCableSizedCube(facing, cubeBuilder);
|
addStraightDenseCableSizedCube(facing, cubeBuilder);
|
||||||
|
|
||||||
// Dense cables show used channels in groups of 4, rounded up
|
// 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 oddChannel = this.smartCableTextures.getOddTextureForChannels(channels);
|
||||||
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
|
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ package appeng.client.render.model;
|
|||||||
|
|
||||||
import appeng.block.AEBaseTileBlock;
|
import appeng.block.AEBaseTileBlock;
|
||||||
import appeng.client.render.FacingToRotation;
|
import appeng.client.render.FacingToRotation;
|
||||||
import com.google.common.base.Objects;
|
|
||||||
import com.google.common.cache.CacheBuilder;
|
import com.google.common.cache.CacheBuilder;
|
||||||
import com.google.common.cache.CacheLoader;
|
import com.google.common.cache.CacheLoader;
|
||||||
import com.google.common.cache.LoadingCache;
|
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.ItemCameraTransforms;
|
||||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
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.IResourceManager;
|
||||||
import net.minecraft.client.resources.IResourceManagerReloadListener;
|
import net.minecraft.client.resources.IResourceManagerReloadListener;
|
||||||
import net.minecraft.util.EnumFacing;
|
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 net.minecraftforge.common.property.IExtendedBlockState;
|
||||||
|
|
||||||
import javax.vecmath.Vector3f;
|
import javax.vecmath.Matrix4f;
|
||||||
|
import javax.vecmath.Tuple4f;
|
||||||
import javax.vecmath.Vector4f;
|
import javax.vecmath.Vector4f;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static net.minecraft.util.EnumFacing.DOWN;
|
||||||
|
|
||||||
|
|
||||||
public class AutoRotatingModel implements IBakedModel, IResourceManagerReloadListener {
|
public class AutoRotatingModel implements IBakedModel, IResourceManagerReloadListener {
|
||||||
|
|
||||||
@@ -68,34 +64,171 @@ public class AutoRotatingModel implements IBakedModel, IResourceManagerReloadLis
|
|||||||
FacingToRotation f2r = FacingToRotation.get(forward, up);
|
FacingToRotation f2r = FacingToRotation.get(forward, up);
|
||||||
List<BakedQuad> original = AutoRotatingModel.this.parent.getQuads(state, f2r.resultingRotate(side), 0);
|
List<BakedQuad> original = AutoRotatingModel.this.parent.getQuads(state, f2r.resultingRotate(side), 0);
|
||||||
List<BakedQuad> rotated = new ArrayList<>(original.size());
|
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);
|
|
||||||
|
|
||||||
}
|
final Matrix4f transformMatrix = new Matrix4f();
|
||||||
BakedQuad unpackedQuad = builder.build();
|
final Tuple4f vertexTransformingVec = new Vector4f();
|
||||||
|
|
||||||
// Make a copy of it to resolve the vertex data and throw away the unpacked stuff
|
// Transform the matrix so the top and front facings of the model matches the block in-world
|
||||||
// This also fixes a bug in Forge's UnpackedBakedQuad, which unpacks a byte-based normal like 0,0,-1
|
transformMatrixByFacings(transformMatrix, up, forward);
|
||||||
// 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.
|
for (BakedQuad b : original) {
|
||||||
// Packing it back to the vanilla vertex format will fix this inconsistency because it converts
|
EnumFacing newFace = f2r.rotate(b.getFace());
|
||||||
// the normal back to a byte-based format, which then re-applies Forge's own bug when piping it
|
rotated.add(rebakeQuad(b, newFace, transformMatrix, vertexTransformingVec));
|
||||||
// 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);
|
|
||||||
}
|
}
|
||||||
return rotated;
|
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
|
@Override
|
||||||
public boolean isAmbientOcclusion() {
|
public boolean isAmbientOcclusion() {
|
||||||
return this.parent.isAmbientOcclusion();
|
return this.parent.isAmbientOcclusion();
|
||||||
@@ -159,140 +292,4 @@ public class AutoRotatingModel implements IBakedModel, IResourceManagerReloadLis
|
|||||||
this.quadCache.invalidateAll();
|
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.BlockDrive;
|
||||||
import appeng.block.storage.DriveSlotState;
|
import appeng.block.storage.DriveSlotState;
|
||||||
import appeng.block.storage.DriveSlotsState;
|
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.block.state.IBlockState;
|
||||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
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.minecraft.util.EnumFacing;
|
||||||
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
|
|
||||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.vecmath.Matrix4f;
|
import javax.vecmath.Matrix4f;
|
||||||
|
import javax.vecmath.Tuple4f;
|
||||||
import javax.vecmath.Vector3f;
|
import javax.vecmath.Vector3f;
|
||||||
|
import javax.vecmath.Vector4f;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class DriveBakedModel implements IBakedModel {
|
public class DriveBakedModel implements IBakedModel, IResourceManagerReloadListener {
|
||||||
private final IBakedModel bakedBase;
|
private final IBakedModel bakedBase;
|
||||||
private final Map<DriveSlotState, IBakedModel> bakedCells;
|
private final Map<DriveSlotState, IBakedModel> bakedCells;
|
||||||
|
private final Int2ObjectMap<Map<DriveSlotState, List<BakedQuad>>> slot2DSMap = new Int2ObjectOpenHashMap<>();
|
||||||
|
|
||||||
public DriveBakedModel(IBakedModel bakedBase, Map<DriveSlotState, IBakedModel> bakedCells) {
|
public DriveBakedModel(IBakedModel bakedBase, Map<DriveSlotState, IBakedModel> bakedCells) {
|
||||||
this.bakedBase = bakedBase;
|
this.bakedBase = bakedBase;
|
||||||
@@ -52,8 +59,7 @@ public class DriveBakedModel implements IBakedModel {
|
|||||||
|
|
||||||
List<BakedQuad> result = new ArrayList<>(this.bakedBase.getQuads(state, side, rand));
|
List<BakedQuad> result = new ArrayList<>(this.bakedBase.getQuads(state, side, rand));
|
||||||
|
|
||||||
if (side == null && state instanceof IExtendedBlockState) {
|
if (side == null && state instanceof IExtendedBlockState extState) {
|
||||||
IExtendedBlockState extState = (IExtendedBlockState) state;
|
|
||||||
|
|
||||||
if (!extState.getUnlistedNames().contains(BlockDrive.SLOTS_STATE)) {
|
if (!extState.getUnlistedNames().contains(BlockDrive.SLOTS_STATE)) {
|
||||||
return result;
|
return result;
|
||||||
@@ -61,31 +67,38 @@ public class DriveBakedModel implements IBakedModel {
|
|||||||
|
|
||||||
DriveSlotsState slotsState = extState.getValue(BlockDrive.SLOTS_STATE);
|
DriveSlotsState slotsState = extState.getValue(BlockDrive.SLOTS_STATE);
|
||||||
|
|
||||||
|
|
||||||
for (int row = 0; row < 5; row++) {
|
for (int row = 0; row < 5; row++) {
|
||||||
for (int col = 0; col < 2; col++) {
|
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();
|
slot2DSMap.putIfAbsent(slot, new Object2ObjectOpenHashMap<>());
|
||||||
transform.setIdentity();
|
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
|
final Matrix4f transformMatrix = new Matrix4f();
|
||||||
// the
|
transformMatrix.setIdentity();
|
||||||
// cell-model being in slot 0,0 at the top left of the drive.
|
final Tuple4f transform = new Vector4f();
|
||||||
float xOffset = -col * 8 / 16.0f;
|
|
||||||
float yOffset = -row * 3 / 16.0f;
|
|
||||||
|
|
||||||
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);
|
transformMatrix.setTranslation(new Vector3f(xOffset, yOffset, 0));
|
||||||
for (BakedQuad bakedQuad : bakedCell.getQuads(state, null, rand)) {
|
|
||||||
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(bakedQuad.getFormat());
|
for (BakedQuad bakedQuad : bakedCell.getQuads(state, null, rand)) {
|
||||||
transformer.setParent(builder);
|
res.add(rebakeQuad(bakedQuad, transformMatrix, transform));
|
||||||
transformer.setVertexFormat(builder.getVertexFormat());
|
}
|
||||||
bakedQuad.pipe(transformer);
|
return res;
|
||||||
result.add(builder.build());
|
});
|
||||||
}
|
result.addAll(lbq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -93,6 +106,41 @@ public class DriveBakedModel implements IBakedModel {
|
|||||||
return result;
|
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
|
@Override
|
||||||
public boolean isAmbientOcclusion() {
|
public boolean isAmbientOcclusion() {
|
||||||
return this.bakedBase.isAmbientOcclusion();
|
return this.bakedBase.isAmbientOcclusion();
|
||||||
@@ -122,4 +170,9 @@ public class DriveBakedModel implements IBakedModel {
|
|||||||
public ItemOverrideList getOverrides() {
|
public ItemOverrideList getOverrides() {
|
||||||
return this.bakedBase.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.Actionable;
|
||||||
import appeng.api.config.SecurityPermissions;
|
import appeng.api.config.SecurityPermissions;
|
||||||
import appeng.api.networking.IGrid;
|
import appeng.api.networking.IGrid;
|
||||||
|
import appeng.api.networking.IGridNode;
|
||||||
import appeng.api.networking.crafting.ICraftingCPU;
|
import appeng.api.networking.crafting.ICraftingCPU;
|
||||||
import appeng.api.networking.crafting.ICraftingGrid;
|
import appeng.api.networking.crafting.ICraftingGrid;
|
||||||
import appeng.api.networking.crafting.ICraftingJob;
|
import appeng.api.networking.crafting.ICraftingJob;
|
||||||
@@ -125,7 +126,19 @@ public class ContainerCraftConfirm extends AEBaseContainer {
|
|||||||
return;
|
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();
|
final ImmutableSet<ICraftingCPU> cpuSet = cc.getCpus();
|
||||||
|
|
||||||
int matches = 0;
|
int matches = 0;
|
||||||
@@ -199,7 +212,7 @@ public class ContainerCraftConfirm extends AEBaseContainer {
|
|||||||
p.reset();
|
p.reset();
|
||||||
p.setStackSize(out.getCountRequestable());
|
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));
|
final IMEInventory<IAEItemStack> items = sg.getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
|
||||||
|
|
||||||
IAEItemStack m = null;
|
IAEItemStack m = null;
|
||||||
@@ -252,11 +265,6 @@ public class ContainerCraftConfirm extends AEBaseContainer {
|
|||||||
this.verifyPermissions(SecurityPermissions.CRAFT, false);
|
this.verifyPermissions(SecurityPermissions.CRAFT, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IGrid getGrid() {
|
|
||||||
final IActionHost h = ((IActionHost) this.getTarget());
|
|
||||||
return h.getActionableNode().getGrid();
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean cpuMatches(final ICraftingCPU c) {
|
private boolean cpuMatches(final ICraftingCPU c) {
|
||||||
return c.getAvailableStorage() >= this.getUsedBytes() && !c.isBusy();
|
return c.getAvailableStorage() >= this.getUsedBytes() && !c.isBusy();
|
||||||
}
|
}
|
||||||
@@ -301,12 +309,22 @@ public class ContainerCraftConfirm extends AEBaseContainer {
|
|||||||
originalGui = GuiBridge.GUI_EXPANDED_PROCESSING_PATTERN_TERMINAL;
|
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()) {
|
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());
|
final ICraftingLink g = cc.submitJob(this.result, null, this.getSelectedCpu() == -1 ? null : this.cpus.get(this.getSelectedCpu()).getCpu(), true, this.getActionSrc());
|
||||||
this.setAutoStart(false);
|
this.setAutoStart(false);
|
||||||
if (g == null) {
|
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) {
|
} else if (originalGui != null && this.getOpenContext() != null) {
|
||||||
final TileEntity te = this.getOpenContext().getTile();
|
final TileEntity te = this.getOpenContext().getTile();
|
||||||
if (te != null) {
|
if (te != null) {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable implements I
|
|||||||
private int ticks = 0;
|
private int ticks = 0;
|
||||||
|
|
||||||
public ContainerMEPortableCell(InventoryPlayer ip, IPortableCell guiObject) {
|
public ContainerMEPortableCell(InventoryPlayer ip, IPortableCell guiObject) {
|
||||||
super(ip, guiObject, guiObject, true);
|
super(ip, guiObject, guiObject, false);
|
||||||
if (guiObject != null) {
|
if (guiObject != null) {
|
||||||
final int slotIndex = ((IInventorySlotAware) guiObject).getInventorySlot();
|
final int slotIndex = ((IInventorySlotAware) guiObject).getInventorySlot();
|
||||||
if (!((IInventorySlotAware) guiObject).isBaubleSlot()) {
|
if (!((IInventorySlotAware) guiObject).isBaubleSlot()) {
|
||||||
@@ -47,6 +47,9 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable implements I
|
|||||||
this.slot = -1;
|
this.slot = -1;
|
||||||
this.lockPlayerInventorySlot(ip.currentItem);
|
this.lockPlayerInventorySlot(ip.currentItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.bindPlayerInventory(ip, 0, 0);
|
||||||
|
|
||||||
this.portableCell = guiObject;
|
this.portableCell = guiObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ public class ContainerMEPortableTerminal extends ContainerMEMonitorable implemen
|
|||||||
this.slot = -1;
|
this.slot = -1;
|
||||||
this.lockPlayerInventorySlot(ip.currentItem);
|
this.lockPlayerInventorySlot(ip.currentItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.bindPlayerInventory(ip, 0, 0);
|
||||||
|
|
||||||
this.wirelessTerminalGUIObject = guiObject;
|
this.wirelessTerminalGUIObject = guiObject;
|
||||||
this.upgrades = new StackUpgradeInventory(wirelessTerminalGUIObject.getItemStack(), this, 2);
|
this.upgrades = new StackUpgradeInventory(wirelessTerminalGUIObject.getItemStack(), this, 2);
|
||||||
this.loadFromNBT();
|
this.loadFromNBT();
|
||||||
@@ -107,7 +110,7 @@ public class ContainerMEPortableTerminal extends ContainerMEMonitorable implemen
|
|||||||
if (wirelessTerminalGUIObject.isBaubleSlot()) {
|
if (wirelessTerminalGUIObject.isBaubleSlot()) {
|
||||||
BaublesApi.getBaublesHandler(this.getPlayerInv().player).setStackInSlot(this.slot, this.wirelessTerminalGUIObject.getItemStack());
|
BaublesApi.getBaublesHandler(this.getPlayerInv().player).setStackInSlot(this.slot, this.wirelessTerminalGUIObject.getItemStack());
|
||||||
} else {
|
} else {
|
||||||
this.getPlayerInv().setInventorySlotContents(this.getPlayerInv().currentItem, this.wirelessTerminalGUIObject.getItemStack());
|
this.getPlayerInv().setInventorySlotContents(this.slot, this.wirelessTerminalGUIObject.getItemStack());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.setValidContainer(false);
|
this.setValidContainer(false);
|
||||||
|
|||||||
@@ -191,6 +191,9 @@ public abstract class ContainerPatternEncoder extends ContainerMEMonitorable imp
|
|||||||
}
|
}
|
||||||
this.detectAndSendChanges();
|
this.detectAndSendChanges();
|
||||||
}
|
}
|
||||||
|
if (s == this.craftSlot && Platform.isClient()) {
|
||||||
|
this.getAndUpdateOutput();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void encodeAndMoveToInventory() {
|
public void encodeAndMoveToInventory() {
|
||||||
|
|||||||
+3
-1
@@ -50,7 +50,7 @@ public class ContainerWirelessCraftingTerminal extends ContainerMEPortableTermin
|
|||||||
private IRecipe currentRecipe;
|
private IRecipe currentRecipe;
|
||||||
|
|
||||||
public ContainerWirelessCraftingTerminal(final InventoryPlayer ip, final WirelessTerminalGuiObject gui) {
|
public ContainerWirelessCraftingTerminal(final InventoryPlayer ip, final WirelessTerminalGuiObject gui) {
|
||||||
super(ip, gui, true);
|
super(ip, gui, false);
|
||||||
|
|
||||||
final IItemHandler crafting = this.craftingGrid;
|
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
|
this.addSlotToContainer(this.outputSlot = new SlotCraftingTerm(this.getPlayerInv().player, this.getActionSource(), this
|
||||||
.getPowerSource(), this.wirelessTerminalGUIObject, crafting, crafting, this.output, 131, -72 + 18, this));
|
.getPowerSource(), this.wirelessTerminalGUIObject, crafting, crafting, this.output, 131, -72 + 18, this));
|
||||||
|
|
||||||
|
this.bindPlayerInventory(ip, 0, 0);
|
||||||
|
|
||||||
this.onCraftMatrixChanged(new WrapperInvItemHandler(crafting));
|
this.onCraftMatrixChanged(new WrapperInvItemHandler(crafting));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -138,7 +138,7 @@ public class ContainerWirelessPatternTerminal extends ContainerPatternEncoder im
|
|||||||
if (wirelessTerminalGUIObject.isBaubleSlot()) {
|
if (wirelessTerminalGUIObject.isBaubleSlot()) {
|
||||||
BaublesApi.getBaublesHandler(this.getPlayerInv().player).setStackInSlot(this.slot, this.wirelessTerminalGUIObject.getItemStack());
|
BaublesApi.getBaublesHandler(this.getPlayerInv().player).setStackInSlot(this.slot, this.wirelessTerminalGUIObject.getItemStack());
|
||||||
} else {
|
} else {
|
||||||
this.getPlayerInv().setInventorySlotContents(this.getPlayerInv().currentItem, this.wirelessTerminalGUIObject.getItemStack());
|
this.getPlayerInv().setInventorySlotContents(this.slot, this.wirelessTerminalGUIObject.getItemStack());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.setValidContainer(false);
|
this.setValidContainer(false);
|
||||||
|
|||||||
@@ -26,6 +26,6 @@ import net.minecraft.entity.player.InventoryPlayer;
|
|||||||
public class ContainerWirelessTerm extends ContainerMEPortableTerminal {
|
public class ContainerWirelessTerm extends ContainerMEPortableTerminal {
|
||||||
|
|
||||||
public ContainerWirelessTerm(final InventoryPlayer ip, final WirelessTerminalGuiObject gui) {
|
public ContainerWirelessTerm(final InventoryPlayer ip, final WirelessTerminalGuiObject gui) {
|
||||||
super(ip, gui, true);
|
super(ip, gui, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
|||||||
private int craftingCalculationTimePerTick = 5;
|
private int craftingCalculationTimePerTick = 5;
|
||||||
private PowerUnits selectedPowerUnit = PowerUnits.AE;
|
private PowerUnits selectedPowerUnit = PowerUnits.AE;
|
||||||
private boolean showCraftableTooltip = true;
|
private boolean showCraftableTooltip = true;
|
||||||
|
|
||||||
// Spatial IO/Dimension
|
// Spatial IO/Dimension
|
||||||
private int storageProviderID = -1;
|
private int storageProviderID = -1;
|
||||||
private int storageDimensionID = -1;
|
private int storageDimensionID = -1;
|
||||||
@@ -122,6 +123,9 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
|||||||
private int maxControllerSizeY = 7;
|
private int maxControllerSizeY = 7;
|
||||||
private int maxControllerSizeZ = 7;
|
private int maxControllerSizeZ = 7;
|
||||||
|
|
||||||
|
private int normalChannelCapacity = 8;
|
||||||
|
private int denseChannelCapacity = 32;
|
||||||
|
|
||||||
private AEConfig(final File configFile) {
|
private AEConfig(final File configFile) {
|
||||||
super(configFile);
|
super(configFile);
|
||||||
this.configFile = 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);
|
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.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.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();
|
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.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.maxControllerSizeZ = Math.min(Math.max(this.get("ControllerSize", "maxControllerSizeZ", this.maxControllerSizeZ).getInt(this.maxControllerSizeZ), 1), 63);
|
||||||
|
|
||||||
|
|
||||||
this.clientSync();
|
this.clientSync();
|
||||||
|
|
||||||
this.addCustomCategoryComment("features", "Warning: Disabling a feature may disable other features depending on it.");
|
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() {
|
public int getMaxControllerSizeZ() {
|
||||||
return this.maxControllerSizeZ;
|
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())) {
|
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);
|
Collection<IAEItemStack> outList = inv.getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)).getStorageList().findFuzzy(request, FuzzyMode.IGNORE_ALL);
|
||||||
for (IAEItemStack is : outList) {
|
for (IAEItemStack is : outList) {
|
||||||
|
if (is.getStackSize() == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (Platform.isGTDamageableItem(request.getItem())) {
|
if (Platform.isGTDamageableItem(request.getItem())) {
|
||||||
if (!(is.getDefinition().getMetadata() == request.getDefinition().getMetadata())) {
|
if (!(is.getDefinition().getMetadata() == request.getDefinition().getMetadata())) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -33,12 +33,14 @@ import appeng.core.sync.packets.PacketInformPlayer;
|
|||||||
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import appeng.util.item.AEItemStack;
|
import appeng.util.item.AEItemStack;
|
||||||
|
import appeng.util.item.MeaningfulItemIterator;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -110,32 +112,37 @@ public class CraftingTreeNode {
|
|||||||
if (this.parent.details.canSubstitute()) {
|
if (this.parent.details.canSubstitute()) {
|
||||||
for (IAEItemStack subs : this.parent.details.getSubstituteInputs(this.slot)) {
|
for (IAEItemStack subs : this.parent.details.getSubstituteInputs(this.slot)) {
|
||||||
if (damageableItem) {
|
if (damageableItem) {
|
||||||
for (IAEItemStack i : inventoryList.findFuzzy(subs, FuzzyMode.IGNORE_ALL)) {
|
Iterator<IAEItemStack> it = new MeaningfulItemIterator<>(inventoryList.findFuzzy(this.what, FuzzyMode.IGNORE_ALL));
|
||||||
itemList.add(i);
|
while (it.hasNext()) {
|
||||||
|
IAEItemStack i = it.next();
|
||||||
|
if (i.getStackSize() > 0) {
|
||||||
|
itemList.add(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
subs = inventoryList.findPrecise(subs);
|
subs = inventoryList.findPrecise(subs);
|
||||||
if (subs != null) {
|
if (subs != null && subs.getStackSize() > 0) {
|
||||||
itemList.add(subs);
|
itemList.add(subs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (damageableItem) {
|
if (damageableItem) {
|
||||||
for (IAEItemStack i : inventoryList.findFuzzy(this.what, FuzzyMode.IGNORE_ALL)) {
|
Iterator<IAEItemStack> it = new MeaningfulItemIterator<>(inventoryList.findFuzzy(this.what, FuzzyMode.IGNORE_ALL));
|
||||||
itemList.add(i);
|
while (it.hasNext()) {
|
||||||
|
IAEItemStack i = it.next();
|
||||||
|
if (i.getStackSize() > 0) {
|
||||||
|
itemList.add(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
final IAEItemStack item = inventoryList.findPrecise(this.what);
|
final IAEItemStack item = inventoryList.findPrecise(this.what);
|
||||||
if (item != null) {
|
if (item != null && item.getStackSize() > 0) {
|
||||||
itemList.add(item);
|
itemList.add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (IAEItemStack fuzz : itemList) {
|
for (IAEItemStack fuzz : itemList) {
|
||||||
if (fuzz.getStackSize() == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (this.parent.details.isValidItemForSlot(this.getSlot(), fuzz.getDefinition(), this.world)) {
|
if (this.parent.details.isValidItemForSlot(this.getSlot(), fuzz.getDefinition(), this.world)) {
|
||||||
fuzz = fuzz.copy();
|
fuzz = fuzz.copy();
|
||||||
fuzz.setStackSize(l);
|
fuzz.setStackSize(l);
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ public class ContainerMEPortableFluidCell extends AEBaseContainer implements IAE
|
|||||||
if (wirelessTerminalGUIObject.isBaubleSlot()) {
|
if (wirelessTerminalGUIObject.isBaubleSlot()) {
|
||||||
BaublesApi.getBaublesHandler(this.getPlayerInv().player).setStackInSlot(this.slot, this.wirelessTerminalGUIObject.getItemStack());
|
BaublesApi.getBaublesHandler(this.getPlayerInv().player).setStackInSlot(this.slot, this.wirelessTerminalGUIObject.getItemStack());
|
||||||
} else {
|
} else {
|
||||||
this.getPlayerInv().setInventorySlotContents(this.getPlayerInv().currentItem, this.wirelessTerminalGUIObject.getItemStack());
|
this.getPlayerInv().setInventorySlotContents(this.slot, this.wirelessTerminalGUIObject.getItemStack());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.setValidContainer(false);
|
this.setValidContainer(false);
|
||||||
|
|||||||
@@ -109,8 +109,7 @@ public class JEIMissingItem implements IRecipeTransferError {
|
|||||||
@Override
|
@Override
|
||||||
public void showError(Minecraft minecraft, int mouseX, int mouseY, @Nonnull IRecipeLayout recipeLayout, int recipeX, int recipeY) {
|
public void showError(Minecraft minecraft, int mouseX, int mouseY, @Nonnull IRecipeLayout recipeLayout, int recipeX, int recipeY) {
|
||||||
Container c = minecraft.player.openContainer;
|
Container c = minecraft.player.openContainer;
|
||||||
if (c instanceof ContainerMEMonitorable) {
|
if (c instanceof ContainerMEMonitorable container) {
|
||||||
ContainerMEMonitorable container = (ContainerMEMonitorable) c;
|
|
||||||
IItemList<IAEItemStack> ir = ((ContainerMEMonitorable) c).items;
|
IItemList<IAEItemStack> ir = ((ContainerMEMonitorable) c).items;
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
boolean foundAny = false;
|
boolean foundAny = false;
|
||||||
@@ -148,8 +147,7 @@ public class JEIMissingItem implements IRecipeTransferError {
|
|||||||
if (i.isInput()) {
|
if (i.isInput()) {
|
||||||
List<?> allIngredients = i.getAllIngredients();
|
List<?> allIngredients = i.getAllIngredients();
|
||||||
for (Object allIngredient : allIngredients) {
|
for (Object allIngredient : allIngredients) {
|
||||||
if (allIngredient instanceof ItemStack) {
|
if (allIngredient instanceof ItemStack stack) {
|
||||||
ItemStack stack = (ItemStack) allIngredient;
|
|
||||||
if (!stack.isEmpty()) {
|
if (!stack.isEmpty()) {
|
||||||
IAEItemStack search = AEItemStack.fromItemStack(stack);
|
IAEItemStack search = AEItemStack.fromItemStack(stack);
|
||||||
if (stack.getItem().isDamageable() || Platform.isGTDamageableItem(stack.getItem())) {
|
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())) {
|
if (ext.getStackSize() > 0 && (usedStack == null || usedStack.getStackSize() < ext.getStackSize())) {
|
||||||
used.add(ext.copy().setStackSize(1));
|
used.add(ext.copy().setStackSize(1));
|
||||||
if (craftable) {
|
if (craftable) {
|
||||||
valid = null;
|
valid.resetStatus();
|
||||||
}
|
}
|
||||||
valid.add(ext.copy().setStackSize(1));
|
valid.add(ext.copy().setStackSize(1));
|
||||||
found = true;
|
found = true;
|
||||||
@@ -199,13 +197,13 @@ public class JEIMissingItem implements IRecipeTransferError {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ArrayList<ItemStack> validStacks = new ArrayList<>();
|
ArrayList<ItemStack> validStacks = new ArrayList<>();
|
||||||
if (valid != null) {
|
valid.forEach(v -> {
|
||||||
valid.forEach(v -> {
|
if (v.getStackSize() > 0) {
|
||||||
ItemStack validStack = v.createItemStack();
|
ItemStack validStack = v.createItemStack();
|
||||||
validStack.setCount(1);
|
validStack.setCount(1);
|
||||||
validStacks.add(validStack);
|
validStacks.add(validStack);
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
if (!found) {
|
if (!found) {
|
||||||
if (craftable) {
|
if (craftable) {
|
||||||
i.drawHighlight(minecraft, new Color(0.0f, 0.0f, 1.0f, 0.4f), recipeX, recipeY);
|
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) {
|
if (part instanceof PartDenseCableSmart || part instanceof PartCableSmart) {
|
||||||
final int usedChannels;
|
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()) {
|
if (part.getGridNode().isActive()) {
|
||||||
final NBTTagCompound tmp = new NBTTagCompound();
|
final NBTTagCompound tmp = new NBTTagCompound();
|
||||||
part.writeToNBT(tmp);
|
part.writeToNBT(tmp);
|
||||||
usedChannels = tmp.getByte("usedChannels");
|
usedChannels = tmp.getInteger("usedChannels");
|
||||||
} else {
|
} else {
|
||||||
usedChannels = 0;
|
usedChannels = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ import appeng.core.localization.WailaText;
|
|||||||
import appeng.parts.networking.PartCableSmart;
|
import appeng.parts.networking.PartCableSmart;
|
||||||
import appeng.parts.networking.PartDenseCableSmart;
|
import appeng.parts.networking.PartDenseCableSmart;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ByteMap;
|
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.IWailaConfigHandler;
|
||||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
@@ -59,7 +60,7 @@ public final class ChannelWailaDataProvider extends BasePartWailaDataProvider {
|
|||||||
* <p/>
|
* <p/>
|
||||||
* The cache will be updated from the server.
|
* 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
|
* 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) {
|
if (part instanceof PartCableSmart || part instanceof PartDenseCableSmart) {
|
||||||
final NBTTagCompound tag = accessor.getNBTData();
|
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) {
|
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);
|
final String formattedToolTip = String.format(WailaText.Channels.getLocal(), usedChannels, maxChannels);
|
||||||
currentToolTip.add(formattedToolTip);
|
currentToolTip.add(formattedToolTip);
|
||||||
@@ -102,11 +103,11 @@ public final class ChannelWailaDataProvider extends BasePartWailaDataProvider {
|
|||||||
* @param cache cache with previous knowledge
|
* @param cache cache with previous knowledge
|
||||||
* @return used channels on the cable
|
* @return used channels on the cable
|
||||||
*/
|
*/
|
||||||
private byte getUsedChannels(final IPart part, final NBTTagCompound tag, final Object2ByteMap<IPart> cache) {
|
private int getUsedChannels(final IPart part, final NBTTagCompound tag, final Object2IntMap<IPart> cache) {
|
||||||
final byte usedChannels;
|
final int usedChannels;
|
||||||
|
|
||||||
if (tag.hasKey(ID_USED_CHANNELS)) {
|
if (tag.hasKey(ID_USED_CHANNELS)) {
|
||||||
usedChannels = tag.getByte(ID_USED_CHANNELS);
|
usedChannels = tag.getInteger(ID_USED_CHANNELS);
|
||||||
this.cache.put(part, usedChannels);
|
this.cache.put(part, usedChannels);
|
||||||
} else if (this.cache.containsKey(part)) {
|
} else if (this.cache.containsKey(part)) {
|
||||||
usedChannels = this.cache.get(part);
|
usedChannels = this.cache.get(part);
|
||||||
@@ -139,9 +140,9 @@ public final class ChannelWailaDataProvider extends BasePartWailaDataProvider {
|
|||||||
part.writeToNBT(tempTag);
|
part.writeToNBT(tempTag);
|
||||||
|
|
||||||
if (tempTag.hasKey(ID_USED_CHANNELS)) {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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 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 static final MENetworkChannelsChanged EVENT = new MENetworkChannelsChanged();
|
||||||
private int channelData = 0;
|
private int usedChannels = 0;
|
||||||
|
private int lastUsedChannels = 0;
|
||||||
private Object visitorIterationNumber = null;
|
private Object visitorIterationNumber = null;
|
||||||
private GridNode sideA;
|
private GridNode sideA;
|
||||||
private AEPartLocation fromAtoB;
|
private AEPartLocation fromAtoB;
|
||||||
@@ -118,7 +119,7 @@ public class GridConnection implements IGridConnection, IPathItem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getUsedChannels() {
|
public int getUsedChannels() {
|
||||||
return (this.channelData >> 8) & 0xff;
|
return usedChannels;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -132,7 +133,7 @@ public class GridConnection implements IGridConnection, IPathItem {
|
|||||||
@Override
|
@Override
|
||||||
public void setControllerRoute(final IPathItem fast, final boolean zeroOut) {
|
public void setControllerRoute(final IPathItem fast, final boolean zeroOut) {
|
||||||
if (zeroOut) {
|
if (zeroOut) {
|
||||||
this.channelData &= ~0xff;
|
this.lastUsedChannels = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.sideB == fast) {
|
if (this.sideB == fast) {
|
||||||
@@ -145,7 +146,7 @@ public class GridConnection implements IGridConnection, IPathItem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canSupportMoreChannels() {
|
public boolean canSupportMoreChannels() {
|
||||||
return this.getLastUsedChannels() < 32; // max, PERIOD.
|
return this.getLastUsedChannels() < AEConfig.instance().getDenseChannelCapacity(); // max, PERIOD.
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -155,7 +156,7 @@ public class GridConnection implements IGridConnection, IPathItem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void incrementChannelCount(final int usedChannels) {
|
public void incrementChannelCount(final int usedChannels) {
|
||||||
this.channelData += usedChannels;
|
this.lastUsedChannels += usedChannels;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -166,8 +167,7 @@ public class GridConnection implements IGridConnection, IPathItem {
|
|||||||
@Override
|
@Override
|
||||||
public void finalizeChannels() {
|
public void finalizeChannels() {
|
||||||
if (this.getUsedChannels() != this.getLastUsedChannels()) {
|
if (this.getUsedChannels() != this.getLastUsedChannels()) {
|
||||||
this.channelData &= 0xff;
|
this.usedChannels = this.lastUsedChannels;
|
||||||
this.channelData |= this.channelData << 8;
|
|
||||||
|
|
||||||
if (this.sideA.getInternalGrid() != null) {
|
if (this.sideA.getInternalGrid() != null) {
|
||||||
this.sideA.getInternalGrid().postEventTo(this.sideA, EVENT);
|
this.sideA.getInternalGrid().postEventTo(this.sideA, EVENT);
|
||||||
@@ -180,7 +180,7 @@ public class GridConnection implements IGridConnection, IPathItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int getLastUsedChannels() {
|
private int getLastUsedChannels() {
|
||||||
return this.channelData & 0xff;
|
return lastUsedChannels;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object getVisitorIterationNumber() {
|
Object getVisitorIterationNumber() {
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ import java.util.*;
|
|||||||
|
|
||||||
public class GridNode implements IGridNode, IPathItem {
|
public class GridNode implements IGridNode, IPathItem {
|
||||||
private static final MENetworkChannelsChanged EVENT = new MENetworkChannelsChanged();
|
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 List<IGridConnection> connections = new ArrayList<>();
|
||||||
private final IGridBlock gridProxy;
|
private final IGridBlock gridProxy;
|
||||||
@@ -77,7 +77,7 @@ public class GridNode implements IGridNode, IPathItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int usedChannels() {
|
public int usedChannels() {
|
||||||
return this.lastUsedChannels;
|
return this.usedChannels;
|
||||||
}
|
}
|
||||||
|
|
||||||
Class<? extends IGridHost> getMachineClass() {
|
Class<? extends IGridHost> getMachineClass() {
|
||||||
@@ -545,7 +545,7 @@ public class GridNode implements IGridNode, IPathItem {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.getLastUsedChannels() != this.getUsedChannels()) {
|
if (this.lastUsedChannels != this.usedChannels) {
|
||||||
this.lastUsedChannels = this.usedChannels;
|
this.lastUsedChannels = this.usedChannels;
|
||||||
|
|
||||||
if (this.getInternalGrid() != null) {
|
if (this.getInternalGrid() != null) {
|
||||||
@@ -554,10 +554,6 @@ public class GridNode implements IGridNode, IPathItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getLastUsedChannels() {
|
|
||||||
return this.lastUsedChannels;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getLastSecurityKey() {
|
public long getLastSecurityKey() {
|
||||||
return this.lastSecurityKey;
|
return this.lastSecurityKey;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -83,7 +83,7 @@ public class PathGridCache implements IPathingGrid {
|
|||||||
if (this.controllerState == ControllerState.NO_CONTROLLER) {
|
if (this.controllerState == ControllerState.NO_CONTROLLER) {
|
||||||
final int requiredChannels = this.calculateRequiredChannels();
|
final int requiredChannels = this.calculateRequiredChannels();
|
||||||
int used = requiredChannels;
|
int used = requiredChannels;
|
||||||
if (AEConfig.instance().isFeatureEnabled(AEFeature.CHANNELS) && requiredChannels > 8) {
|
if (AEConfig.instance().isFeatureEnabled(AEFeature.CHANNELS) && requiredChannels > AEConfig.instance().getNormalChannelCapacity()) {
|
||||||
used = 0;
|
used = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import appeng.client.render.cablebus.CableBusRenderState;
|
|||||||
import appeng.client.render.cablebus.CableCoreType;
|
import appeng.client.render.cablebus.CableCoreType;
|
||||||
import appeng.client.render.cablebus.FacadeRenderState;
|
import appeng.client.render.cablebus.FacadeRenderState;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
|
import appeng.core.AEConfig;
|
||||||
import appeng.facade.FacadeContainer;
|
import appeng.facade.FacadeContainer;
|
||||||
import appeng.helpers.AEMultiTile;
|
import appeng.helpers.AEMultiTile;
|
||||||
import appeng.me.GridConnection;
|
import appeng.me.GridConnection;
|
||||||
@@ -1022,7 +1023,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
|||||||
}
|
}
|
||||||
|
|
||||||
int length = (int) part.getCableConnectionLength(null);
|
int length = (int) part.getCableConnectionLength(null);
|
||||||
if (length > 0 && length <= 8) {
|
if (length > 0 && length <= AEConfig.instance().getNormalChannelCapacity()) {
|
||||||
renderState.getAttachmentConnections().put(facing, length);
|
renderState.getAttachmentConnections().put(facing, length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,23 +132,25 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( this.craftOnly() )
|
if (this.craftOnly()) {
|
||||||
{
|
this.didSomething = this.craftingTracker.handleCrafting(slotToExport, this.itemToSend, ais, destination, this.getTile().getWorld(), this.getProxy().getGrid(), cg, this.mySrc) || this.didSomething;
|
||||||
this.didSomething = this.craftingTracker.handleCrafting( slotToExport, this.itemToSend, ais, destination, this.getTile().getWorld(), this.getProxy().getGrid(), cg, this.mySrc ) || this.didSomething;
|
continue;
|
||||||
continue;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
final long before = this.itemToSend;
|
final long before = this.itemToSend;
|
||||||
|
|
||||||
if (this.getInstalledUpgrades(Upgrades.FUZZY) > 0) {
|
if (this.getInstalledUpgrades(Upgrades.FUZZY) > 0) {
|
||||||
for (final IAEItemStack o : ImmutableList.copyOf(inv.getStorageList().findFuzzy(ais, fzMode))) {
|
for (final IAEItemStack o : ImmutableList.copyOf(inv.getStorageList().findFuzzy(ais, fzMode))) {
|
||||||
this.pushItemIntoTarget(destination, energy, inv, o);
|
if (o.getStackSize() > 0) {
|
||||||
if (this.itemToSend <= 0) {
|
this.pushItemIntoTarget(destination, energy, inv, o);
|
||||||
break;
|
if (this.itemToSend <= 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} 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);
|
this.pushItemIntoTarget(destination, energy, inv, ais);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ public class PartCable extends AEBasePart implements IPartCable {
|
|||||||
howMany = Math.max(gc.getUsedChannels(), howMany);
|
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;
|
IAEItemStack out = null;
|
||||||
|
|
||||||
for (final IAEItemStack req : ImmutableList.copyOf(this.getList().findFuzzy(reqFilter, fuzzyMode))) {
|
for (final IAEItemStack req : ImmutableList.copyOf(this.getList().findFuzzy(reqFilter, fuzzyMode))) {
|
||||||
if (req != null) {
|
if (req != null && req.getStackSize() > 0) {
|
||||||
req.setStackSize(amount);
|
req.setStackSize(amount);
|
||||||
out = this.target.extractItems(req, type, this.src);
|
out = this.target.extractItems(req, type, this.src);
|
||||||
if (out != null) {
|
if (out != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user