aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech
diff options
context:
space:
mode:
authordraknyte1 <draknyte1@hotmail.com>2017-03-28 18:02:17 +1000
committerdraknyte1 <draknyte1@hotmail.com>2017-03-28 18:02:17 +1000
commit2b22fa0748c0bdac2b90d0391b125c4cc21514e5 (patch)
tree4e3a05cf3bbc05c9a55832f5c4501bb5ae8945ff /src/Java/gtPlusPlus/xmod/gregtech
parent03eeaa665109cb6bcdcf115d8c167727556fda6b (diff)
downloadGT5-Unofficial-2b22fa0748c0bdac2b90d0391b125c4cc21514e5.tar.gz
GT5-Unofficial-2b22fa0748c0bdac2b90d0391b125c4cc21514e5.tar.bz2
GT5-Unofficial-2b22fa0748c0bdac2b90d0391b125c4cc21514e5.zip
+ Added the Multiblock Sifter.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialSifter.java264
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialSifter.java31
4 files changed, 300 insertions, 3 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java
index ce77cb0f79..424b894341 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java
@@ -135,7 +135,7 @@ public enum GregtechItemList implements GregtechItemContainer {
//Casings Tier 2 [17-32]
Casing_StructuralGlass,
Casing_Refinery_External, Casing_Refinery_Structural, Casing_Refinery_Internal,
- Casing_PlaceHolder4, Casing_PlaceHolder5, Casing_PlaceHolder6,
+ Casing_PlaceHolder4, Casing_Sifter, Casing_PlaceHolder6,
Casing_PlaceHolder7, Casing_PlaceHolder8, Casing_PlaceHolder9,
Casing_PlaceHolder10, Casing_PlaceHolder11, Casing_PlaceHolder12,
Casing_PlaceHolder13, Casing_PlaceHolder14, Casing_PlaceHolder15,
@@ -148,6 +148,8 @@ public enum GregtechItemList implements GregtechItemContainer {
//Tree Farm
Industrial_TreeFarm, TreeFarmer_Structural,
+
+ Industrial_Sifter
;
public static final GregtechItemList[]
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java
index c0134e576f..700bb93df7 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java
@@ -26,7 +26,7 @@ extends GregtechMetaCasingBlocksAbstract {
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "Hastelloy-X Structural Block");
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", "Incoloy-DS Fluid Containment Block"); //76
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", "Placeholder Casing"); //IS A PLACEHOLDER DO NOT CHANGE
- GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Placeholder Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Sifter Casing");
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "Incoloy Casing");
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", "Placeholder Casing");
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "Incoloy Casing"); //65
@@ -42,7 +42,7 @@ extends GregtechMetaCasingBlocksAbstract {
GregtechItemList.Casing_Refinery_Structural.set(new ItemStack(this, 1, 2));
GregtechItemList.Casing_Refinery_Internal.set(new ItemStack(this, 1, 3));
GregtechItemList.Casing_PlaceHolder4.set(new ItemStack(this, 1, 4));
- GregtechItemList.Casing_PlaceHolder5.set(new ItemStack(this, 1, 5));
+ GregtechItemList.Casing_Sifter.set(new ItemStack(this, 1, 5));
GregtechItemList.Casing_PlaceHolder6.set(new ItemStack(this, 1, 6));
GregtechItemList.Casing_PlaceHolder7.set(new ItemStack(this, 1, 7));
GregtechItemList.Casing_PlaceHolder8.set(new ItemStack(this, 1, 8));
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialSifter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialSifter.java
new file mode 100644
index 0000000000..a5e8c34d50
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialSifter.java
@@ -0,0 +1,264 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi;
+
+import java.util.*;
+
+import gregtech.api.GregTech_API;
+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_OutputBus;
+import gregtech.api.objects.GT_RenderedTexture;
+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.Utils;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class GregtechMetaTileEntity_IndustrialSifter
+extends GregtechMeta_MultiBlockBase {
+ private static boolean controller;
+
+ public GregtechMetaTileEntity_IndustrialSifter(final int aID, final String aName, final String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_IndustrialSifter(final String aName) {
+ super(aName);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_IndustrialSifter(this.mName);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{
+ "Controller Block for the Industrial Sifter",
+ "Size[WxHxL]: 5x3x5 (Hollow)",
+ "Controller (Center Bottom)",
+ "1x Input Bus (Any bottom layer casing)",
+ "4x Output Bus (Any casing besides bottom layer)",
+ "1x Maintenance Hatch (Any casing)",
+ "1x Energy Hatch (Any casing)",
+ "Sifter Casings for the rest (X at least!)",
+ CORE.GT_Tooltip};
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[78], new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Diesel_Vertical_Active : TexturesGtBlock.Overlay_Machine_Diesel_Vertical)};
+ }
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[78]};
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MacerationStack.png");
+ }
+
+ @Override
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return GT_Recipe.GT_Recipe_Map.sSifterRecipes;
+ }
+
+ /*@Override
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return true;
+ }*/
+
+ @Override
+ public boolean isFacingValid(final byte aFacing) {
+ return aFacing > 1;
+ }
+
+ @Override
+ public void onPreTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive()) && (aBaseMetaTileEntity.getFrontFacing() != 1) && (aBaseMetaTileEntity.getCoverIDAtSide((byte) 1) == 0) && (!aBaseMetaTileEntity.getOpacityAtSide((byte) 1))) {
+ if (MathUtils.randInt(0, 5) == 5){
+ final Random tRandom = aBaseMetaTileEntity.getWorld().rand;
+ aBaseMetaTileEntity.getWorld().spawnParticle("reddust", (aBaseMetaTileEntity.getXCoord() + 0.8F) - (tRandom.nextFloat() * 0.6F), aBaseMetaTileEntity.getYCoord() + 0.3f + (tRandom.nextFloat() * 0.2F), (aBaseMetaTileEntity.getZCoord() + 1.2F) - (tRandom.nextFloat() * 1.6F), 0.0D, 0.0D, 0.0D);
+ }
+ }
+ }
+
+ @Override
+ public void startSoundLoop(final byte aIndex, final double aX, final double aY, final double aZ) {
+ super.startSoundLoop(aIndex, aX, aY, aZ);
+ if (aIndex == 1) {
+ GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(Integer.valueOf(201)), 10, 1.0F, aX, aY, aZ);
+ }
+ }
+
+ @Override
+ public void startProcess() {
+ this.sendLoopStart((byte) 1);
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+
+ //Get inputs.
+ final ArrayList<ItemStack> tInputList = this.getStoredInputs();
+ for (int i = 0; i < (tInputList.size() - 1); i++) {
+ for (int j = i + 1; j < tInputList.size(); j++) {
+ if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) {
+ if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) {
+ tInputList.remove(j--);
+ } else {
+ tInputList.remove(i--);
+ break;
+ }
+ }
+ }
+ }
+
+ //Temp var
+ final ItemStack[] tInputs = Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2);
+
+ //Don't check the recipe if someone got around the output bus size check.
+ if (this.mOutputBusses.size() != 4){
+ return false;
+ }
+
+ //Make a recipe instance for the rest of the method.
+ final GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sSifterRecipes.findRecipe(this.getBaseMetaTileEntity(), false, 9223372036854775807L, null, tInputs);
+
+
+ final int tValidOutputSlots = this.getValidOutputSlots(this.getBaseMetaTileEntity(), tRecipe, tInputs);
+ Utils.LOG_WARNING("Sifter - Valid Output Hatches: "+tValidOutputSlots);
+
+ //More than or one input
+ if ((tInputList.size() > 0) && (tValidOutputSlots >= 1)) {
+ if ((tRecipe != null) && (tRecipe.isRecipeInputEqual(true, null, tInputs))) {
+ Utils.LOG_WARNING("Valid Recipe found - size "+tRecipe.mOutputs.length);
+ this.mEfficiency = (10000 - ((this.getIdealStatus() - this.getRepairStatus()) * 1000));
+ this.mEfficiencyIncrease = 10000;
+
+
+ this.mEUt = (-tRecipe.mEUt);
+ this.mMaxProgresstime = Math.max(1, (tRecipe.mDuration/5));
+ final ItemStack[] outputs = new ItemStack[tRecipe.mOutputs.length];
+ for (int i = 0; i < tRecipe.mOutputs.length; i++){
+ if (i==0) {
+ Utils.LOG_WARNING("Adding the default output");
+ outputs[0] = tRecipe.getOutput(i);
+ }
+ else if (this.getBaseMetaTileEntity().getRandomNumber(7500) < tRecipe.getOutputChance(i)){
+ Utils.LOG_WARNING("Adding a bonus output");
+ outputs[i] = tRecipe.getOutput(i);
+ }
+ else {
+ Utils.LOG_WARNING("Adding null output");
+ outputs[i] = null;
+ }
+ }
+
+ this.mOutputItems = outputs;
+ this.sendLoopStart((byte) 20);
+ this.updateSlots();
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) {
+ final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 2;
+ final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 2;
+ if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) {
+ return false;
+ }
+ int tAmount = 0;
+ controller = false;
+ for (int i = -2; i < 3; i++) {
+ for (int j = -2; j < 3; j++) {
+ for (int h = 0; h < 3; h++) {
+ if (!((i == 0) && (j == 0) && ((h > 0) && (h < 3))))//((h > 0)&&(h<5)) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))
+ {
+ final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j);
+ if ((!this.addMaintenanceToMachineList(tTileEntity, 78)) && (!this.addInputToMachineList(tTileEntity, 78)) && (!this.addOutputToMachineList(tTileEntity, 78)) && (!this.addEnergyInputToMachineList(tTileEntity, 78)) && (!this.ignoreController(aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j)))) {
+ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) {
+ Utils.LOG_INFO("Returned False 1");
+ return false;
+ }
+ if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 6) {
+ Utils.LOG_INFO("Returned False 2");
+ return false;
+ }
+ tAmount++;
+ }
+ }
+ }
+ }
+ }
+ if ((this.mOutputHatches.size() != 0) || (this.mInputBusses.size() != 1) || (this.mOutputBusses.size() != 4)) {
+ Utils.LOG_INFO("Returned False 3");
+ return false;
+ }
+ final int height = this.getBaseMetaTileEntity().getYCoord();
+ if (this.mInputBusses.get(0).getBaseMetaTileEntity().getYCoord() != height) {
+ Utils.LOG_INFO("height: "+height+" | Returned False 4");
+ return false;
+ }
+ final GT_MetaTileEntity_Hatch_OutputBus[] tmpHatches = new GT_MetaTileEntity_Hatch_OutputBus[5];
+ for (int i = 0; i < this.mOutputBusses.size(); i++) {
+ final int hatchNumber = this.mOutputBusses.get(i).getBaseMetaTileEntity().getYCoord() - 1 - height;
+ if (tmpHatches[hatchNumber] == null) {
+ tmpHatches[hatchNumber] = this.mOutputBusses.get(i);
+ } else {
+ Utils.LOG_INFO("Returned False 5");
+ return false;
+ }
+ }
+ this.mOutputBusses.clear();
+ for (int i = 0; i < tmpHatches.length; i++) {
+ this.mOutputBusses.add(tmpHatches[i]);
+ }
+ return tAmount >= 26;
+ }
+
+ public boolean ignoreController(final Block tTileEntity) {
+ if (!controller && (tTileEntity == GregTech_API.sBlockMachines)) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public int getMaxEfficiency(final ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerTick(final ItemStack aStack) {
+ return 0;
+ }
+
+ @Override
+ public int getAmountOfOutputs() {
+ return 16;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean isOverclockerUpgradable() {
+ return true;
+ }
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialSifter.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialSifter.java
new file mode 100644
index 0000000000..32ca4cd716
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialSifter.java
@@ -0,0 +1,31 @@
+package gtPlusPlus.xmod.gregtech.registration.gregtech;
+
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.GregtechMetaTileEntity_IndustrialMacerator;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.GregtechMetaTileEntity_IndustrialSifter;
+
+public class GregtechIndustrialSifter
+{
+
+
+
+ public static void run()
+ {
+ if (gtPlusPlus.core.lib.LoadedMods.Gregtech){
+ Utils.LOG_INFO("Gregtech5u Content | Registering Industrial Sifter Multiblock.");
+ if (CORE.configSwitches.enableMultiblock_IndustrialSifter) { //TODO
+ run1();
+ }
+ }
+
+ }
+
+ private static void run1()
+ {
+ //Industrial Maceration Stack Multiblock
+ GregtechItemList.Industrial_Sifter.set(new GregtechMetaTileEntity_IndustrialSifter(840, "industrialsifter.controller.tier.single", "Large Sifter Control Block").getStackForm(1L));
+
+ }
+} \ No newline at end of file