diff options
Diffstat (limited to 'src/main/java/gregtech/api')
11 files changed, 240 insertions, 189 deletions
diff --git a/src/main/java/gregtech/api/enums/ItemList.java b/src/main/java/gregtech/api/enums/ItemList.java index 8830ab50a5..420c371c40 100644 --- a/src/main/java/gregtech/api/enums/ItemList.java +++ b/src/main/java/gregtech/api/enums/ItemList.java @@ -401,6 +401,12 @@ public enum ItemList implements IItemContainer { Electric_Pump_UHV, Electric_Pump_UEV, + Steam_Valve_LV, + Steam_Valve_MV, + Steam_Valve_HV, + Steam_Valve_EV, + Steam_Valve_IV, + Conveyor_Module_LV, Conveyor_Module_MV, Conveyor_Module_HV, diff --git a/src/main/java/gregtech/api/enums/Textures.java b/src/main/java/gregtech/api/enums/Textures.java index 38001faebb..e0d0ce6abe 100644 --- a/src/main/java/gregtech/api/enums/Textures.java +++ b/src/main/java/gregtech/api/enums/Textures.java @@ -398,6 +398,7 @@ public class Textures { OVERLAY_DATA_ACCESS, OVERLAY_CONVEYOR, OVERLAY_PUMP, + OVERLAY_VALVE, OVERLAY_ARM, OVERLAY_DRAIN, OVERLAY_CRAFTING, diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java index 8a28301fdf..2afc996df2 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java @@ -111,7 +111,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if (aSide >= 0 && aSide < 6) { for (byte i = 0; i < 4; i++) if (isInputDisabledAtSide(sRestrictionArray[aSide][i])) tMask |= 1 << i; //Full block size renderer flips side 5 and 2 textures, flip restrictor textures to compensate - if (tThickNess >= 0.99F && (aSide == 5 || aSide == 2)) + if (aSide == 5 || aSide == 2 || aSide == 0) if (tMask > 3 && tMask < 12) tMask = (byte) (tMask ^ 12); } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java index c73e95e95b..6ed5a9edd0 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java @@ -38,6 +38,7 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE public int mTransferredItems = 0; public byte mLastReceivedFrom = 0, oLastReceivedFrom = 0; public boolean mIsRestrictive = false; + private int[] cacheSides; public GT_MetaPipeEntity_Item(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, int aInvSlotCount, int aStepSize, boolean aIsRestrictive, int aTickTime) { super(aID, aName, aNameRegional, aInvSlotCount, false); @@ -313,6 +314,19 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE } @Override + public int[] getAccessibleSlotsFromSide(int aSide) { + IGregTechTileEntity tTileEntity = getBaseMetaTileEntity(); + boolean tAllow = tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsIn((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), -2, tTileEntity) || tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsOut((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), -2, tTileEntity); + if (tAllow) { + if (cacheSides == null) + cacheSides = super.getAccessibleSlotsFromSide(aSide); + return cacheSides; + } else { + return new int[0]; + } + } + + @Override public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { return isConnectedAtSide(aSide); } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java index 7284cd3c01..8758ea1a02 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java @@ -8,10 +8,18 @@ import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; import static gregtech.api.enums.GT_Values.V; public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredMachineBlock { + private static final int OUTPUT_INDEX = 0; + private static final int ARROW_RIGHT_INDEX = 1; + private static final int ARROW_DOWN_INDEX = 2; + private static final int ARROW_LEFT_INDEX = 3; + private static final int ARROW_UP_INDEX = 4; + private static final int FRONT_INDEX = 5; + public boolean bOutput = false, bRedstoneIfFull = false, bInvert = false, bStockingMode = false; public int mSuccess = 0, mTargetStackSize = 0; @@ -33,74 +41,85 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM @Override public ITexture[][][] getTextureSet(ITexture[] aTextures) { - ITexture[][][] rTextures = new ITexture[6][17][]; - ITexture tIcon = getOverlayIcon(), tOut = new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT), tUp = new GT_RenderedTexture(Textures.BlockIcons.ARROW_UP), tDown = new GT_RenderedTexture(Textures.BlockIcons.ARROW_DOWN), tLeft = new GT_RenderedTexture(Textures.BlockIcons.ARROW_LEFT), tRight = new GT_RenderedTexture(Textures.BlockIcons.ARROW_RIGHT); - for (byte i = -1; i < 16; i++) { - rTextures[0][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], tOut}; - rTextures[1][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], tRight, tIcon}; - rTextures[2][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], tDown, tIcon}; - rTextures[3][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], tLeft, tIcon}; - rTextures[4][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], tUp, tIcon}; - rTextures[5][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], tIcon}; + ITexture[][][] rTextures = new ITexture[ForgeDirection.VALID_DIRECTIONS.length][17][]; + ITexture tIcon = getOverlayIcon(); + ITexture tOut = new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT); + ITexture tUp = new GT_RenderedTexture(Textures.BlockIcons.ARROW_UP); + ITexture tDown = new GT_RenderedTexture(Textures.BlockIcons.ARROW_DOWN); + ITexture tLeft = new GT_RenderedTexture(Textures.BlockIcons.ARROW_LEFT); + ITexture tRight = new GT_RenderedTexture(Textures.BlockIcons.ARROW_RIGHT); + for (int i = 0; i < rTextures[0].length; i++) { + rTextures[OUTPUT_INDEX][i] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i], tOut}; + rTextures[ARROW_RIGHT_INDEX][i] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i], tRight, tIcon}; + rTextures[ARROW_DOWN_INDEX][i] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i], tDown, tIcon}; + rTextures[ARROW_LEFT_INDEX][i] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i], tLeft, tIcon}; + rTextures[ARROW_UP_INDEX][i] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i], tUp, tIcon}; + rTextures[FRONT_INDEX][i] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i], tIcon}; } return rTextures; } @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) return mTextures[5][aColorIndex + 1]; - if (GT_Utility.getOppositeSide(aSide) == aFacing) return mTextures[0][aColorIndex + 1]; - switch (aFacing) { - case 0: - return mTextures[4][aColorIndex + 1]; - case 1: - return mTextures[2][aColorIndex + 1]; - case 2: - switch (aSide) { - case 0: - return mTextures[2][aColorIndex + 1]; - case 1: - return mTextures[2][aColorIndex + 1]; - case 4: - return mTextures[1][aColorIndex + 1]; - case 5: - return mTextures[3][aColorIndex + 1]; + int colorIndex = aColorIndex + 1; + ForgeDirection side = ForgeDirection.VALID_DIRECTIONS[aSide]; + ForgeDirection facing = ForgeDirection.VALID_DIRECTIONS[aFacing]; + if (side == facing) return mTextures[FRONT_INDEX][colorIndex]; + if (ForgeDirection.OPPOSITES[aSide] == aFacing) return mTextures[OUTPUT_INDEX][colorIndex]; + switch (facing) { + case DOWN: + return mTextures[ARROW_UP_INDEX][colorIndex]; // ARROW_UP + case UP: + return mTextures[ARROW_DOWN_INDEX][colorIndex]; // ARROW_DOWN + case NORTH: + switch (side) { + case DOWN: + case UP: + return mTextures[ARROW_DOWN_INDEX][colorIndex]; // ARROW_DOWN + case WEST: + return mTextures[ARROW_RIGHT_INDEX][colorIndex]; // ARROW_RIGHT + case EAST: + return mTextures[ARROW_LEFT_INDEX][colorIndex]; // ARROW_LEFT + default: } - case 3: - switch (aSide) { - case 0: - return mTextures[4][aColorIndex + 1]; - case 1: - return mTextures[4][aColorIndex + 1]; - case 4: - return mTextures[3][aColorIndex + 1]; - case 5: - return mTextures[1][aColorIndex + 1]; + break; + case SOUTH: + switch (side) { + case DOWN: + case UP: + return mTextures[ARROW_UP_INDEX][colorIndex]; // ARROW_UP + case WEST: + return mTextures[ARROW_LEFT_INDEX][colorIndex]; // ARROW_LEFT + case EAST: + return mTextures[ARROW_RIGHT_INDEX][colorIndex]; // ARROW_RIGHT + default: } - case 4: - switch (aSide) { - case 0: - return mTextures[3][aColorIndex + 1]; - case 1: - return mTextures[1][aColorIndex + 1]; - case 2: - return mTextures[3][aColorIndex + 1]; - case 3: - return mTextures[1][aColorIndex + 1]; + break; + case WEST: + switch (side) { + case DOWN: + case UP: + case SOUTH: + return mTextures[ARROW_RIGHT_INDEX][colorIndex]; // ARROW_RIGHT + case NORTH: + return mTextures[ARROW_LEFT_INDEX][colorIndex]; // ARROW_LEFT + default: } - case 5: - switch (aSide) { - case 0: - return mTextures[1][aColorIndex + 1]; - case 1: - return mTextures[3][aColorIndex + 1]; - case 2: - return mTextures[1][aColorIndex + 1]; - case 3: - return mTextures[3][aColorIndex + 1]; + break; + case EAST: + switch (side) { + case DOWN: + case UP: + case SOUTH: + return mTextures[ARROW_LEFT_INDEX][colorIndex]; // ARROW_LEFT + case NORTH: + return mTextures[ARROW_RIGHT_INDEX][colorIndex]; // ARROW_RIGHT + default: } + break; + default: } - return mTextures[5][aColorIndex + 1]; + return mTextures[FRONT_INDEX][colorIndex]; } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java index dfac210915..f2f76dca4f 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java @@ -13,10 +13,12 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.StatCollector; public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch { public GT_Recipe_Map mRecipeMap = null; public boolean disableSort; + public boolean disableFilter = false; public GT_MetaTileEntity_Hatch_InputBus(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, getSlots(aTier), new String[]{ @@ -136,12 +138,14 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch { public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); aNBT.setBoolean("disableSort", disableSort); + aNBT.setBoolean("disableFilter", disableFilter); } @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); disableSort = aNBT.getBoolean("disableSort"); + disableFilter = aNBT.getBoolean("disableFilter"); } @Override @@ -151,6 +155,9 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch { if (aPlayer.isSneaking()) { disableSort = !disableSort; GT_Utility.sendChatToPlayer(aPlayer, trans("200", "Sort mode: " + (disableSort ? "Disabled" : "Enabled"))); + } else { + disableFilter = !disableFilter; + GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.hatch.disableFilter."+disableFilter)); } } @@ -165,6 +172,6 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch { @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return aSide == getBaseMetaTileEntity().getFrontFacing() && (mRecipeMap == null || mRecipeMap.containsInput(aStack)); + return aSide == getBaseMetaTileEntity().getFrontFacing() && (mRecipeMap == null || disableFilter || mRecipeMap.containsInput(aStack)); } } diff --git a/src/main/java/gregtech/api/objects/GT_RenderedTexture.java b/src/main/java/gregtech/api/objects/GT_RenderedTexture.java index 70b71cf125..074cabf341 100644 --- a/src/main/java/gregtech/api/objects/GT_RenderedTexture.java +++ b/src/main/java/gregtech/api/objects/GT_RenderedTexture.java @@ -37,94 +37,77 @@ public class GT_RenderedTexture implements ITexture, IColorModulationContainer { @Override public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); + final Tessellator tesselator = Tessellator.instance; + tesselator.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); + aRenderer.field_152631_f = true; aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, mIconContainer.getIcon()); if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(153, 153, 153, 255); + tesselator.setColorRGBA(153, 153, 153, 255); aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); } + aRenderer.field_152631_f = false; } + @Override public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); + final Tessellator tesselator = Tessellator.instance; + tesselator.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, mIconContainer.getIcon()); if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(153, 153, 153, 255); + tesselator.setColorRGBA(153, 153, 153, 255); aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); } } @Override public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 1.0F), (int) (mRGBa[1] * 1.0F), (int) (mRGBa[2] * 1.0F), mAllowAlpha ? 255 - mRGBa[3] : 255); + final Tessellator tesselator = Tessellator.instance; + tesselator.setColorRGBA((int) (mRGBa[0] * 1.0F), (int) (mRGBa[1] * 1.0F), (int) (mRGBa[2] * 1.0F), mAllowAlpha ? 255 - mRGBa[3] : 255); aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, mIconContainer.getIcon()); if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(255, 255, 255, 255); + tesselator.setColorRGBA(255, 255, 255, 255); aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); } } @Override public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.5F), (int) (mRGBa[1] * 0.5F), (int) (mRGBa[2] * 0.5F), mAllowAlpha ? 255 - mRGBa[3] : 255); - IIcon aIcon = mIconContainer.getIcon(); - - float d_16 = 16.0F; - float d3 = (float)aIcon.getInterpolatedU(aRenderer.renderMaxX * d_16); - float d4 = (float)aIcon.getInterpolatedU(aRenderer.renderMinX * d_16); - float d5 = (float)aIcon.getInterpolatedV(aRenderer.renderMinZ * d_16); - float d6 = (float)aIcon.getInterpolatedV(aRenderer.renderMaxZ * d_16); - - if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) { - d3 = aIcon.getMaxU(); - d4 = aIcon.getMinU(); - } - - if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) { - d5 = aIcon.getMinV(); - d6 = aIcon.getMaxV(); - } - - float d11 = aX + (float)aRenderer.renderMinX; - float d12 = aX + (float)aRenderer.renderMaxX; - float d13 = aY + (float)aRenderer.renderMinY; - float d14 = aZ + (float)aRenderer.renderMinZ; - float d15 = aZ + (float)aRenderer.renderMaxZ; - - Tessellator.instance.addVertexWithUV((double)d11, (double)d13, (double)d15, (double)d3, (double)d6); - Tessellator.instance.addVertexWithUV((double)d11, (double)d13, (double)d14, (double)d3, (double)d5); - Tessellator.instance.addVertexWithUV((double)d12, (double)d13, (double)d14, (double)d4, (double)d5); - Tessellator.instance.addVertexWithUV((double)d12, (double)d13, (double)d15, (double)d4, (double)d6); - - if ((aIcon = mIconContainer.getOverlayIcon()) != null) { - Tessellator.instance.setColorRGBA(128, 128, 128, 255); - - Tessellator.instance.addVertexWithUV((double)d11, (double)d13, (double)d15, (double)d3, (double)d6); - Tessellator.instance.addVertexWithUV((double)d11, (double)d13, (double)d14, (double)d3, (double)d5); - Tessellator.instance.addVertexWithUV((double)d12, (double)d13, (double)d14, (double)d4, (double)d5); - Tessellator.instance.addVertexWithUV((double)d12, (double)d13, (double)d15, (double)d4, (double)d6); + final Tessellator tesselator = Tessellator.instance; + tesselator.setColorRGBA((int) (mRGBa[0] * 0.5F), (int) (mRGBa[1] * 0.5F), (int) (mRGBa[2] * 0.5F), mAllowAlpha ? 255 - mRGBa[3] : 255); + aRenderer.field_152631_f = true; + aRenderer.flipTexture = true; + aRenderer.renderFaceYNeg(aBlock, aX, aY, aZ, mIconContainer.getIcon()); + if (mIconContainer.getOverlayIcon() != null) { + tesselator.setColorRGBA(128, 128, 128, 255); + aRenderer.renderFaceYNeg(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); } + aRenderer.field_152631_f = false; + aRenderer.flipTexture = false; } @Override public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); + final Tessellator tesselator = Tessellator.instance; + tesselator.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, mIconContainer.getIcon()); if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(204, 204, 204, 255); + tesselator.setColorRGBA(204, 204, 204, 255); aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); } } @Override public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); + final Tessellator tesselator = Tessellator.instance; + tesselator.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); + aRenderer.field_152631_f = true; aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, mIconContainer.getIcon()); if (mIconContainer.getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(204, 204, 204, 255); + tesselator.setColorRGBA(204, 204, 204, 255); aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); } + aRenderer.field_152631_f = false; } @Override diff --git a/src/main/java/gregtech/api/objects/GT_SidedTexture.java b/src/main/java/gregtech/api/objects/GT_SidedTexture.java index 2b4f144393..ab88225781 100644 --- a/src/main/java/gregtech/api/objects/GT_SidedTexture.java +++ b/src/main/java/gregtech/api/objects/GT_SidedTexture.java @@ -7,7 +7,6 @@ import gregtech.api.interfaces.ITexture; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.util.IIcon; public class GT_SidedTexture implements ITexture, IColorModulationContainer { private final IIconContainer[] mIconContainer; @@ -45,115 +44,76 @@ public class GT_SidedTexture implements ITexture, IColorModulationContainer { @Override public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); + final Tessellator tessellator = Tessellator.instance; + tessellator.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); + aRenderer.field_152631_f = true; aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, mIconContainer[5].getIcon()); if (mIconContainer[5].getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(153, 153, 153, 255); + tessellator.setColorRGBA(153, 153, 153, 255); aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, mIconContainer[5].getOverlayIcon()); } + aRenderer.field_152631_f = false; } @Override public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); + final Tessellator tessellator = Tessellator.instance; + tessellator.setColorRGBA((int) (mRGBa[0] * 0.6F), (int) (mRGBa[1] * 0.6F), (int) (mRGBa[2] * 0.6F), mAllowAlpha ? 255 - mRGBa[3] : 255); aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, mIconContainer[4].getIcon()); if (mIconContainer[4].getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(153, 153, 153, 255); + tessellator.setColorRGBA(153, 153, 153, 255); aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, mIconContainer[4].getOverlayIcon()); } } @Override public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 1.0F), (int) (mRGBa[1] * 1.0F), (int) (mRGBa[2] * 1.0F), mAllowAlpha ? 255 - mRGBa[3] : 255); + final Tessellator tessellator = Tessellator.instance; + tessellator.setColorRGBA((int) (mRGBa[0] * 1.0F), (int) (mRGBa[1] * 1.0F), (int) (mRGBa[2] * 1.0F), mAllowAlpha ? 255 - mRGBa[3] : 255); aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, mIconContainer[1].getIcon()); if (mIconContainer[1].getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(255, 255, 255, 255); + tessellator.setColorRGBA(255, 255, 255, 255); aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, mIconContainer[1].getOverlayIcon()); } } @Override public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.5F), (int) (mRGBa[1] * 0.5F), (int) (mRGBa[2] * 0.5F), mAllowAlpha ? 255 - mRGBa[3] : 255); - IIcon aIcon = mIconContainer[0].getIcon(); - - float d_16 = 16.0F; - float d3 = (float)aIcon.getInterpolatedU(aRenderer.renderMaxX * d_16); - float d4 = (float)aIcon.getInterpolatedU(aRenderer.renderMinX * d_16); - float d5 = (float)aIcon.getInterpolatedV(aRenderer.renderMinZ * d_16); - float d6 = (float)aIcon.getInterpolatedV(aRenderer.renderMaxZ * d_16); - - if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) { - d3 = aIcon.getMaxU(); - d4 = aIcon.getMinU(); - } - - if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) { - d5 = aIcon.getMinV(); - d6 = aIcon.getMaxV(); - } - - float d11 = aX + (float)aRenderer.renderMinX; - float d12 = aX + (float)aRenderer.renderMaxX; - float d13 = aY + (float)aRenderer.renderMinY; - float d14 = aZ + (float)aRenderer.renderMinZ; - float d15 = aZ + (float)aRenderer.renderMaxZ; - - Tessellator.instance.addVertexWithUV((double)d11, (double)d13, (double)d15, (double)d3, (double)d6); - Tessellator.instance.addVertexWithUV((double)d11, (double)d13, (double)d14, (double)d3, (double)d5); - Tessellator.instance.addVertexWithUV((double)d12, (double)d13, (double)d14, (double)d4, (double)d5); - Tessellator.instance.addVertexWithUV((double)d12, (double)d13, (double)d15, (double)d4, (double)d6); - - if ((aIcon = mIconContainer[0].getOverlayIcon()) != null) { - Tessellator.instance.setColorRGBA(128, 128, 128, 255); - - d3 = (float)aIcon.getInterpolatedU(aRenderer.renderMaxX * d_16); - d4 = (float)aIcon.getInterpolatedU(aRenderer.renderMinX * d_16); - d5 = (float)aIcon.getInterpolatedV(aRenderer.renderMinZ * d_16); - d6 = (float)aIcon.getInterpolatedV(aRenderer.renderMaxZ * d_16); - - if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) { - d3 = aIcon.getMaxU(); - d4 = aIcon.getMinU(); - } - - if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) { - d5 = aIcon.getMinV(); - d6 = aIcon.getMaxV(); - } - - d11 = aX + (float)aRenderer.renderMinX; - d12 = aX + (float)aRenderer.renderMaxX; - d13 = aY + (float)aRenderer.renderMinY; - d14 = aZ + (float)aRenderer.renderMinZ; - d15 = aZ + (float)aRenderer.renderMaxZ; - - Tessellator.instance.addVertexWithUV((double)d11, (double)d13, (double)d15, (double)d3, (double)d6); - Tessellator.instance.addVertexWithUV((double)d11, (double)d13, (double)d14, (double)d3, (double)d5); - Tessellator.instance.addVertexWithUV((double)d12, (double)d13, (double)d14, (double)d4, (double)d5); - Tessellator.instance.addVertexWithUV((double)d12, (double)d13, (double)d15, (double)d4, (double)d6); + final Tessellator tessellator = Tessellator.instance; + tessellator.setColorRGBA((int) (mRGBa[0] * 0.5F), (int) (mRGBa[1] * 0.5F), (int) (mRGBa[2] * 0.5F), mAllowAlpha ? 255 - mRGBa[3] : 255); + aRenderer.field_152631_f = true; + aRenderer.flipTexture = true; + aRenderer.renderFaceYNeg(aBlock, aX, aY, aZ, mIconContainer[1].getIcon()); + if (mIconContainer[0].getOverlayIcon() != null) { + tessellator.setColorRGBA(128, 128, 128, 255); + aRenderer.renderFaceYNeg(aBlock, aX, aY, aZ, mIconContainer[1].getOverlayIcon()); } + aRenderer.field_152631_f = false; + aRenderer.flipTexture = false; } @Override public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); + final Tessellator tessellator = Tessellator.instance; + tessellator.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, mIconContainer[3].getIcon()); if (mIconContainer[3].getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(204, 204, 204, 255); + tessellator.setColorRGBA(204, 204, 204, 255); aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, mIconContainer[3].getOverlayIcon()); } } @Override public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); + final Tessellator tessellator = Tessellator.instance; + tessellator.setColorRGBA((int) (mRGBa[0] * 0.8F), (int) (mRGBa[1] * 0.8F), (int) (mRGBa[2] * 0.8F), mAllowAlpha ? 255 - mRGBa[3] : 255); + aRenderer.field_152631_f = true; aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, mIconContainer[2].getIcon()); if (mIconContainer[2].getOverlayIcon() != null) { - Tessellator.instance.setColorRGBA(204, 204, 204, 255); + tessellator.setColorRGBA(204, 204, 204, 255); aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, mIconContainer[2].getOverlayIcon()); } + aRenderer.field_152631_f = false; } @Override diff --git a/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java b/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java index ee56a0b0c0..6e57ef486e 100644 --- a/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java +++ b/src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java @@ -55,8 +55,10 @@ public class GT_Runnable_MachineBlockUpdate implements Runnable { private static boolean isEnabled = true; public static void setMachineUpdateValues(World aWorld, int aX, int aY, int aZ) { - if (isEnabled) + if (isEnabled) { + aWorld.getTileEntity(aX, aY, aZ); EXECUTOR_SERVICE.submit(new GT_Runnable_MachineBlockUpdate(aWorld, aX, aY, aZ)); + } } public static void initExecutorService() { diff --git a/src/main/java/gregtech/api/util/GT_ModHandler.java b/src/main/java/gregtech/api/util/GT_ModHandler.java index 5cfcac0a89..bfa3f86e77 100644 --- a/src/main/java/gregtech/api/util/GT_ModHandler.java +++ b/src/main/java/gregtech/api/util/GT_ModHandler.java @@ -6,7 +6,12 @@ import cpw.mods.fml.common.event.FMLInterModComms; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.GT_Mod; import gregtech.api.GregTech_API; -import gregtech.api.enums.*; +import gregtech.api.enums.ConfigCategories; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OreDictNames; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.ToolDictNames; import gregtech.api.interfaces.IDamagableItem; import gregtech.api.interfaces.IItemContainer; import gregtech.api.interfaces.internal.IGT_CraftingRecipe; @@ -31,7 +36,11 @@ import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.*; +import net.minecraft.item.crafting.CraftingManager; +import net.minecraft.item.crafting.FurnaceRecipes; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.item.crafting.ShapedRecipes; +import net.minecraft.item.crafting.ShapelessRecipes; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.world.World; @@ -40,11 +49,26 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.Objects; import java.util.stream.Collectors; -import static gregtech.api.enums.GT_Values.*; +import static gregtech.api.enums.GT_Values.B; +import static gregtech.api.enums.GT_Values.D1; +import static gregtech.api.enums.GT_Values.DW; +import static gregtech.api.enums.GT_Values.E; +import static gregtech.api.enums.GT_Values.M; +import static gregtech.api.enums.GT_Values.RA; +import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.GT_Values.W; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -125,6 +149,8 @@ public class GT_ModHandler { public static List<Integer> sVanillaRecipeList_warntOutput = new ArrayList<Integer>(50); public static final List<IRecipe> sSingleNonBlockDamagableRecipeList_verified = new ArrayList<IRecipe>(1000); private static Cache<GT_ItemStack, ItemStack> sSmeltingRecipeCache = CacheBuilder.newBuilder().maximumSize(1000).build(); + public static List<Integer> sAnySteamFluidIDs = new ArrayList<>(); + public static List<Integer> sSuperHeatedSteamFluidIDs = new ArrayList<>(); static { sNativeRecipeClasses.add(ShapedRecipes.class.getName()); @@ -217,6 +243,20 @@ public class GT_ModHandler { } /** + * Returns if that Liquid is Any Steam (including other mods) + */ + public static boolean isAnySteam(FluidStack aFluid) { + return(aFluid != null && (isSteam(aFluid) || sAnySteamFluidIDs.contains(aFluid.getFluidID()))); + } + + /** + * Returns if that Liquid is Super Heated Steam (including other mods) + */ + public static boolean isSuperHeatedSteam(FluidStack aFluid) { + return(aFluid != null && sSuperHeatedSteamFluidIDs.contains(aFluid.getFluidID())); + } + + /** * Returns a Liquid Stack with given amount of Steam. */ public static FluidStack getSteam(long aAmount) { diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index 05e0874e7a..3530fa17c2 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -537,24 +537,47 @@ public class GT_Utility { public static int moveMultipleItemStacks(IInventory aTileEntity1, Object aTileEntity2, byte aGrabFrom, byte aPutTo, List<ItemStack> aFilter, boolean aInvertFilter, byte aMaxTargetStackSize, byte aMinTargetStackSize, byte aMaxMoveAtOnce, byte aMinMoveAtOnce,int aMaxStackTransfer, boolean aDoCheckChests) { if (aTileEntity1 == null || aMaxTargetStackSize <= 0 || aMinTargetStackSize <= 0 || aMaxMoveAtOnce <= 0 || aMinTargetStackSize > aMaxTargetStackSize || aMinMoveAtOnce > aMaxMoveAtOnce || aMaxStackTransfer == 0) return 0; - int tGrabInventorySize = aTileEntity1.getSizeInventory(); + + int[] tGrabSlots = null; + if (aTileEntity1 instanceof ISidedInventory) + tGrabSlots = ((ISidedInventory) aTileEntity1).getAccessibleSlotsFromSide(aGrabFrom); + if (tGrabSlots == null) { + tGrabSlots = new int[aTileEntity1.getSizeInventory()]; + for (int i = 0; i < tGrabSlots.length; i++) tGrabSlots[i] = i; + } + + + + + int tGrabInventorySize = tGrabSlots.length; if (aTileEntity2 instanceof IInventory) { + int[] tPutSlots = null; + if (aTileEntity2 instanceof ISidedInventory) + tPutSlots = ((ISidedInventory) aTileEntity2).getAccessibleSlotsFromSide(aPutTo); + + if (tPutSlots == null) { + tPutSlots = new int[((IInventory) aTileEntity2).getSizeInventory()]; + for (int i = 0; i < tPutSlots.length; i++) tPutSlots[i] = i; + } + IInventory tPutInventory = (IInventory) aTileEntity2; - int tPutInventorySize = tPutInventory.getSizeInventory(); + int tPutInventorySize = tPutSlots.length; int tFirstsValidSlot = 0,tStacksMoved = 0,tTotalItemsMoved = 0; - for (int tGrabSlot = 0;tGrabSlot<tGrabInventorySize;tGrabSlot++) + for (int tGrabSlotIndex = 0;tGrabSlotIndex<tGrabInventorySize;tGrabSlotIndex++) { //ItemStack tInventoryStack : mInventory int tMovedItems; do { - tMovedItems = 0; + int tGrabSlot = tGrabSlots[tGrabSlotIndex]; + tMovedItems = 0; ItemStack tGrabStack = aTileEntity1.getStackInSlot(tGrabSlot); if (listContainsItem(aFilter, tGrabStack, true, aInvertFilter) && (tGrabStack.stackSize >= aMinMoveAtOnce && isAllowedToTakeFromSlot(aTileEntity1, tGrabSlot, aGrabFrom, tGrabStack))) { int tStackSize = tGrabStack.stackSize; - for (int tPutSlot = tFirstsValidSlot; tPutSlot < tPutInventorySize; tPutSlot++) { + for (int tPutSlotIndex = tFirstsValidSlot; tPutSlotIndex < tPutInventorySize; tPutSlotIndex++) { + int tPutSlot = tPutSlots[tPutSlotIndex]; if (isAllowedToPutIntoSlot(tPutInventory, tPutSlot, aPutTo, tGrabStack, (byte) 64)) { int tMoved = moveStackFromSlotAToSlotB(aTileEntity1, tPutInventory, tGrabSlot, tPutSlot, aMaxTargetStackSize, aMinTargetStackSize, (byte) (aMaxMoveAtOnce - tMovedItems), aMinMoveAtOnce); tTotalItemsMoved += tMoved; @@ -609,10 +632,6 @@ public class GT_Utility { } //there should be a function to transfer more then 1 stack in a pipe //ut i dont see any ways to improve it too much work for what it is worth - int[] tGrabSlots = new int[tGrabInventorySize]; - for (int i = 0; i < tGrabInventorySize; i++) { - tGrabSlots[i] = i; - } int tTotalItemsMoved = 0; for (int i = 0; i < tGrabInventorySize; i++) { int tMoved = moveStackIntoPipe(aTileEntity1, aTileEntity2, tGrabSlots, aGrabFrom, aPutTo, aFilter, aInvertFilter, aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce, aDoCheckChests); |