diff options
Diffstat (limited to 'src/Java/gtPlusPlus')
13 files changed, 517 insertions, 38 deletions
diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java index 3a9587173f..1f10ccc772 100644 --- a/src/Java/gtPlusPlus/GTplusplus.java +++ b/src/Java/gtPlusPlus/GTplusplus.java @@ -99,6 +99,7 @@ implements ActionListener CORE.configSwitches.enableMultiblock_PowerSubstation = config.getBoolean("enableMultiblockPowerSubstation", "gregtech", true, "For managing large power grids."); CORE.configSwitches.enableMultiblock_LiquidFluorideThoriumReactor = config.getBoolean("enableMultiblockLiquidFluorideThoriumReactor", "gregtech", true, "For supplying large power grids."); CORE.configSwitches.enableMultiblock_NuclearFuelRefinery = config.getBoolean("enableMultiblock_NuclearFuelRefinery", "gregtech", true, "Refines molten chemicals into nuclear fuels."); + CORE.configSwitches.enableMultiblock_IndustrialSifter = config.getBoolean("enableMultiblock_IndustrialSifter", "gregtech", true, "Large scale sifting."); //Options diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java index bcf8d73f86..5360331040 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java @@ -67,6 +67,7 @@ public class COMPAT_HANDLER { GregtechIndustrialFuelRefinery.run(); GregtechTreeFarmerTE.run(); GregtechIndustrialTreeFarm.run(); + GregtechIndustrialSifter.run(); } } diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java index da152bb8d8..871c286bc7 100644 --- a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java +++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java @@ -31,20 +31,27 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ return 0; } + protected boolean canBreak = true; protected final int colour; protected final String materialName; protected final String displayName; public boolean isValid = true; private final Pair<?, ?> enchantment; - public MultiPickaxeBase(final String unlocalizedName, final ToolMaterial material, final int materialDurability, final int colour, final Object enchant) { + public MultiPickaxeBase(final String unlocalizedName, final ToolMaterial material, final long materialDurability, final int colour, final Object enchant) { super(Utils.sanitizeString(unlocalizedName), material); this.setUnlocalizedName(Utils.sanitizeString(unlocalizedName)); //this.setTextureName(CORE.MODID + ":" + "itemPickaxe"); this.setTextureName("minecraft"+":"+"iron_pickaxe"); this.FACING_HORIZONTAL=true; this.setMaxStackSize(1); - this.setMaxDamage(materialDurability*3); + if ((materialDurability*3) <= Integer.MAX_VALUE){ + this.setMaxDamage((int) (materialDurability*3)); + } + else { + this.setMaxDamage(Integer.MAX_VALUE); + this.canBreak = false; + } this.colour = colour; this.materialName = material.name(); this.displayName = unlocalizedName; @@ -132,25 +139,6 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ @Override public String getItemStackDisplayName(final ItemStack iStack) { return this.displayName; - /*String name; - if (getUnlocalizedName().toLowerCase().contains("wood")){ - name = "Wooden"; - } - else if (getUnlocalizedName().toLowerCase().contains("cobblestone")){ - name = "Cobblestone"; - } - else if (getUnlocalizedName().toLowerCase().contains("iron")){ - name = "Iron"; - } - else if (getUnlocalizedName().toLowerCase().contains("gold")){ - name = "Gold"; - } - else if (getUnlocalizedName().toLowerCase().contains("diamond")){ - name = "Diamond"; - } - else { - } - return name+" Multipickaxe";*/ } @Override @@ -230,12 +218,16 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ @Override public void damageItem(final ItemStack item, final int damage, final EntityPlayer localPlayer){ - item.damageItem(damage, localPlayer); + if (this.canBreak){ + item.damageItem(damage, localPlayer); + } } @Override public void setItemDamage(final ItemStack item, final int damage){ - item.setItemDamage(damage-1); + if (this.canBreak){ + item.setItemDamage(damage-1); + } } @@ -295,5 +287,21 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ } } + + + /** + * + * Time to Override Minecraft stupid mechanics, allowing unbreakable stuff. + * + */ + public boolean isDamageable(){ + if (this.getMaxDamage() > 0 && !this.hasSubtypes){ + if (this.canBreak){ + return true; + } + } + return false; + } + } diff --git a/src/Java/gtPlusPlus/core/lib/CORE.java b/src/Java/gtPlusPlus/core/lib/CORE.java index e4370accc4..6ec24862c0 100644 --- a/src/Java/gtPlusPlus/core/lib/CORE.java +++ b/src/Java/gtPlusPlus/core/lib/CORE.java @@ -137,6 +137,7 @@ public class CORE { public static boolean enableMultiblock_LiquidFluorideThoriumReactor = true; public static boolean enableMultiblock_NuclearFuelRefinery = true; public static boolean enableMultiblock_TreeFarmer = true; + public static boolean enableMultiblock_IndustrialSifter = true; //Visuals public static boolean enableTreeFarmerParticles = true; diff --git a/src/Java/gtPlusPlus/core/util/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java index f969d3e075..45dc2ce701 100644 --- a/src/Java/gtPlusPlus/core/util/Utils.java +++ b/src/Java/gtPlusPlus/core/util/Utils.java @@ -340,8 +340,8 @@ public class Utils { return targetList; } - public static List<Object> convertArrayListToList(@SuppressWarnings("rawtypes") final ArrayList sourceArray) { - final List<Object> targetList = new ArrayList<>(Arrays.asList(sourceArray)); + public static List<Object> convertArrayListToList(final ArrayList<Object> sourceArray) { + final List<Object> targetList = new ArrayList<Object>(Arrays.asList(sourceArray)); return targetList; } diff --git a/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java b/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java index da68bfaaae..1150fe6602 100644 --- a/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java +++ b/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java @@ -35,8 +35,8 @@ public class MaterialUtils { public static List<?> oreDictValuesForEntry(final String oredictName){ List<?> oredictItemNames; if(OreDictionary.doesOreNameExist(oredictName)){ - final ArrayList<ItemStack> oredictItems = OreDictionary.getOres(oredictName); - oredictItemNames = Utils.convertArrayListToList(oredictItems); + final List<ItemStack> oredictItems = OreDictionary.getOres(oredictName); + oredictItemNames = oredictItems; return oredictItemNames; } return null; 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..dc51184e71 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks2.java @@ -26,10 +26,10 @@ 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() + ".6.name", "Incoloy Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", "Placeholder Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "Incoloy Casing"); //65 + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Industrial Sieve Casing"); //78 + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "Large Sieve Grate"); //79 + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", "Placeholder Casing"); //80 + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "Incoloy Casing"); //81 GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", "Placeholder Casing"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", "Placeholder Casing"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", "Placeholder Casing"); @@ -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/blocks/GregtechMetaCasingBlocksAbstract.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocksAbstract.java index f13dde9325..24e3e6b583 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocksAbstract.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocksAbstract.java @@ -90,7 +90,12 @@ extends GT_Block_Casings_Abstract { @Override public boolean isOpaqueCube() { - return true; + return false; + } + + @Override + public int getRenderBlockPass() { + return 1; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java index 839786790a..1eda274bd7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler2.java @@ -22,12 +22,14 @@ public class CasingTextureHandler2 { //Material Press Casings case 4: return TexturesGtBlock.Casing_Machine_Farm_Manager.getIcon(); - //Electrolyzer Casings + + //Sifter Structural case 5: - return TexturesGtBlock._PlaceHolder.getIcon(); - //Broken Blue Fusion Casings + return TexturesGtBlock.Casing_Machine_Metal_Panel_A.getIcon(); + //Sifter Sieve case 6: - return TexturesGtBlock._PlaceHolder.getIcon(); + return TexturesGtBlock.Casing_Machine_Metal_Grate_A_Solid.getIcon(); + //Maceration Stack Casings case 7: return TexturesGtBlock._PlaceHolder.getIcon(); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java index 880813b392..1cda562af9 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java @@ -132,6 +132,20 @@ public class TexturesGtBlock { private static final CustomIcon Internal_Casing_Machine_Podzol = new CustomIcon("TileEntities/dirt_podzol_top"); public static final CustomIcon Casing_Machine_Podzol = Internal_Casing_Machine_Podzol; + //Structural Blocks + private static final CustomIcon Internal_Casing_Machine_Metal_Grate_A = new CustomIcon("chrono/MetalGrate"); + public static final CustomIcon Casing_Machine_Metal_Grate_A = Internal_Casing_Machine_Metal_Grate_A; + private static final CustomIcon Internal_Casing_Machine_Metal_Grate_A_Solid = new CustomIcon("chrono/MetalGrateA_Solid"); + public static final CustomIcon Casing_Machine_Metal_Grate_A_Solid = Internal_Casing_Machine_Metal_Grate_A_Solid; + private static final CustomIcon Internal_Casing_Machine_Metal_Grate_B = new CustomIcon("chrono/MetalGrate2"); + public static final CustomIcon Casing_Machine_Metal_Grate_B = Internal_Casing_Machine_Metal_Grate_B; + private static final CustomIcon Internal_Casing_Machine_Metal_Panel_A = new CustomIcon("chrono/MetalPanel"); + public static final CustomIcon Casing_Machine_Metal_Panel_A = Internal_Casing_Machine_Metal_Panel_A; + private static final CustomIcon Internal_Casing_Machine_Metal_Sheet_A = new CustomIcon("chrono/MetalSheet"); + public static final CustomIcon Casing_Machine_Metal_Sheet_A = Internal_Casing_Machine_Metal_Sheet_A; + private static final CustomIcon Internal_Casing_Machine_Metal_Sheet_B = new CustomIcon("chrono/MetalSheet2"); + public static final CustomIcon Casing_Machine_Metal_Sheet_B = Internal_Casing_Machine_Metal_Sheet_B; + //Overlays //Fan Textures private static final CustomIcon Internal_Overlay_Machine_Vent = new CustomIcon("TileEntities/machine_top_vent_rotating"); @@ -165,6 +179,8 @@ public class TexturesGtBlock { public static final CustomIcon Casing_Machine_Screen_Frequency = Internal_Casing_Machine_Screen_Frequency; private static final CustomIcon Internal_Overlay_Machine_Screen_Logo = new CustomIcon("TileEntities/adv_machine_screen_logo"); public static final CustomIcon Overlay_Machine_Screen_Logo = Internal_Overlay_Machine_Screen_Logo; + private static final CustomIcon Internal_Overlay_Machine_Cyber_Interface = new CustomIcon("chrono/Overlay_Cyber"); + public static final CustomIcon Overlay_Machine_Cyber_Interface = Internal_Overlay_Machine_Cyber_Interface; //Crafting Overlays private static final CustomIcon Internal_Overlay_Crafting_Bronze = new CustomIcon("TileEntities/bronze_top_crafting"); public static final CustomIcon Overlay_Crafting_Bronze = Internal_Overlay_Crafting_Bronze; 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..8b3fe7b0ef --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialSifter.java @@ -0,0 +1,412 @@ +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.init.Blocks; +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)", + "9x Sieve Grate (Top 3x3)", + "Sifter Casings for the rest (50)", + 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) { + + Utils.LOG_INFO("1"); + + //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; + } + } + } + } + + Utils.LOG_INFO("2"); + + //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; + } + + Utils.LOG_INFO("3"); + + //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); + + Utils.LOG_INFO("3.1"); + + //Change bonus chances + int[] outputChances; + + Utils.LOG_INFO("3.2"); + + if (tRecipe.mChances != null){ + outputChances = tRecipe.mChances; + + Utils.LOG_INFO("3.3"); + + for (int r=0;r<outputChances.length;r++){ + Utils.LOG_INFO("Output["+r+"] chance = "+outputChances[r]); + if (outputChances[r]<100){ + int temp = outputChances[r]; + if (outputChances[r] < 80 && outputChances[r] >= 1){ + outputChances[r] = temp+12; + } + else if (outputChances[r] < 90 && outputChances[r] >= 80){ + outputChances[r] = temp+4; + } + else if (outputChances[r] <= 99 && outputChances[r] >= 90){ + outputChances[r] = temp+1; + } + } + } + + Utils.LOG_INFO("3.4"); + + //Rebuff Drop Rates for % output + tRecipe.mChances = outputChances; + + } + + + Utils.LOG_INFO("4"); + + + final int tValidOutputSlots = this.getValidOutputSlots(this.getBaseMetaTileEntity(), tRecipe, tInputs); + Utils.LOG_INFO("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++) { + + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + + // Reactor Floor/Roof inner 5x5 + if (((i != -2) && (i != 2)) && ((j != -2) && (j != 2))) { + + // Reactor Floor & Roof (Inner 5x5) + Mufflers, Dynamos and Fluid outputs. + if ((h == 0) || (h == 2 || h == 1)) { + + if (h == 2 || h == 1){ + //If not a hatch, continue, else add hatch and continue. + if ((!this.addMufflerToMachineList(tTileEntity, 78)) && (!this.addOutputToMachineList(tTileEntity, 78)) && (!this.addDynamoToMachineList(tTileEntity, 78))) { + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasings2Misc) { + Utils.LOG_INFO("LFTR Casing(s) Missing from one of the top layers inner 3x3."); + Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 6) { + Utils.LOG_INFO("LFTR Casing(s) Missing from one of the top layers inner 3x3. Wrong Meta for Casing. Found:"+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()+" with meta:"+aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j)); + return false; + } + } + } + else { + if ((!this.addMufflerToMachineList(tTileEntity, 78)) && (!this.addOutputToMachineList(tTileEntity, 78)) && (!this.addDynamoToMachineList(tTileEntity, 78))) { + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasings2Misc) { + Utils.LOG_INFO("LFTR Casing(s) Missing from one of the bottom layers inner 3x3."); + Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 5) { + Utils.LOG_INFO("LFTR Casing(s) Missing from one of the bottom layers inner 3x3. Wrong Meta for Casing. Found:"+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()+" with meta:"+aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j)); + return false; + } + tAmount++; + } + } + } + + // Inside 2 layers, mostly air + /*else { + // Reactor Inner 5x5 + //if ((i != -1 && i != 1) && (j != -1 && j != 1)) { + if (!aBaseMetaTileEntity.getAirOffset(xDir + i, h, zDir + j)) { + Utils.LOG_INFO("Make sure the inner 3x3 of the Multiblock is Air."); + return false; + } + + }*/ + } + + //Dealt with inner 5x5, now deal with the exterior. + else { + + //Deal with all 4 sides (Reactor walls) + if ((h == 1) || (h == 2)) { + if (h == 2){ + if ((!this.addMufflerToMachineList(tTileEntity, 78)) && (!this.addOutputToMachineList(tTileEntity, 78)) && (!this.addDynamoToMachineList(tTileEntity, 78))) { + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasings2Misc) { + Utils.LOG_INFO("Glass Casings Missing from somewhere in the second layer."); + Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 5) { + Utils.LOG_INFO("Glass Casings Missing from somewhere in the second layer."); + Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); + return false; + } + tAmount++; + } + } + else { + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasings2Misc) { + Utils.LOG_INFO("Glass Casings Missing from somewhere in the second layer."); + Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 5) { + Utils.LOG_INFO("Glass Casings Missing from somewhere in the second layer."); + Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); + return false; + } + tAmount++; + } + } + + //Deal with top and Bottom edges (Inner 5x5) + else if ((h == 0) || (h == 2)) { + if ((!this.addToMachineList(tTileEntity, 78)) && (!this.addInputToMachineList(tTileEntity, 78)) && (!this.addOutputToMachineList(tTileEntity, 78)) && (!this.addDynamoToMachineList(tTileEntity, 78))) { + if (((xDir + i) != 0) || ((zDir + j) != 0)) {//no controller + + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasings2Misc) { + Utils.LOG_INFO("LFTR Casing(s) Missing from one of the edges on the top layer."); + Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 5) { + Utils.LOG_INFO("LFTR Casing(s) Missing from one of the edges on the top layer. "+h); + Utils.LOG_INFO("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); + if (h ==0){ + if (tTileEntity instanceof GregtechMetaTileEntity_IndustrialSifter){ + + } + } + else { + return false; + } + } + } + } + } + } + + } + } + } + if ((this.mOutputHatches.size() != 0) || (this.mInputBusses.size() != 1) || (this.mOutputBusses.size() != 4) + || (this.mMaintenanceHatches.size() != 1) || (this.mEnergyHatches.size() != 1)) { + 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[4]; + for (int i = 0; i < this.mOutputBusses.size(); i++) { + final int hatchNumber = this.mOutputBusses.get(i).getBaseMetaTileEntity().getYCoord() - 1 - height; + if (tmpHatches[i] == null) { + tmpHatches[i] = this.mOutputBusses.get(i); + } else { + Utils.LOG_INFO("Returned False 5 - "+this.mOutputBusses.size()); + return false; + } + } + this.mOutputBusses.clear(); + for (int i = 0; i < tmpHatches.length; i++) { + this.mOutputBusses.add(tmpHatches[i]); + } + + Utils.LOG_INFO("Structure Built? "+(tAmount>35)); + + return tAmount >= 35; + } + + 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 |