From 8ef12119e06d291b779fd124a2fa8a74a111fa56 Mon Sep 17 00:00:00 2001 From: Blood-Asp Date: Sat, 22 Oct 2016 17:28:03 +0200 Subject: [PATCH] Added new mode to only check large turbine rotors with need maintainance cover --- .../covers/GT_Cover_NeedMaintainance.java | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/main/java/gregtech/common/covers/GT_Cover_NeedMaintainance.java b/src/main/java/gregtech/common/covers/GT_Cover_NeedMaintainance.java index 83c37e35..f8709dec 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_NeedMaintainance.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_NeedMaintainance.java @@ -3,10 +3,13 @@ package gregtech.common.covers; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.items.GT_MetaGenerated_Tool; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.util.GT_CoverBehavior; import gregtech.api.util.GT_Utility; +import gregtech.common.items.GT_MetaGenerated_Tool_01; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; public class GT_Cover_NeedMaintainance extends GT_CoverBehavior { @@ -32,6 +35,19 @@ public class GT_Cover_NeedMaintainance extends GT_CoverBehavior { if ((aCoverVariable == 6 || aCoverVariable == 7) && (ideal - real > 3)) { needsRepair = true; } + if ((aCoverVariable == 8 || aCoverVariable == 9) && (ideal - real > 4)) { + needsRepair = true; + } + if(aCoverVariable == 10 || aCoverVariable == 11){ + if(multi.getRealInventory()[1]==null || multi.getRealInventory()[1].getItem()!=GT_MetaGenerated_Tool_01.INSTANCE && multi.getRealInventory()[1].getItemDamage()<170){needsRepair = true;} + else{ + ItemStack tTurbine = multi.getRealInventory()[1]; + long tMax = GT_MetaGenerated_Tool.getToolMaxDamage(tTurbine); + long tCur = GT_MetaGenerated_Tool.getToolDamage(tTurbine); + if(tCur < tMax*20/100); + } + + } } } if (aCoverVariable % 2 == 0) { @@ -44,8 +60,8 @@ public class GT_Cover_NeedMaintainance extends GT_CoverBehavior { } public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { - aCoverVariable = (aCoverVariable + (aPlayer.isSneaking()? -1 : 1)) % 10; - if(aCoverVariable <0){aCoverVariable = 9;} + aCoverVariable = (aCoverVariable + (aPlayer.isSneaking()? -1 : 1)) % 12; + if(aCoverVariable <0){aCoverVariable = 11;} switch(aCoverVariable) { case 0: GT_Utility.sendChatToPlayer(aPlayer, "Emit if 1 Maintenance Needed"); break; case 1: GT_Utility.sendChatToPlayer(aPlayer, "Emit if 1 Maintenance Needed(inverted)"); break; @@ -57,6 +73,8 @@ public class GT_Cover_NeedMaintainance extends GT_CoverBehavior { case 7: GT_Utility.sendChatToPlayer(aPlayer, "Emit if 4 Maintenance Needed(inverted)"); break; case 8: GT_Utility.sendChatToPlayer(aPlayer, "Emit if 5 Maintenance Needed"); break; case 9: GT_Utility.sendChatToPlayer(aPlayer, "Emit if 5 Maintenance Needed(inverted)"); break; + case 10: GT_Utility.sendChatToPlayer(aPlayer, "Emit if rotor needs maintainance"); break; + case 11: GT_Utility.sendChatToPlayer(aPlayer, "Emit if rotor needs maintainance(inverted)"); break; } return aCoverVariable; }