aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/xmod/gregtech/common
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2022-01-21 19:17:26 +0000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2022-01-21 19:17:26 +0000
commitba8f7141fb7f91c0f7e769afa9bf406071f33759 (patch)
tree3b1a7ebd8343e61a8314b023a3e5e253b0dad968 /src/main/java/gtPlusPlus/xmod/gregtech/common
parent8ef649f21845808a6f58f02a4b50c799529eb258 (diff)
parent888f07c5796b860bb7e0fbb507a5728950e941fd (diff)
downloadGT5-Unofficial-ba8f7141fb7f91c0f7e769afa9bf406071f33759.tar.gz
GT5-Unofficial-ba8f7141fb7f91c0f7e769afa9bf406071f33759.tar.bz2
GT5-Unofficial-ba8f7141fb7f91c0f7e769afa9bf406071f33759.zip
Merge branch 'master' of https://github.com/GTNewHorizons/GTplusplus into New-Multis-3
# Conflicts: # .gitignore # build.gradle # src/main/java/gtPlusPlus/core/handler/COMPAT_HANDLER.java # src/main/java/gtPlusPlus/core/lib/LoadedMods.java # src/main/java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java # src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java # src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java # src/main/resources/assets/miscutils/lang/en_US.lang
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/common')
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java4
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java9
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow.java10
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_AutoChisel.java155
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialChisel.java474
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java12
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FrothFlotationCell.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialRockBreaker.java559
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java24
11 files changed, 1234 insertions, 19 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java
index 8cd6dd0ca8..76bd57b3fa 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java
@@ -46,6 +46,10 @@ extends GregtechMetaCasingBlocksAbstract {
public GregtechMetaCasingBlocks3() {
super(GregtechMetaCasingItemBlocks3.class, "gtplusplus.blockcasings.3", GT_Material_Casings.INSTANCE);
for (byte i = 0; i < 16; i = (byte) (i + 1)) {
+ // Free up Redox casing in TAE
+ if (i >= 4 && i <= 8) {
+ continue;
+ }
TAE.registerTexture(2, i, new GT_CopiedBlockTexture(this, 6, i));
}
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Aquatic Casing");
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java
index 841ea582ad..fe247e24a4 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java
@@ -18,7 +18,8 @@ import net.minecraft.world.IBlockAccess;
public class GregtechMetaCasingBlocks5
extends GregtechMetaCasingBlocksAbstract {
- //Free Indexes within TAE: 90, 91, 92, 94, 114, 116, 117, 118, 119, 120, 121, 124, 125, 126, 127
+ // Free Indexes within TAE: 91, 92, 94, 100, 101, 102, 103, 104, 114, 116, 117, 118, 119, 120, 121, 124, 125, 126, 127
+ // 19 Free Indexes
private static final TexturesGrinderMultiblock mGrinderOverlayHandler = new TexturesGrinderMultiblock();
public GregtechMetaCasingBlocks5() {
@@ -31,7 +32,8 @@ extends GregtechMetaCasingBlocksAbstract {
TAE.registerTexture(0, 3, new GT_CopiedBlockTexture(this, 6, 3));
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", "Sparge Tower Exterior Casing"); // Sparge Tower Casing
TAE.registerTexture(0, 4, new GT_CopiedBlockTexture(this, 6, 4));
- GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Sturdy Printer Casing"); // Unused
+ TAE.registerTexture(1, 10, new GT_CopiedBlockTexture(this, 6, 5));
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "Forge Casing"); // Forge Hammer Casing
TAE.registerTexture(1, 11, new GT_CopiedBlockTexture(this, 6, 6));
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", ""); // Unused
@@ -49,6 +51,7 @@ extends GregtechMetaCasingBlocksAbstract {
GregtechItemList.Casing_IsaMill_Gearbox.set(new ItemStack(this, 1, 2));
GregtechItemList.Casing_ElementalDuplicator.set(new ItemStack(this, 1, 3));
GregtechItemList.Casing_Sparge_Tower_Exterior.set(new ItemStack(this, 1, 4));
+ GregtechItemList.Casing_IndustrialAutoChisel.set(new ItemStack(this, 1, 5));
GregtechItemList.Casing_IndustrialForgeHammer.set(new ItemStack(this, 1, 6));
}
@@ -71,6 +74,8 @@ extends GregtechMetaCasingBlocksAbstract {
return TexturesGtBlock.TEXTURE_TECH_PANEL_D.getIcon();
case 4:
return TexturesGtBlock.Casing_Machine_Metal_Sheet_H.getIcon();
+ case 5:
+ return TexturesGtBlock.Casing_Machine_Metal_Sheet_I.getIcon();
case 6:
return TexturesGtBlock.TEXTURE_TECH_PANEL_H.getIcon();
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java
index 5642baa32d..e6ccc419e0 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java
@@ -538,6 +538,8 @@ public class TexturesGtBlock {
private static final CustomIcon Internal_Overlay_Oil = new CustomIcon("TileEntities/adv_machine_oil");
public static final CustomIcon Overlay_Oil = Internal_Overlay_Oil;
+ private static final CustomIcon Internal_Overlay_Water = new CustomIcon("TileEntities/adv_machine_water");
+ public static final CustomIcon Overlay_Water = Internal_Overlay_Water;
private static final CustomIcon Internal_Overlay_UU_Matter = new CustomIcon("TileEntities/adv_machine_uum");
public static final CustomIcon Overlay_UU_Matter = Internal_Overlay_UU_Matter;
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow.java
index a88fbc0d66..072cf78c90 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow.java
@@ -76,7 +76,7 @@ public class GTPP_Cover_Overflow extends GT_CoverBehavior {
if (aCoverVariable <= 0) {
aCoverVariable = mMaxTransferRate;
}
- GT_Utility.sendChatToPlayer(aPlayer, LangUtils.trans("009", "Overflow point: ") + aCoverVariable + trans("010", "L"));
+ GT_Utility.sendChatToPlayer(aPlayer, LangUtils.trans("322", "Overflow point: ") + aCoverVariable + trans("323", "L"));
return aCoverVariable;
}
@@ -95,7 +95,7 @@ public class GTPP_Cover_Overflow extends GT_CoverBehavior {
if (aCoverVariable <= 0) {
aCoverVariable = mMaxTransferRate;
}
- GT_Utility.sendChatToPlayer(aPlayer, LangUtils.trans("009", "Overflow point: ") + aCoverVariable + trans("010", "L"));
+ GT_Utility.sendChatToPlayer(aPlayer, LangUtils.trans("322", "Overflow point: ") + aCoverVariable + trans("323", "L"));
aTileEntity.setCoverDataAtSide(aSide, aCoverVariable);
return true;
}
@@ -183,11 +183,11 @@ public class GTPP_Cover_Overflow extends GT_CoverBehavior {
@Override
public void drawExtras(int mouseX, int mouseY, float parTicks) {
super.drawExtras(mouseX, mouseY, parTicks);
- this.getFontRenderer().drawString(trans("010", "L"), startX + spaceX * 4, 4 + startY + spaceY * 0 + 8, 0xFF555555);
+ this.getFontRenderer().drawString(trans("323", "L"), startX + spaceX * 4, 4 + startY + spaceY * 0 + 8, 0xFF555555);
if (warn)
- this.getFontRenderer().drawString(trans("011","Max")+": "+coverVariable+"/"+mMaxTransferRate+" "+trans("010", "L"), startX + spaceX * 0, 4 + startY + spaceY * 1 + 6, 0xffff0000);
+ this.getFontRenderer().drawString(trans("325","Max")+": "+coverVariable+"/"+mMaxTransferRate+" "+trans("323", "L"), startX + spaceX * 0, 4 + startY + spaceY * 1 + 6, 0xffff0000);
else
- this.getFontRenderer().drawString(trans("011","Now")+": "+coverVariable+"/"+mMaxTransferRate+" "+trans("010", "L"), startX + spaceX * 0, 4 + startY + spaceY * 1 + 6, 0xFF555555);
+ this.getFontRenderer().drawString(trans("324","Now")+": "+coverVariable+"/"+mMaxTransferRate+" "+trans("323", "L"), startX + spaceX * 0, 4 + startY + spaceY * 1 + 6, 0xFF555555);
}
@Override
public void onMouseWheel(int x, int y, int delta) {
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_AutoChisel.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_AutoChisel.java
new file mode 100644
index 0000000000..f2fc0cce7a
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_AutoChisel.java
@@ -0,0 +1,155 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
+
+import java.util.List;
+
+import gregtech.api.enums.Textures.BlockIcons;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.item.ItemStack;
+import team.chisel.carving.Carving;
+
+public class GregtechMetaTileEntity_AutoChisel extends GT_MetaTileEntity_BasicMachine {
+
+ private ItemStack mInputCache;
+ private ItemStack mOutputCache;
+
+ public GregtechMetaTileEntity_AutoChisel(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 1, "Chisels things, Gregtech style", 1, 1, "Compressor.png", "",
+ new ITexture[]{
+ new GT_RenderedTexture(BlockIcons.OVERLAY_SIDE_MASSFAB_ACTIVE),
+ new GT_RenderedTexture(BlockIcons.OVERLAY_SIDE_MASSFAB),
+ new GT_RenderedTexture(BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE),
+ new GT_RenderedTexture(BlockIcons.OVERLAY_FRONT_MULTI_SMELTER),
+ new GT_RenderedTexture(TexturesGtBlock.Overlay_MatterFab_Active),
+ new GT_RenderedTexture(TexturesGtBlock.Overlay_MatterFab),
+ new GT_RenderedTexture(BlockIcons.OVERLAY_BOTTOM_MASSFAB_ACTIVE),
+ new GT_RenderedTexture(BlockIcons.OVERLAY_BOTTOM_MASSFAB)
+ });
+ }
+
+ public GregtechMetaTileEntity_AutoChisel(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) {
+ super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName);
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_AutoChisel(this.mName, this.mTier, this.mDescription, this.mTextures, this.mGUIName, this.mNEIName);
+ }
+
+ @Override
+ public String[] getDescription() {
+ String[] A = new String[]{
+ this.mDescription,
+ "What you want to chisel goes in slot 1",
+ "What you want to get goes in the special slot (bottom right)",
+ "If special slot is empty, first chisel result is used"
+ };
+ return A;
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeList() {
+ return null;
+ }
+
+ private boolean hasValidCache(ItemStack aStack, ItemStack aSpecialSlot, boolean aClearOnFailure) {
+ if (mInputCache != null && mOutputCache != null) {
+ if (GT_Utility.areStacksEqual(aStack, mInputCache) && GT_Utility.areStacksEqual(aSpecialSlot, mOutputCache)) {
+ return true;
+ }
+ }
+ // clear cache if it was invalid
+ if (aClearOnFailure) {
+ mInputCache = null;
+ mOutputCache = null;
+ }
+ return false;
+ }
+
+ private void cacheItem(ItemStack mInputItem, ItemStack mOutputItem) {
+ mOutputCache = mOutputItem.copy();
+ mInputCache = mInputItem.copy();
+ }
+
+ @Override
+ protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return hasValidCache(aStack, this.getSpecialSlot(), false) ? true : super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && hasChiselResults(aStack);
+ }
+
+ // lets make sure the user isn't trying to make something from a block that doesn't have this as a valid target
+ private static boolean canBeMadeFrom(ItemStack from, ItemStack to) {
+ List<ItemStack> results = getItemsForChiseling(from);
+ for (ItemStack s : results) {
+ if (s.getItem() == to.getItem() && s.getItemDamage() == to.getItemDamage()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ // lets make sure the user isn't trying to make something from a block that doesn't have this as a valid target
+ private static boolean hasChiselResults(ItemStack from) {
+ List<ItemStack> results = getItemsForChiseling(from);
+ return results.size() > 0;
+ }
+
+ private static List<ItemStack> getItemsForChiseling(ItemStack aStack){
+ return Carving.chisel.getItemsForChiseling(aStack);
+ }
+
+ private static ItemStack getChiselOutput(ItemStack aInput, ItemStack aTarget) {
+ ItemStack tOutput = null;
+ if (aTarget != null && canBeMadeFrom(aInput, aTarget)) {
+ tOutput = aTarget;
+ }
+ else if (aTarget != null && !canBeMadeFrom(aInput, aTarget)) {
+ tOutput = null;
+ }
+ else {
+ tOutput = getItemsForChiseling(aInput).get(0);
+ }
+ return tOutput;
+ }
+
+ @Override
+ public int checkRecipe() {
+ ItemStack tOutput = null;
+ ItemStack aInput = getInputAt(0);
+ ItemStack aTarget = getSpecialSlot();
+ boolean tIsCached = hasValidCache(aInput, aTarget, true);
+ if (aInput != null && hasChiselResults(aInput) && aInput.stackSize > 0) {
+ tOutput = tIsCached ? mOutputCache.copy() : getChiselOutput(aInput, aTarget);
+ if (tOutput != null) {
+ tOutput = tOutput.copy();
+ tOutput.stackSize = 1;
+ // We can chisel this
+ if (canOutput(tOutput)) {
+ getInputAt(0).stackSize -= 1;
+ calculateOverclockedNess(16, 20);
+ //In case recipe is too OP for that machine
+ if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) {
+ return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
+ }
+ if (!tIsCached) {
+ cacheItem(ItemUtils.getSimpleStack(aInput, 1), ItemUtils.getSimpleStack(tOutput, 1));
+ }
+ this.mOutputItems[0] = tOutput.copy();
+ return FOUND_AND_SUCCESSFULLY_USED_RECIPE;
+ }
+ else {
+ mOutputBlocked++;
+ return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
+ }
+ }
+ }
+ return DID_NOT_FIND_RECIPE;
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialChisel.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialChisel.java
new file mode 100644
index 0000000000..b59bf61301
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialChisel.java
@@ -0,0 +1,474 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing;
+
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
+import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.lang3.ArrayUtils;
+
+import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
+import com.gtnewhorizon.structurelib.structure.StructureDefinition;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GTPP_Recipe;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+import team.chisel.carving.Carving;
+
+public class GregtechMetaTileEntity_IndustrialChisel extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialChisel> {
+
+ private int mCasing;
+ private IStructureDefinition<GregtechMetaTileEntity_IndustrialChisel> STRUCTURE_DEFINITION = null;
+ private ItemStack mInputCache;
+ private ItemStack mOutputCache;
+ private GTPP_Recipe mCachedRecipe;
+
+ public GregtechMetaTileEntity_IndustrialChisel(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_IndustrialChisel(String aName) {
+ super(aName);
+ }
+
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IndustrialChisel(this.mName);
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Chisel";
+ }
+
+ @Override
+ protected GT_Multiblock_Tooltip_Builder createTooltip() {
+ GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType(getMachineType())
+ .addInfo("Factory Grade Auto Chisel")
+ .addInfo("Target block goes in GUI slot")
+ .addInfo("If no target provided, firdt chisel result is used")
+ .addInfo("Speed: 200% | Eu Usage: 75% | Parallel: Tier x 16")
+ .addPollutionAmount(getPollutionPerSecond(null))
+ .addSeparator()
+ .beginStructureBlock(3, 3, 3, true)
+ .addController("Front center")
+ .addCasingInfo("Sturdy Printer Casing", 10)
+ .addInputBus("Any casing", 1)
+ .addOutputBus("Any casing", 1)
+ .addEnergyHatch("Any casing", 1)
+ .addMaintenanceHatch("Any casing", 1)
+ .addMufflerHatch("Any casing", 1)
+ .toolTipFinisher(CORE.GT_Tooltip_Builder);
+ return tt;
+ }
+
+ @Override
+ public IStructureDefinition<GregtechMetaTileEntity_IndustrialChisel> getStructureDefinition() {
+ if (STRUCTURE_DEFINITION == null) {
+ STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_IndustrialChisel>builder()
+ .addShape(mName, transpose(new String[][]{
+ {"CCC", "CCC", "CCC"},
+ {"C~C", "C-C", "CCC"},
+ {"CCC", "CCC", "CCC"},
+ }))
+ .addElement(
+ 'C',
+ ofChain(
+ ofHatchAdder(
+ GregtechMetaTileEntity_IndustrialChisel::addAdvChiselList, 90, 1
+ ),
+ onElementPass(
+ x -> ++x.mCasing,
+ ofBlock(
+ ModBlocks.blockCasings5Misc, 5
+ )
+ )
+ )
+ )
+ .build();
+ }
+ return STRUCTURE_DEFINITION;
+ }
+
+ public final boolean addAdvChiselList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ } else {
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy){
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void construct(ItemStack stackSize, boolean hintsOnly) {
+ buildPiece(mName, stackSize, hintsOnly, 1, 1, 0);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mCasing = 0;
+ return checkPiece(mName, 1, 1, 0) && mCasing >= 10 && checkHatch();
+ }
+
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(90), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced)};
+ }
+ return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(90)};
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return true;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "ImplosionCompressor";
+ }
+
+ @Override
+ public boolean requiresVanillaGtGUI() {
+ return true;
+ }
+
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return null;
+ }
+
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return true;
+ }
+
+ private boolean hasValidCache(ItemStack aStack, ItemStack aSpecialSlot, boolean aClearOnFailure) {
+ if (mInputCache != null && mOutputCache != null && mCachedRecipe != null) {
+ if (GT_Utility.areStacksEqual(aStack, mInputCache) && GT_Utility.areStacksEqual(aSpecialSlot, mOutputCache)) {
+ return true;
+ }
+ }
+ // clear cache if it was invalid
+ if (aClearOnFailure) {
+ mInputCache = null;
+ mOutputCache = null;
+ mCachedRecipe = null;
+ }
+ return false;
+ }
+
+ private void cacheItem(ItemStack aInputItem, ItemStack aOutputItem, GTPP_Recipe aRecipe) {
+ mInputCache = aInputItem.copy();
+ mOutputCache = aOutputItem.copy();
+ mCachedRecipe = aRecipe;
+ }
+
+ // lets make sure the user isn't trying to make something from a block that doesn't have this as a valid target
+ private static boolean canBeMadeFrom(ItemStack from, ItemStack to) {
+ List<ItemStack> results = getItemsForChiseling(from);
+ for (ItemStack s : results) {
+ if (s.getItem() == to.getItem() && s.getItemDamage() == to.getItemDamage()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ // lets make sure the user isn't trying to make something from a block that doesn't have this as a valid target
+ private static boolean hasChiselResults(ItemStack from) {
+ List<ItemStack> results = getItemsForChiseling(from);
+ return results.size() > 0;
+ }
+
+ private static List<ItemStack> getItemsForChiseling(ItemStack aStack){
+ return Carving.chisel.getItemsForChiseling(aStack);
+ }
+
+ private static ItemStack getChiselOutput(ItemStack aInput, ItemStack aTarget) {
+ ItemStack tOutput = null;
+ if (aTarget != null && canBeMadeFrom(aInput, aTarget)) {
+ tOutput = aTarget;
+ }
+ else if (aTarget != null && !canBeMadeFrom(aInput, aTarget)) {
+ tOutput = null;
+ }
+ else {
+ tOutput = getItemsForChiseling(aInput).get(0);
+ }
+ return tOutput;
+ }
+
+ private GTPP_Recipe generateChiselRecipe(ItemStack aInput, ItemStack aTarget) {
+ boolean tIsCached = hasValidCache(aInput, aTarget, true);
+ if (tIsCached || aInput != null && hasChiselResults(aInput)) {
+ ItemStack tOutput = tIsCached ? mOutputCache.copy() : getChiselOutput(aInput, aTarget);
+ if (tOutput != null) {
+ if (mCachedRecipe != null && GT_Utility.areStacksEqual(aInput, mInputCache) && GT_Utility.areStacksEqual(tOutput, mOutputCache)) {
+ return mCachedRecipe;
+ }
+ // We can chisel this
+ GTPP_Recipe aRecipe = new GTPP_Recipe(
+ false,
+ new ItemStack[] {ItemUtils.getSimpleStack(aInput, 1)},
+ new ItemStack[] {ItemUtils.getSimpleStack(tOutput, 1)},
+ null,
+ new int[] {10000},
+ new FluidStack[] {},
+ new FluidStack[] {},
+ 20,
+ 16,
+ 0);
+
+ // Cache it
+ cacheItem(aInput, tOutput, aRecipe);
+ return aRecipe;
+ }
+ }
+ return null;
+ }
+
+ public boolean checkRecipe(final ItemStack aStack) {
+ ArrayList<ItemStack> aItems = this.getStoredInputs();
+ if (!aItems.isEmpty()) {
+
+ GT_Recipe tRecipe = generateChiselRecipe(aItems.get(0), this.getGUIItemStack());
+
+ if (tRecipe == null) {
+ log("BAD RETURN - 0");
+ return false;
+ }
+
+ // Based on the Processing Array. A bit overkill, but very flexible.
+ ItemStack[] aItemInputs = aItems.toArray(new ItemStack[aItems.size()]);
+ FluidStack[] aFluidInputs = new FluidStack[] {};
+
+ // Reset outputs and progress stats
+ this.mEUt = 0;
+ this.mMaxProgresstime = 0;
+ this.mOutputItems = new ItemStack[]{};
+ this.mOutputFluids = new FluidStack[]{};
+
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ long tEnergy = getMaxInputEnergy();
+ log("Running checkRecipeGeneric(0)");
+
+ log("Running checkRecipeGeneric(1)");
+ // Remember last recipe - an optimization for findRecipe()
+ this.mLastRecipe = tRecipe;
+
+ int aMaxParallelRecipes = getMaxParallelRecipes();
+ int aEUPercent = getEuDiscountForParallelism();
+ int aSpeedBonusPercent = 200;
+
+ aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes);
+ if (aMaxParallelRecipes == 0) {
+ log("BAD RETURN - 2");
+ return false;
+ }
+
+ // EU discount
+ float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f;
+ float tTotalEUt = 0.0f;
+
+ int parallelRecipes = 0;
+
+ log("parallelRecipes: "+parallelRecipes);
+ log("aMaxParallelRecipes: "+aMaxParallelRecipes);
+ log("tTotalEUt: "+tTotalEUt);
+ log("tVoltage: "+tVoltage);
+ log("tRecipeEUt: "+tRecipeEUt);
+ // Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits
+ for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) {
+ if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) {
+ log("Broke at "+parallelRecipes+".");
+ break;
+ }
+ log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+".");
+ tTotalEUt += tRecipeEUt;
+ }
+
+ if (parallelRecipes == 0) {
+ log("BAD RETURN - 3");
+ return false;
+ }
+
+ // -- Try not to fail after this point - inputs have already been consumed! --
+ log("parallelRecipes: "+parallelRecipes);
+ log("aMaxParallelRecipes: "+aMaxParallelRecipes);
+ log("tTotalEUt: "+tTotalEUt);
+ log("tVoltage: "+tVoltage);
+ log("tRecipeEUt: "+tRecipeEUt);
+
+
+ // Convert speed bonus to duration multiplier
+ // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration.
+ aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent);
+ float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent);
+ this.mMaxProgresstime = (int)(tRecipe.mDuration * tTimeFactor);
+
+ this.mEUt = (int)Math.ceil(tTotalEUt);
+
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+
+ // Overclock
+ if (this.mEUt <= 16) {
+ this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
+ this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1));
+ } else {
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= 2;
+ }
+ }
+
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+
+ // Collect fluid outputs
+ FluidStack[] tOutputFluids = new FluidStack[tRecipe.mFluidOutputs.length];
+ for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) {
+ if (tRecipe.getFluidOutput(h) != null) {
+ tOutputFluids[h] = tRecipe.getFluidOutput(h).copy();
+ tOutputFluids[h].amount *= parallelRecipes;
+ }
+ }
+
+ // Collect output item types
+ ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length];
+ for (int h = 0; h < tRecipe.mOutputs.length; h++) {
+ if (tRecipe.getOutput(h) != null) {
+ tOutputItems[h] = tRecipe.getOutput(h).copy();
+ tOutputItems[h].stackSize = 0;
+ }
+ }
+
+ // Set output item stack sizes (taking output chance into account)
+ for (int f = 0; f < tOutputItems.length; f++) {
+ if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) {
+ for (int g = 0; g < parallelRecipes; g++) {
+ if (getBaseMetaTileEntity().getRandomNumber(10000) <= tRecipe.getOutputChance(f))
+ tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize;
+ }
+ }
+ }
+
+ tOutputItems = removeNulls(tOutputItems);
+
+ // Sanitize item stack size, splitting any stacks greater than max stack size
+ List<ItemStack> splitStacks = new ArrayList<ItemStack>();
+ for (ItemStack tItem : tOutputItems) {
+ while (tItem.getMaxStackSize() < tItem.stackSize) {
+ ItemStack tmp = tItem.copy();
+ tmp.stackSize = tmp.getMaxStackSize();
+ tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize();
+ splitStacks.add(tmp);
+ }
+ }
+
+ if (splitStacks.size() > 0) {
+ ItemStack[] tmp = new ItemStack[splitStacks.size()];
+ tmp = splitStacks.toArray(tmp);
+ tOutputItems = ArrayUtils.addAll(tOutputItems, tmp);
+ }
+
+ // Strip empty stacks
+ List<ItemStack> tSList = new ArrayList<ItemStack>();
+ for (ItemStack tS : tOutputItems) {
+ if (tS.stackSize > 0) tSList.add(tS);
+ }
+ tOutputItems = tSList.toArray(new ItemStack[tSList.size()]);
+
+ // Commit outputs
+ this.mOutputItems = tOutputItems;
+ this.mOutputFluids = tOutputFluids;
+ updateSlots();
+
+ // Play sounds (GT++ addition - GT multiblocks play no sounds)
+ startProcess();
+
+ log("GOOD RETURN - 1");
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return (16 * GT_Utility.getTier(this.getMaxInputVoltage()));
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 75;
+ }
+
+ private static String sChiselSound = null;
+
+ private static final String getChiselSound() {
+ if (sChiselSound == null) {
+ sChiselSound = Carving.chisel.getVariationSound(Blocks.stone, 0);
+ }
+ return sChiselSound;
+ }
+
+ @Override
+ public String getSound() {
+ return getChiselSound();
+ }
+
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 10000;
+ }
+
+ public int getPollutionPerSecond(ItemStack aStack) {
+ return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialChisel;
+ }
+
+ public int getDamageToComponent(ItemStack aStack) {
+ return 0;
+ }
+
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java
index cf73dc1e75..e86f98ef66 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IsaMill.java
@@ -579,7 +579,7 @@ public class GregtechMetaTileEntity_IsaMill extends GregtechMeta_MultiBlockBase<
} else {
while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
this.mEUt *= 4;
- this.mMaxProgresst