From d05f5bbd6d1b762db1383cb0180aac0726f4d5ed Mon Sep 17 00:00:00 2001 From: repo_alt Date: Tue, 23 Mar 2021 01:10:03 +0300 Subject: integer overflow in comparison https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/5817 --- .../api/metatileentity/implementations/GT_MetaTileEntity_BasicTank.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTank.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTank.java index 9222029854..69ccd3ef48 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTank.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTank.java @@ -159,7 +159,7 @@ public abstract class GT_MetaTileEntity_BasicTank extends GT_MetaTileEntity_Tier } } } else { - if (tFluid.isFluidEqual(getFillableStack()) && tFluid.amount + getFillableStack().amount <= getCapacity()) { + if (tFluid.isFluidEqual(getFillableStack()) && ((long)tFluid.amount + getFillableStack().amount) <= (long)getCapacity()) { if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), GT_Utility.getContainerItem(mInventory[getInputSlot()], true), 1)) { getFillableStack().amount += tFluid.amount; aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); -- cgit From 92f2b931a3bd7f858bd57d146a620e497da3174b Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 22 Mar 2021 15:22:11 -0700 Subject: swapped repetitive if-block to switch statement and cached machine tier --- .../multi/GT_MetaTileEntity_ProcessingArray.java | 100 +++++++++++---------- 1 file changed, 52 insertions(+), 48 deletions(-) (limited to 'src') diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java index 1fdc698fe4..371c7948c7 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java @@ -139,6 +139,8 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl } private String mMachine = ""; + private int mMachineTier = 0; + public boolean checkRecipe(ItemStack aStack) { if (!isCorrectMachinePart(mInventory[1])) { return false; @@ -146,62 +148,64 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl GT_Recipe.GT_Recipe_Map map = getRecipeMap(); if (map == null) return false; - if (mInventory[1].getUnlocalizedName().endsWith("10")) { - tTier = 9; - mMult = 2;//u need 4x less machines and they will use 4x less power - } else if (mInventory[1].getUnlocalizedName().endsWith("11")) { - tTier = 9; - mMult = 4;//u need 16x less machines and they will use 16x less power - } else if (mInventory[1].getUnlocalizedName().endsWith("12") || - mInventory[1].getUnlocalizedName().endsWith("13") || - mInventory[1].getUnlocalizedName().endsWith("14") || - mInventory[1].getUnlocalizedName().endsWith("15")) { - tTier = 9; - mMult = 6;//u need 64x less machines and they will use 64x less power - } else if (mInventory[1].getUnlocalizedName().endsWith("1")) { - tTier = 1; - mMult = 0;//*1 - } else if (mInventory[1].getUnlocalizedName().endsWith("2")) { - tTier = 2; - mMult = 0;//*1 - } else if (mInventory[1].getUnlocalizedName().endsWith("3")) { - tTier = 3; - mMult = 0;//*1 - } else if (mInventory[1].getUnlocalizedName().endsWith("4")) { - tTier = 4; - mMult = 0;//*1 - } else if (mInventory[1].getUnlocalizedName().endsWith("5")) { - tTier = 5; - mMult = 0;//*1 - } else if (mInventory[1].getUnlocalizedName().endsWith("6")) { - tTier = 6; - mMult = 0;//*1 - } else if (mInventory[1].getUnlocalizedName().endsWith("7")) { - tTier = 7; - mMult = 0;//*1 - } else if (mInventory[1].getUnlocalizedName().endsWith("8")) { - tTier = 8; - mMult = 0;//*1 - } else if (mInventory[1].getUnlocalizedName().endsWith("9")) { - tTier = 9; - mMult = 0;//*1 - } else { - tTier = 0; - mMult = 0;//*1 + if (!mMachine.equals(mInventory[1].getUnlocalizedName())) { + mLastRecipe = null; + mMachine = mInventory[1].getUnlocalizedName(); } - if (!mMachine.equals(mInventory[1].getUnlocalizedName())) mLastRecipe = null; - mMachine = mInventory[1].getUnlocalizedName(); + if (mLastRecipe == null) { + try { + int length = mMachine.length(); + + mMachineTier = Integer.parseInt(mMachine.substring(length - 2)); + + } catch (NumberFormatException e) { + } + + switch (mMachineTier) { + default: + tTier = 0; + mMult = 0;//*1 + break; + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + tTier = mMachineTier; + mMult = 0;//*1 + break; + case 10: + tTier = 9; + mMult = 2;//u need 4x less machines and they will use 4x less power + break; + case 11: + tTier = 9; + mMult = 4;//u need 16x less machines and they will use 16x less power + break; + case 12: + case 13: + case 14: + case 15: + tTier = 9; + mMult = 6;//u need 64x less machines and they will use 64x less power + break; + } + } ArrayList tFluidList = getStoredFluids(); FluidStack[] tFluids = (FluidStack[]) tFluidList.toArray(new FluidStack[tFluidList.size()]); if (mSeparate) { ArrayList tInputList = new ArrayList(); for (GT_MetaTileEntity_Hatch_InputBus tHatch : mInputBusses) { - IGregTechTileEntity tInpuBus = tHatch.getBaseMetaTileEntity(); - for (int i = tInpuBus.getSizeInventory() - 1; i >= 0; i--) { - if (tInpuBus.getStackInSlot(i) != null) - tInputList.add(tInpuBus.getStackInSlot(i)); + IGregTechTileEntity tInputBus = tHatch.getBaseMetaTileEntity(); + for (int i = tInputBus.getSizeInventory() - 1; i >= 0; i--) { + if (tInputBus.getStackInSlot(i) != null) + tInputList.add(tInputBus.getStackInSlot(i)); } ItemStack[] tInputs = (ItemStack[]) tInputList.toArray(new ItemStack[tInputList.size()]); if (processRecipe(tInputs, tFluids, map)) -- cgit From e6f726c7fa14413b8f57c2a7e2583cfd486fb8d1 Mon Sep 17 00:00:00 2001 From: Léa Gris Date: Tue, 23 Mar 2021 15:11:36 +0100 Subject: fix(rendering): brightness of no-z-fighting offset faces Ignore the z-fighting offset when detecting if a face uses the block's brightness or the brightness from the block above. --- src/main/java/gregtech/api/util/LightingHelper.java | 15 ++++++++------- .../java/gregtech/common/render/GT_Renderer_Block.java | 15 ++++++++------- 2 files changed, 16 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/main/java/gregtech/api/util/LightingHelper.java b/src/main/java/gregtech/api/util/LightingHelper.java index df70ffaeef..027fcd9c6d 100644 --- a/src/main/java/gregtech/api/util/LightingHelper.java +++ b/src/main/java/gregtech/api/util/LightingHelper.java @@ -31,6 +31,7 @@ import net.minecraft.client.renderer.Tessellator; public class LightingHelper { public static final int NORMAL_BRIGHTNESS = 0xff00ff; public static final int MAX_BRIGHTNESS = 0xf000f0; + public static final float NO_Z_FIGHT_OFFSET = 1.0F / 16384.0F; protected static final float[] LIGHTNESS = {0.5F, 1.0F, 0.8F, 0.8F, 0.6F, 0.6F}; private final RenderBlocks renderBlocks; /** @@ -321,7 +322,7 @@ public class LightingHelper { if (renderBlocks.enableAO) { - int xOffset = renderBlocks.renderMinX > 0.0F ? x : x - 1; + int xOffset = renderBlocks.renderMinX > 0.0F + NO_Z_FIGHT_OFFSET ? x : x - 1; int mixedBrightness = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y, z); brightness = mixedBrightness; @@ -392,7 +393,7 @@ public class LightingHelper { if (renderBlocks.enableAO) { - int xOffset = renderBlocks.renderMaxX < 1.0F ? x : x + 1; + int xOffset = renderBlocks.renderMaxX < 1.0F - NO_Z_FIGHT_OFFSET ? x : x + 1; int mixedBrightness = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, xOffset, y, z); brightness = mixedBrightness; @@ -462,7 +463,7 @@ public class LightingHelper { if (renderBlocks.enableAO) { - int yOffset = renderBlocks.renderMinY > 0.0F ? y : y - 1; + int yOffset = renderBlocks.renderMinY > 0.0F + NO_Z_FIGHT_OFFSET ? y : y - 1; int mixedBrightness = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, yOffset, z); brightness = mixedBrightness; @@ -497,7 +498,7 @@ public class LightingHelper { float aoMixedXYZNNN = (renderBlocks.aoLightValueScratchXYNN + renderBlocks.aoLightValueScratchXYZNNN + aoLightValue + renderBlocks.aoLightValueScratchYZNN) / 4.0F; float aoMixedXYZNNP = (renderBlocks.aoLightValueScratchXYZNNP + renderBlocks.aoLightValueScratchXYNN + renderBlocks.aoLightValueScratchYZNP + aoLightValue) / 4.0F; - aoTopLeft = (float) (aoMixedXYZNNP * renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPNP * renderBlocks.renderMaxZ * renderBlocks.renderMinX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMinX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMinX)); + aoTopLeft = (float) (aoMixedXYZNNP * renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPNP * renderBlocks.renderMaxZ * renderBlocks.renderMinX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMinX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMinX)); aoBottomLeft = (float) (aoMixedXYZNNP * renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMinX) + aoMixedXYZPNP * renderBlocks.renderMinZ * renderBlocks.renderMinX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMinX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMinX)); aoBottomRight = (float) (aoMixedXYZNNP * renderBlocks.renderMinZ * (1.0D - renderBlocks.renderMaxX) + aoMixedXYZPNP * renderBlocks.renderMinZ * renderBlocks.renderMaxX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMinZ) * renderBlocks.renderMaxX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMinZ) * (1.0D - renderBlocks.renderMaxX)); aoTopRight = (float) (aoMixedXYZNNP * renderBlocks.renderMaxZ * (1.0D - renderBlocks.renderMaxX) + aoMixedXYZPNP * renderBlocks.renderMaxZ * renderBlocks.renderMaxX + aoMixedXYZPNN * (1.0D - renderBlocks.renderMaxZ) * renderBlocks.renderMaxX + aoMixedXYZNNN * (1.0D - renderBlocks.renderMaxZ) * (1.0D - renderBlocks.renderMaxX)); @@ -533,7 +534,7 @@ public class LightingHelper { if (renderBlocks.enableAO) { - int yOffset = renderBlocks.renderMaxY < 1.0F ? y : y + 1; + int yOffset = renderBlocks.renderMaxY < 1.0F - NO_Z_FIGHT_OFFSET ? y : y + 1; int mixedBrightness = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, yOffset, z); brightness = mixedBrightness; @@ -602,7 +603,7 @@ public class LightingHelper { if (renderBlocks.enableAO) { - int zOffset = renderBlocks.renderMinZ > 0.0F ? z : z - 1; + int zOffset = renderBlocks.renderMinZ > 0.0F + NO_Z_FIGHT_OFFSET ? z : z - 1; int mixedBrightness = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, y, zOffset); brightness = mixedBrightness; @@ -673,7 +674,7 @@ public class LightingHelper { if (renderBlocks.enableAO) { - int zOffset = renderBlocks.renderMaxZ < 1.0F ? z : z + 1; + int zOffset = renderBlocks.renderMaxZ < 1.0F - NO_Z_FIGHT_OFFSET ? z : z + 1; int mixedBrightness = block.getMixedBrightnessForBlock(renderBlocks.blockAccess, x, y, zOffset); brightness = mixedBrightness; diff --git a/src/main/java/gregtech/common/render/GT_Renderer_Block.java b/src/main/java/gregtech/common/render/GT_Renderer_Block.java index e95f508d80..2f33a80dca 100644 --- a/src/main/java/gregtech/common/render/GT_Renderer_Block.java +++ b/src/main/java/gregtech/common/render/GT_Renderer_Block.java @@ -20,8 +20,9 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockAccess; import org.lwjgl.opengl.GL11; +import static gregtech.api.util.LightingHelper.NO_Z_FIGHT_OFFSET; + public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { - private static final float NoZFightOffset = 1.0F / 16384.0F; public static GT_Renderer_Block INSTANCE; public final int mRenderID; @@ -305,7 +306,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[3], false); } if (tIsCovered[0]) { - aBlock.setBlockBounds(0.0F, 0.0F + NoZFightOffset, 0.0F, 1.0F, 0.125F, 1.0F); + aBlock.setBlockBounds(0.0F, 0.0F + NO_Z_FIGHT_OFFSET, 0.0F, 1.0F, 0.125F, 1.0F); aRenderer.setRenderBoundsFromBlock(aBlock); renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[0], false); renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[0], false); @@ -323,7 +324,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { } } if (tIsCovered[1]) { - aBlock.setBlockBounds(0.0F, 0.875F, 0.0F, 1.0F, 1.0F - NoZFightOffset, 1.0F); + aBlock.setBlockBounds(0.0F, 0.875F, 0.0F, 1.0F, 1.0F - NO_Z_FIGHT_OFFSET, 1.0F); aRenderer.setRenderBoundsFromBlock(aBlock); renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[1], false); renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[1], false); @@ -341,7 +342,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { } } if (tIsCovered[2]) { - aBlock.setBlockBounds(0.0F, 0.0F, 0.0F + NoZFightOffset, 1.0F, 1.0F, 0.125F); + aBlock.setBlockBounds(0.0F, 0.0F, 0.0F + NO_Z_FIGHT_OFFSET, 1.0F, 1.0F, 0.125F); aRenderer.setRenderBoundsFromBlock(aBlock); if (!tIsCovered[0]) { renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[2], false); @@ -359,7 +360,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { } } if (tIsCovered[3]) { - aBlock.setBlockBounds(0.0F, 0.0F, 0.875F, 1.0F, 1.0F, 1.0F - NoZFightOffset); + aBlock.setBlockBounds(0.0F, 0.0F, 0.875F, 1.0F, 1.0F, 1.0F - NO_Z_FIGHT_OFFSET); aRenderer.setRenderBoundsFromBlock(aBlock); if (!tIsCovered[0]) { renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[3], false); @@ -377,7 +378,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { } } if (tIsCovered[4]) { - aBlock.setBlockBounds(0.0F + NoZFightOffset, 0.0F, 0.0F, 0.125F, 1.0F, 1.0F); + aBlock.setBlockBounds(0.0F + NO_Z_FIGHT_OFFSET, 0.0F, 0.0F, 0.125F, 1.0F, 1.0F); aRenderer.setRenderBoundsFromBlock(aBlock); if (!tIsCovered[0]) { renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[4], false); @@ -395,7 +396,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[4], false); } if (tIsCovered[5]) { - aBlock.setBlockBounds(0.875F, 0.0F, 0.0F, 1.0F - NoZFightOffset, 1.0F, 1.0F); + aBlock.setBlockBounds(0.875F, 0.0F, 0.0F, 1.0F - NO_Z_FIGHT_OFFSET, 1.0F, 1.0F); aRenderer.setRenderBoundsFromBlock(aBlock); if (!tIsCovered[0]) { renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tCovers[5], false); -- cgit From 6ea482c9512fc18ba05f1a3c9a1292df2af6d730 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 23 Mar 2021 12:50:46 -0700 Subject: removed mMachineTier member --- .../machines/multi/GT_MetaTileEntity_ProcessingArray.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java index 371c7948c7..d86e8cf7f8 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java @@ -139,7 +139,6 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl } private String mMachine = ""; - private int mMachineTier = 0; public boolean checkRecipe(ItemStack aStack) { if (!isCorrectMachinePart(mInventory[1])) { @@ -153,16 +152,18 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl mMachine = mInventory[1].getUnlocalizedName(); } + int machineTier = 0; + if (mLastRecipe == null) { try { int length = mMachine.length(); - mMachineTier = Integer.parseInt(mMachine.substring(length - 2)); + machineTier = Integer.parseInt(mMachine.substring(length - 2)); } catch (NumberFormatException e) { } - switch (mMachineTier) { + switch (machineTier) { default: tTier = 0; mMult = 0;//*1 @@ -176,7 +177,7 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl case 7: case 8: case 9: - tTier = mMachineTier; + tTier = machineTier; mMult = 0;//*1 break; case 10: -- cgit From ae75be34340463832a847c9b31ef1c80d7b90550 Mon Sep 17 00:00:00 2001 From: Léa Gris Date: Wed, 24 Mar 2021 13:23:24 +0100 Subject: feat(cover): hide covers when holding a soldering-iron --- src/main/java/gregtech/api/enums/Textures.java | 6 ++++++ .../gregtech/api/metatileentity/BaseMetaPipeEntity.java | 8 ++++++++ .../gregtech/api/metatileentity/BaseMetaTileEntity.java | 7 +++++++ .../gregtech/textures/blocks/iconsets/HIDDEN_FACE.png | Bin 0 -> 118 bytes 4 files changed, 21 insertions(+) create mode 100644 src/main/resources/assets/gregtech/textures/blocks/iconsets/HIDDEN_FACE.png (limited to 'src') diff --git a/src/main/java/gregtech/api/enums/Textures.java b/src/main/java/gregtech/api/enums/Textures.java index 3a9af71aa2..b2afa4216e 100644 --- a/src/main/java/gregtech/api/enums/Textures.java +++ b/src/main/java/gregtech/api/enums/Textures.java @@ -5,6 +5,7 @@ import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.ITexture; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.objects.GT_SidedTexture; +import gregtech.api.objects.GT_StdRenderedTexture; import gregtech.api.util.GT_Utility; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.IIcon; @@ -57,6 +58,8 @@ public class Textures { LONG_DISTANCE_PIPE_FLUID, LONG_DISTANCE_PIPE_ITEM, + HIDDEN_FACE, + MACHINE_CASING_TANK_1, MACHINE_CASING_TANK_2, MACHINE_CASING_TANK_3, @@ -1352,6 +1355,9 @@ public class Textures { BLOCK_CHARCOAL, BLOCK_BLAZE }; + public static ITexture[] HIDDEN_TEXTURE = new ITexture[]{ + new GT_StdRenderedTexture(BlockIcons.HIDDEN_FACE) + }; public static ITexture[] ERROR_RENDERING = new ITexture[]{ new GT_RenderedTexture(RENDERING_ERROR) diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java index 26fee68f2b..908dd88984 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java @@ -8,19 +8,23 @@ import java.util.Arrays; import java.util.List; import java.util.UUID; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; +import gregtech.api.enums.Textures.BlockIcons; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.interfaces.tileentity.IPipeRenderedTileEntity; import gregtech.api.net.GT_Packet_TileEntity; import gregtech.api.objects.GT_ItemStack; +import gregtech.api.objects.GT_StdRenderedTexture; import gregtech.api.util.GT_CoverBehavior; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; +import gregtech.common.GT_Client; import gregtech.common.covers.GT_Cover_Fluidfilter; import net.minecraft.block.Block; import net.minecraft.entity.Entity; @@ -484,6 +488,10 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE } public ITexture getCoverTexture(byte aSide) { + if (getCoverIDAtSide(aSide) == 0) return null; + if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x1) != 0) { + return BlockIcons.HIDDEN_TEXTURE[0]; // See through + } return GregTech_API.sCovers.get(new GT_ItemStack(getCoverIDAtSide(aSide))); } diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index 0781c57086..26122ae9e9 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -13,6 +13,7 @@ import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; +import gregtech.api.enums.Textures.BlockIcons; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IEnergyConnected; @@ -21,11 +22,13 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachin import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.net.GT_Packet_TileEntity; import gregtech.api.objects.GT_ItemStack; +import gregtech.api.objects.GT_StdRenderedTexture; import gregtech.api.util.GT_CoverBehavior; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; +import gregtech.common.GT_Client; import gregtech.common.GT_Pollution; import ic2.api.Direction; import net.minecraft.block.Block; @@ -829,6 +832,10 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE } public ITexture getCoverTexture(byte aSide) { + if (getCoverIDAtSide(aSide) == 0) return null; + if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x1) != 0) { + return BlockIcons.HIDDEN_TEXTURE[0]; // See through + } return GregTech_API.sCovers.get(new GT_ItemStack(getCoverIDAtSide(aSide))); } diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/HIDDEN_FACE.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/HIDDEN_FACE.png new file mode 100644 index 0000000000..c2a9ed5cf0 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/HIDDEN_FACE.png differ -- cgit From 5143f1ee981ebdc5bc017ef1844fe0a249228603 Mon Sep 17 00:00:00 2001 From: Léa Gris Date: Wed, 24 Mar 2021 18:59:23 +0100 Subject: impr(textures): harminise cable insulations fix insulation texture was darker on cable ends than on cable sides --- .../gregtech/textures/blocks/iconsets/HIDDEN_FACE.png | Bin 118 -> 113 bytes .../textures/blocks/iconsets/INSULATION_FULL.png | Bin 935 -> 793 bytes .../textures/blocks/iconsets/INSULATION_HUGE.png | Bin 838 -> 880 bytes .../textures/blocks/iconsets/INSULATION_LARGE.png | Bin 1147 -> 885 bytes .../textures/blocks/iconsets/INSULATION_MEDIUM.png | Bin 779 -> 850 bytes .../blocks/iconsets/INSULATION_MEDIUM_PLUS.png | Bin 1147 -> 884 bytes .../textures/blocks/iconsets/INSULATION_SMALL.png | Bin 758 -> 833 bytes .../textures/blocks/iconsets/INSULATION_TINY.png | Bin 748 -> 818 bytes 8 files changed, 0 insertions(+), 0 deletions(-) (limited to 'src') diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/HIDDEN_FACE.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/HIDDEN_FACE.png index c2a9ed5cf0..a9c630ccf5 100644 Binary files a/src/main/resources/assets/gregtech/textures/blocks/iconsets/HIDDEN_FACE.png and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/HIDDEN_FACE.png differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_FULL.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_FULL.png index 2ad68dca74..e9cffc1ec1 100644 Binary files a/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_FULL.png and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_FULL.png differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_HUGE.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_HUGE.png index 9bb208adac..5b57738b6c 100644 Binary files a/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_HUGE.png and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_HUGE.png differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_LARGE.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_LARGE.png index 7f896a09f0..e572d7c37a 100644 Binary files a/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_LARGE.png and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_LARGE.png differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_MEDIUM.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_MEDIUM.png index 242e41dc2b..823363d223 100644 Binary files a/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_MEDIUM.png and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_MEDIUM.png differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_MEDIUM_PLUS.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_MEDIUM_PLUS.png index 666d51b82f..fd0c3a9647 100644 Binary files a/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_MEDIUM_PLUS.png and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_MEDIUM_PLUS.png differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_SMALL.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_SMALL.png index 68194b369b..57e94bf13b 100644 Binary files a/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_SMALL.png and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_SMALL.png differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_TINY.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_TINY.png index a5730989f0..b237e8e873 100644 Binary files a/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_TINY.png and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_TINY.png differ -- cgit From 93fd4f93dcb046836166c894be613b4531f80567 Mon Sep 17 00:00:00 2001 From: repo_alt Date: Thu, 25 Mar 2021 01:15:52 +0300 Subject: Enabled autoloading for oil drills Fixed chunk coordinates for self-loaded machine (in the first session) --- src/main/java/gregtech/api/objects/GT_ChunkManager.java | 2 +- .../machines/multi/GT_MetaTileEntity_DrillerBase.java | 5 ++++- .../machines/multi/GT_MetaTileEntity_OilDrillBase.java | 16 +++++++++++----- .../multi/GT_MetaTileEntity_OreDrillingPlantBase.java | 5 +---- 4 files changed, 17 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/main/java/gregtech/api/objects/GT_ChunkManager.java b/src/main/java/gregtech/api/objects/GT_ChunkManager.java index 0012bc78f4..ea2982e001 100644 --- a/src/main/java/gregtech/api/objects/GT_ChunkManager.java +++ b/src/main/java/gregtech/api/objects/GT_ChunkManager.java @@ -102,7 +102,7 @@ public class GT_ChunkManager implements ForgeChunkManager.OrderedLoadingCallback tag.setInteger("OwnerZ", owner.zCoord); ForgeChunkManager.forceChunk(ticket, chunkXZ); if (GT_Values.alwaysReloadChunkloaders) - ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(owner.xCoord << 4, owner.zCoord << 4)); + ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(owner.xCoord >> 4, owner.zCoord >> 4)); instance.registeredTickets.put(owner, ticket); } return true; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java index 68770644de..fdb61e1945 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java @@ -4,6 +4,7 @@ import gregtech.api.GregTech_API; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.enums.Textures; +import gregtech.api.interfaces.IChunkLoader; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -29,7 +30,7 @@ import java.util.ArrayList; import static gregtech.api.enums.GT_Values.W; -public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_MultiBlockBase { +public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_MultiBlockBase implements IChunkLoader { private static final ItemStack miningPipe = GT_ModHandler.getIC2Item("miningPipe", 0); private static final ItemStack miningPipeTip = GT_ModHandler.getIC2Item("miningPipeTip", 0); private static final Block miningPipeBlock = GT_Utility.getBlockFromStack(miningPipe); @@ -466,4 +467,6 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu } return false; } + @Override + public ChunkCoordIntPair getActiveChunk(){return mCurrentChunk;} } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java index a7a7023d34..48e5309287 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java @@ -2,6 +2,7 @@ package gregtech.common.tileentities.machines.multi; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.GT_ChunkManager; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Utility; @@ -9,8 +10,10 @@ 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.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; +import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.chunk.Chunk; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; @@ -25,10 +28,7 @@ import static gregtech.common.GT_UndergroundOil.undergroundOil; import static gregtech.common.GT_UndergroundOil.undergroundOilReadInformation; public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_DrillerBase { - - private boolean completedCycle = false; - - private ArrayList mOilFieldChunks = new ArrayList(); + private final ArrayList mOilFieldChunks = new ArrayList<>(); private int mOilId = 0; private int chunkRangeConfig = getRangeInChunks(); @@ -137,6 +137,11 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D } if (reachingVoidOrBedrock() && tryFillChunkList()) { + if (mWorkChunkNeedsReload) { + mCurrentChunk = new ChunkCoordIntPair(xDrill >> 4, zDrill >> 4); + GT_ChunkManager.requestChunkLoad((TileEntity) getBaseMetaTileEntity(), null); + mWorkChunkNeedsReload = false; + } float speed = .5F+(GT_Utility.getTier(getMaxInputVoltage()) - getMinTier()) *.25F; FluidStack tFluid = pumpOil(speed); if (tFluid != null && tFluid.amount > getTotalConfigValue()){ @@ -144,6 +149,7 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D return true; } } + GT_ChunkManager.releaseTicket((TileEntity)getBaseMetaTileEntity()); workState = STATE_UPWARD; return true; } @@ -220,7 +226,7 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D ); } - ArrayList emptyChunks = new ArrayList(); + ArrayList emptyChunks = new ArrayList<>(); for (Chunk tChunk : mOilFieldChunks) { tFluid = undergroundOil(tChunk,speed); diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java index e34ed7466f..ea894fc725 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java @@ -37,7 +37,7 @@ import org.lwjgl.input.Keyboard; import static gregtech.api.enums.GT_Values.VN; -public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTileEntity_DrillerBase implements IChunkLoader { +public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTileEntity_DrillerBase { private final ArrayList oreBlockPositions = new ArrayList<>(); protected int mTier = 1; private int chunkRadiusConfig = getRadiusInChunks(); @@ -63,9 +63,6 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile chunkRadiusConfig = aNBT.getInteger("chunkRadiusConfig"); } - @Override - public ChunkCoordIntPair getActiveChunk(){return mCurrentChunk;} - @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "OreDrillingPlant.png"); -- cgit From 891da876fde98a9627c16befe315a82b5f0456a3 Mon Sep 17 00:00:00 2001 From: Léa Gris Date: Thu, 25 Mar 2021 00:14:23 +0100 Subject: fix(tooltip): frameGT description Address issue: https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/7702 Remove mention of using CFoam over covers which has been replaced by chemical bath concrete based recipes since GT5.09. New Frame Box dexcription is localisable in `Gregtech.lang`: ```yaml S:gt.blockmachines.gt_frame.desc.format=Just something you can put covers on. ``` --- .../api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java index 7074d63422..455d327209 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java @@ -6,6 +6,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaPipeEntity; import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_ModHandler.RecipeBits; import gregtech.api.util.GT_OreDictUnificator; @@ -15,6 +16,9 @@ import net.minecraft.nbt.NBTTagCompound; import static gregtech.api.enums.GT_Values.RA; public class GT_MetaPipeEntity_Frame extends MetaPipeEntity { + private static final String localizedDescFormat = GT_LanguageManager.addStringLocalization( + "gt.blockmachines.gt_frame.desc.format", + "Just something you can put covers on."); public final Materials mMaterial; public GT_MetaPipeEntity_Frame(int aID, String aName, String aNameRegional, Materials aMaterial) { @@ -48,7 +52,7 @@ public class GT_MetaPipeEntity_Frame extends MetaPipeEntity { @Override public String[] getDescription() { - return new String[]{"Just something you can put a Cover or CFoam on."}; + return localizedDescFormat.split("\\R"); } @Override -- cgit From 1d2a62aeda030eb751844a5f1ca86158220f130e Mon Sep 17 00:00:00 2001 From: charles Date: Wed, 24 Mar 2021 17:44:59 -0600 Subject: Added T3 Molten Naquadria Recipe to Fusion Reactor. --- src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java index ce5625fa48..dbee955964 100644 --- a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java +++ b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java @@ -1206,6 +1206,8 @@ public class GT_MachineRecipeLoader implements Runnable { GT_Values.RA.addFusionReactorRecipe(Materials.Caesium.getMolten(144), Materials.Carbon.getMolten(144), Materials.Promethium.getMolten(144), 64, 49152, 400000000);//FT3 GT_Values.RA.addFusionReactorRecipe(Materials.Iridium.getMolten(144), Materials.Fluorine.getGas(500), Materials.Radon.getPlasma(144), 32, 98304, 450000000);//FT3 - utility GT_Values.RA.addFusionReactorRecipe(Materials.Plutonium241.getMolten(144), Materials.Hydrogen.getGas(2000), Materials.Americium.getPlasma(144), 64, 98304, 500000000);//FT3 + // + GT_Values.RA.addFusionReactorRecipe(Materials.Uranium.getMolten(432), Materials.Naquadah.getMolten(288), Materials.Naquadria.getMolten(144), 128, 112880, 600000000); //GT_Values.RA.addFusionReactorRecipe(Materials.Neutronium.getMolten(144), Materials.Neutronium.getMolten(144), Materials.Neutronium.getPlasma(72), 64, 130000, 640000000);//FT3+ - yes it is a bit troll XD GT_ModHandler.removeRecipeByOutput(ItemList.IC2_Fertilizer.get(1L)); -- cgit From 5bb2ed3deb2f95765fc2467da5ba98e651e8e44c Mon Sep 17 00:00:00 2001 From: charles Date: Wed, 24 Mar 2021 20:24:24 -0600 Subject: Added Naquadria Fusion Reactor recipe. --- src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java index dbee955964..a90249e25f 100644 --- a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java +++ b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java @@ -1207,7 +1207,8 @@ public class GT_MachineRecipeLoader implements Runnable { GT_Values.RA.addFusionReactorRecipe(Materials.Iridium.getMolten(144), Materials.Fluorine.getGas(500), Materials.Radon.getPlasma(144), 32, 98304, 450000000);//FT3 - utility GT_Values.RA.addFusionReactorRecipe(Materials.Plutonium241.getMolten(144), Materials.Hydrogen.getGas(2000), Materials.Americium.getPlasma(144), 64, 98304, 500000000);//FT3 // - GT_Values.RA.addFusionReactorRecipe(Materials.Uranium.getMolten(432), Materials.Naquadah.getMolten(288), Materials.Naquadria.getMolten(144), 128, 112880, 600000000); + GT_Values.RA.addFusionReactorRecipe(Materials.Plutonium.getMolten(432), Materials.Naquadah.getMolten(288), Materials.Naquadria.getMolten(144), 128, 112880, 600000000); + // //GT_Values.RA.addFusionReactorRecipe(Materials.Neutronium.getMolten(144), Materials.Neutronium.getMolten(144), Materials.Neutronium.getPlasma(72), 64, 130000, 640000000);//FT3+ - yes it is a bit troll XD GT_ModHandler.removeRecipeByOutput(ItemList.IC2_Fertilizer.get(1L)); -- cgit From dbf3f89d040555e75e998e08775dd5eeefaa877e Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Thu, 25 Mar 2021 18:34:28 +0100 Subject: Some Disassembler related fixes: #7654 #7586 #7676 --- .../basic/GT_MetaTileEntity_Disassembler.java | 120 +++++++++++++++------ 1 file changed, 89 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java index 755fae8bce..c8276f8747 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java @@ -107,24 +107,53 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi private static final ArrayListMultimap outputHardOverrides; + private static final Set blackList; + + public static Set getBlackList() { + return blackList; + } + static { outputHardOverrides = ArrayListMultimap.create(); outputHardOverrides.put(new GT_ItemStack(new ItemStack(Blocks.torch,6)), new ItemStack(Items.stick)); + blackList = new HashSet<>(); + blackList.add(new GT_ItemStack(ItemList.Casing_Coil_Superconductor.get(1L))); + } + + private boolean compareToUnpacker(ItemStack is){ + return null != GT_Recipe.GT_Recipe_Map.sUnboxinatorRecipes.findRecipe( + null, + true, + true, + Long.MAX_VALUE, + null, + is); } public int checkRecipe() { ItemStack is = getInputAt(0); + if (GT_Utility.isStackInvalid(is)) return DID_NOT_FIND_RECIPE; - if (is.getItem() instanceof GT_MetaGenerated_Tool) + + if ( + is.getItem() instanceof GT_MetaGenerated_Tool + || blackList.contains(new GT_ItemStack(is)) + || compareToUnpacker(is) + ) return DID_NOT_FIND_RECIPE; - ItemStack comp = new ItemStack(GregTech_API.sBlockMachines); - if (is.getItem() == comp.getItem()) { - IMetaTileEntity iMetaTileEntity = GregTech_API.METATILEENTITIES[is.getItemDamage()]; - if (iMetaTileEntity instanceof GT_MetaTileEntity_TieredMachineBlock && - ((GT_MetaTileEntity_TieredMachineBlock) iMetaTileEntity).mTier > this.mTier) - return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; - } + + if (checkTier(is)) + return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; + + Integer handleHardOverride = handleHardOverride(is); + if (handleHardOverride != null) + return handleHardOverride; + + return process(); + } + + private Integer handleHardOverride(ItemStack is) { Set stacks = outputHardOverrides.keySet(); for (GT_ItemStack stack : stacks) { ItemStack in = is.copy(); @@ -135,32 +164,60 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi : DID_NOT_FIND_RECIPE; } } - return process() - ? FOUND_AND_SUCCESSFULLY_USED_RECIPE - : DID_NOT_FIND_RECIPE; + return null; } - private boolean process(){ + private boolean checkTier(ItemStack is) { + ItemStack comp = new ItemStack(GregTech_API.sBlockMachines); + if (is.getItem() == comp.getItem()) { + IMetaTileEntity iMetaTileEntity = GregTech_API.METATILEENTITIES[is.getItemDamage()]; - GT_Recipe gt_recipe = GT_Recipe.GT_Recipe_Map.sDisassemblerRecipes.findRecipe(this.getBaseMetaTileEntity(), true, this.mEUt, null, this.getAllInputs()); - if (gt_recipe != null) { - gt_recipe.isRecipeInputEqual(true, null, this.getRealInventory()); - return setOutputsAndTime(gt_recipe.mOutputs, gt_recipe.mInputs[0].stackSize); + return iMetaTileEntity instanceof GT_MetaTileEntity_TieredMachineBlock && + ((GT_MetaTileEntity_TieredMachineBlock) iMetaTileEntity).mTier > this.mTier; } + return false; + } + + private int process(){ + int statusCode = checkRecipeMap(); + if (statusCode != DID_NOT_FIND_RECIPE) + return statusCode; + + return onTheFlyGeneration(); + } + private int onTheFlyGeneration() { Collection recipes = this.findRecipeFromMachine(); if (recipes.isEmpty()) - return false; + return DID_NOT_FIND_RECIPE; DissassembleReference recipe = ensureDowncasting(recipes); + removeInvalidStacks(recipe); + + return setOutputsAndTime(recipe.inputs, recipe.stackSize) + ? FOUND_AND_SUCCESSFULLY_USED_RECIPE + : FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; + } + + private void removeInvalidStacks(DissassembleReference recipe) { for (int i = 0; i < recipe.inputs.length; i++) if (GT_Utility.isStackInvalid(recipe.inputs[i]) || recipe.inputs[i].stackSize < 1) recipe.inputs[i] = null; recipe.inputs = GT_Utility.getArrayListWithoutNulls(recipe.inputs).toArray(new ItemStack[0]); + } + + private int checkRecipeMap() { + GT_Recipe gt_recipe = GT_Recipe.GT_Recipe_Map.sDisassemblerRecipes.findRecipe(this.getBaseMetaTileEntity(), true, this.maxEUInput(), null, this.getAllInputs()); + if (gt_recipe == null) + return DID_NOT_FIND_RECIPE; + if (gt_recipe.isRecipeInputEqual(false, null, this.getAllInputs())) + return setOutputsAndTime(gt_recipe.mOutputs, gt_recipe.mInputs[0].stackSize) + ? FOUND_AND_SUCCESSFULLY_USED_RECIPE + : FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; - return setOutputsAndTime(recipe.inputs, recipe.stackSize); + return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; } private boolean setOutputsAndTime(ItemStack[] inputs, int stackSize){ @@ -420,19 +477,20 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi //More Inputs should mean cheaper Materials return possibleRecipes .stream() - .sorted(Comparator.comparingDouble(x -> - { - double fluidInputValueRaw = Arrays.stream(x.recipe.mFluidInputs).flatMapToInt(f -> IntStream.of(f.amount)).sum(); - fluidInputValueRaw = fluidInputValueRaw > 0 ? fluidInputValueRaw : 144D; - double inputValue = Arrays.stream(x.inputs).flatMapToInt(f -> IntStream.of(f.stackSize)).sum() + - (fluidInputValueRaw / 144D); - double fluidOutputValueRaw = Arrays.stream(x.recipe.mFluidOutputs).flatMapToInt(f -> IntStream.of(f.amount)).sum(); - fluidOutputValueRaw = fluidOutputValueRaw > 0 ? fluidOutputValueRaw : 144D; - double outputValue = Arrays.stream(x.recipe.mOutputs).flatMapToInt(f -> IntStream.of(f.stackSize)).sum() + - (fluidOutputValueRaw / 144D); - return inputValue / outputValue; - } - )).collect(Collectors.toList()); + .sorted(Comparator.comparingDouble(GT_MetaTileEntity_Disassembler::getCheaperInputs)) + .collect(Collectors.toList()); + } + + private static double getCheaperInputs(GT_MetaTileEntity_Disassembler.DissassembleReference x){ + double fluidInputValueRaw = Arrays.stream(x.recipe.mFluidInputs).flatMapToInt(f -> IntStream.of(f.amount)).sum(); + fluidInputValueRaw = fluidInputValueRaw > 0 ? fluidInputValueRaw : 144D; + double inputValue = Arrays.stream(x.inputs).flatMapToInt(f -> IntStream.of(f.stackSize)).sum() + + (fluidInputValueRaw / 144D); + double fluidOutputValueRaw = Arrays.stream(x.recipe.mFluidOutputs).flatMapToInt(f -> IntStream.of(f.amount)).sum(); + fluidOutputValueRaw = fluidOutputValueRaw > 0 ? fluidOutputValueRaw : 144D; + double outputValue = Arrays.stream(x.recipe.mOutputs).flatMapToInt(f -> IntStream.of(f.stackSize)).sum() + + (fluidOutputValueRaw / 144D); + return inputValue / outputValue; } public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { -- cgit From bdeb714ca78638429759f5f2de247ef47d574bc4 Mon Sep 17 00:00:00 2001 From: Léa Gris Date: Fri, 26 Mar 2021 14:39:31 +0100 Subject: fix(covers): stone plate cover block texture selection Add the ore dicitionary name `stoneStone` to the `minecraft:stone` block, so it can be selected with prefix `stone` and material `Stone` when registering the stone plate cover's block texture. --- src/main/java/gregtech/loaders/preload/GT_Loader_OreDictionary.java | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/main/java/gregtech/loaders/preload/GT_Loader_OreDictionary.java b/src/main/java/gregtech/loaders/preload/GT_Loader_OreDictionary.java index 737d023759..471b1ad529 100644 --- a/src/main/java/gregtech/loaders/preload/GT_Loader_OreDictionary.java +++ b/src/main/java/gregtech/loaders/preload/GT_Loader_OreDictionary.java @@ -96,6 +96,7 @@ public class GT_Loader_OreDictionary implements Runnable { GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Basalt, GT_ModHandler.getModItem("Railcraft", "tile.railcraft.brick.abyssal", 1L, 32767)); GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Marble, GT_ModHandler.getModItem("Railcraft", "tile.railcraft.brick.quarried", 1L, 32767)); GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Obsidian, new ItemStack(Blocks.obsidian, 1, 32767)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Stone, new ItemStack(Blocks.stone, 1, 32767)); GT_OreDictUnificator.registerOre(OrePrefixes.stoneMossy, new ItemStack(Blocks.mossy_cobblestone, 1, 32767)); GT_OreDictUnificator.registerOre(OrePrefixes.stoneCobble, new ItemStack(Blocks.mossy_cobblestone, 1, 32767)); GT_OreDictUnificator.registerOre(OrePrefixes.stoneCobble, new ItemStack(Blocks.cobblestone, 1, 32767)); -- cgit From 2ee695ef9fb03d995783a1396319ac714250341d Mon Sep 17 00:00:00 2001 From: botn365 <42187820+botn365@users.noreply.github.com> Date: Fri, 26 Mar 2021 15:27:25 +0100 Subject: fix ingot to wire time --- src/main/java/gregtech/loaders/oreprocessing/ProcessingFineWire.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingFineWire.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingFineWire.java index 7ed86696fe..620d62211e 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingFineWire.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingFineWire.java @@ -17,8 +17,8 @@ public class ProcessingFineWire implements gregtech.api.interfaces.IOreRecipeReg public void registerOre(OrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) { if (!aMaterial.contains(gregtech.api.enums.SubTag.NO_SMASHING)) { - GT_Values.RA.addWiremillRecipe(GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 1L), GT_Utility.copy(GT_OreDictUnificator.get(OrePrefixes.wireGt01, aMaterial, 2L), GT_Utility.copyAmount(8L, aStack)), 500, 4); - GT_Values.RA.addWiremillRecipe(GT_OreDictUnificator.get(OrePrefixes.stick, aMaterial, 1L), GT_Utility.copy(GT_OreDictUnificator.get(OrePrefixes.wireGt01, aMaterial, 1L), GT_Utility.copyAmount(4L, aStack)), 200, 4); + GT_Values.RA.addWiremillRecipe(GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 1L), GT_Utility.copy(GT_OreDictUnificator.get(OrePrefixes.wireGt01, aMaterial, 2L), GT_Utility.copyAmount(8L, aStack)), 100, 4); + GT_Values.RA.addWiremillRecipe(GT_OreDictUnificator.get(OrePrefixes.stick, aMaterial, 1L), GT_Utility.copy(GT_OreDictUnificator.get(OrePrefixes.wireGt01, aMaterial, 1L), GT_Utility.copyAmount(4L, aStack)), 50, 4); } if ((aMaterial.mUnificatable) && (aMaterial.mMaterialInto == aMaterial) && !aMaterial.contains(SubTag.NO_WORKING)) { GT_ModHandler.addCraftingRecipe(GT_Utility.copyAmount(1L, aStack), GT_Proxy.tBits, new Object[]{"Xx", 'X', OrePrefixes.foil.get(aMaterial)}); -- cgit From 8567bde9e18051c7d23a84831f552493c1730178 Mon Sep 17 00:00:00 2001 From: Léa Gris Date: Fri, 26 Mar 2021 17:21:04 +0100 Subject: fix(covers): nether quartz plate cover block texture selection Add the ore dicitionary name `blockNetherQuartz` to the `minecraft:quartz_block` block, so it can be selected with prefix `block` and material `NetherQuartz` when registering the NetherQuartz plate cover's block texture. --- src/main/java/gregtech/loaders/preload/GT_Loader_OreDictionary.java | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/main/java/gregtech/loaders/preload/GT_Loader_OreDictionary.java b/src/main/java/gregtech/loaders/preload/GT_Loader_OreDictionary.java index 471b1ad529..d6890cfd9e 100644 --- a/src/main/java/gregtech/loaders/preload/GT_Loader_OreDictionary.java +++ b/src/main/java/gregtech/loaders/preload/GT_Loader_OreDictionary.java @@ -81,6 +81,7 @@ public class GT_Loader_OreDictionary implements Runnable { GT_OreDictUnificator.set(OrePrefixes.block, Materials.Lapis, new ItemStack(Blocks.lapis_block, 1, 0)); GT_OreDictUnificator.set(OrePrefixes.block, Materials.Coal, new ItemStack(Blocks.coal_block, 1, 0)); GT_OreDictUnificator.set(OrePrefixes.block, Materials.Redstone, new ItemStack(Blocks.redstone_block, 1, 0)); + GT_OreDictUnificator.set(OrePrefixes.block, Materials.NetherQuartz, new ItemStack(Blocks.quartz_block, 1, 0)); if (Blocks.ender_chest != null) { GT_OreDictUnificator.registerOre(OreDictNames.enderChest, new ItemStack(Blocks.ender_chest, 1)); } -- cgit From 74f5841432f09c537a7e9d8d2ab00ee524ca5932 Mon Sep 17 00:00:00 2001 From: Léa Gris Date: Fri, 26 Mar 2021 18:17:40 +0100 Subject: fix(covers): glowstone plate cover block texture selection Add the ore dicitionary name `stoneGlowstone` to the `minecraft:glowstone` block, so it can be selected with prefix `stone` and material `glowstone` when registering the Glowstone plate cover's block texture. --- src/main/java/gregtech/loaders/preload/GT_Loader_OreDictionary.java | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/main/java/gregtech/loaders/preload/GT_Loader_OreDictionary.java b/src/main/java/gregtech/loaders/preload/GT_Loader_OreDictionary.java index d6890cfd9e..cc0c45b38c 100644 --- a/src/main/java/gregtech/loaders/preload/GT_Loader_OreDictionary.java +++ b/src/main/java/gregtech/loaders/preload/GT_Loader_OreDictionary.java @@ -110,6 +110,7 @@ public class GT_Loader_OreDictionary implements Runnable { GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Netherrack, new ItemStack(Blocks.netherrack, 1, 32767)); GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.NetherBrick, new ItemStack(Blocks.nether_brick, 1, 32767)); GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Endstone, new ItemStack(Blocks.end_stone, 1, 32767)); + GT_OreDictUnificator.registerOre(OrePrefixes.stone, Materials.Glowstone, new ItemStack(Blocks.glowstone, 1, 32767)); GT_OreDictUnificator.registerOre("paperResearchFragment", GT_ModHandler.getModItem("Thaumcraft", "ItemResource", 1L, 9)); GT_OreDictUnificator.registerOre("itemCertusQuartz", GT_ModHandler.getModItem("appliedenergistics2", "item.ItemMultiMaterial", 1L, 1)); -- cgit From e5bd3bb52e0ffc78c7eb984e0ee0425fc575a9bd Mon Sep 17 00:00:00 2001 From: Léa Gris Date: Fri, 26 Mar 2021 18:57:56 +0100 Subject: fix(covers): clay plate cover block texture selection Add the ore dicitionary name `blockClay` to the `minecraft:clay` block, so it can be selected with prefix `block` and material `clay` when registering the clay plate cover's block texture. --- src/main/java/gregtech/loaders/preload/GT_Loader_OreDictionary.java | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/main/java/gregtech/loaders/preload/GT_Loader_OreDictionary.java b/src/main/java/gregtech/loaders/preload/GT_Loader_OreDictionary.java index cc0c45b38c..c185fa8177 100644 --- a/src/main/java/gregtech/loaders/preload/GT_Loader_OreDictionary.java +++ b/src/main/java/gregtech/loaders/preload/GT_Loader_OreDictionary.java @@ -82,6 +82,7 @@ public class GT_Loader_OreDictionary implements Runnable { GT_OreDictUnificator.set(OrePrefixes.block, Materials.Coal, new ItemStack(Blocks.coal_block, 1, 0)); GT_OreDictUnificator.set(OrePrefixes.block, Materials.Redstone, new ItemStack(Blocks.redstone_block, 1, 0)); GT_OreDictUnificator.set(OrePrefixes.block, Materials.NetherQuartz, new ItemStack(Blocks.quartz_block, 1, 0)); + GT_OreDictUnificator.set(OrePrefixes.block, Materials.Clay, new ItemStack(Blocks.clay, 1, 0)); if (Blocks.ender_chest != null) { GT_OreDictUnificator.registerOre(OreDictNames.enderChest, new ItemStack(Blocks.ender_chest, 1)); } -- cgit From 3d464a19d7c652fc64f5db7df8091479dc941932 Mon Sep 17 00:00:00 2001 From: Glease <4586901+Glease@users.noreply.github.com> Date: Sun, 28 Mar 2021 22:18:22 +0800 Subject: Reduce price of magic generators Basically make the recipes use T+1 circuits/metal instead of T+2. EV magic generator will additionally require tungsten steel plates to prevent it from becoming too cheap. Signed-off-by: Glease <4586901+Glease@users.noreply.github.com> --- src/main/java/gregtech/api/enums/OrePrefixes.java | 2 +- .../loaders/postload/GT_MachineRecipeLoader.java | 38 ++++++++++++---------- 2 files changed, 21 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/main/java/gregtech/api/enums/OrePrefixes.java b/src/main/java/gregtech/api/enums/OrePrefixes.java index 59c20d412b..ba91886c99 100644 --- a/src/main/java/gregtech/api/enums/OrePrefixes.java +++ b/src/main/java/gregtech/api/enums/OrePrefixes.java @@ -703,7 +703,7 @@ public enum OrePrefixes { if (!enableUnusedTriplePlates && !(aMaterial == Materials.Paper)) plateTriple.mDisabledItems.add(aMaterial); if (!enableUnusedQuadPlates && !(aMaterial == Materials.Paper)) plateQuadruple.mDisabledItems.add(aMaterial); if (!enableUnusedQuinPlates && !(aMaterial == Materials.Paper)) plateQuintuple.mDisabledItems.add(aMaterial); - if (!(enableUnusedDensePlates || GregTech_API.mGTPlusPlus) && !(aMaterial == Materials.Iron || aMaterial == Materials.Copper || aMaterial == Materials.Lead || aMaterial == Materials.Paper)) + if (!(enableUnusedDensePlates || GregTech_API.mGTPlusPlus) && !(aMaterial == Materials.Iron || aMaterial == Materials.Copper || aMaterial == Materials.Lead || aMaterial == Materials.Paper || aMaterial == Materials.Thaumium || aMaterial == Materials.Titanium)) plateDense.mDisabledItems.add(aMaterial); //Rotors if (!enableUnusedRotors && !(aMaterial == Materials.Titanium || aMaterial == Materials.Chrome || aMaterial == Materials.Tin || aMaterial == Materials.Osmium || diff --git a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java index ce5625fa48..d9d67aa6ea 100644 --- a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java +++ b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java @@ -2636,10 +2636,10 @@ public class GT_MachineRecipeLoader implements Runnable { ItemList.Hull_LV.get(1L), new ItemStack[]{ new ItemStack(Blocks.beacon), - GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 1L), - GT_OreDictUnificator.get(OrePrefixes.plate, Materials.StainlessSteel, 1L), + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Good, 1L), + GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Aluminium, 1L), ItemList.Sensor_MV.get(2L), - GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 1L), + GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Good, 1L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Thaumium, 1L), Item