Skip to content

Commit

Permalink
allow cover access with sneak rclick
Browse files Browse the repository at this point in the history
  • Loading branch information
TechLord22 committed Aug 21, 2021
1 parent f590afb commit 7804265
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/main/java/gregtech/api/metatileentity/MetaTileEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
import gregtech.api.GregTechAPI;
import gregtech.api.capability.GregtechTileCapabilities;
import gregtech.api.capability.IEnergyContainer;
import gregtech.api.capability.impl.*;
import gregtech.api.capability.impl.FluidHandlerProxy;
import gregtech.api.capability.impl.FluidTankList;
import gregtech.api.capability.impl.ItemHandlerProxy;
import gregtech.api.capability.impl.NotifiableFluidTank;
import gregtech.api.cover.CoverBehavior;
import gregtech.api.cover.CoverDefinition;
import gregtech.api.cover.ICoverable;
Expand Down Expand Up @@ -52,7 +55,8 @@
import org.apache.commons.lang3.tuple.Pair;

import javax.annotation.Nullable;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;

import static gregtech.api.util.InventoryUtils.simulateItemStackMerge;
Expand Down Expand Up @@ -370,6 +374,15 @@ public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing fac
MetaTileEntityUIFactory.INSTANCE.openUI(getHolder(), (EntityPlayerMP) playerIn);
}
return true;
} else if (playerIn.isSneaking()) {
EnumFacing hitFacing = hitResult.sideHit;

CoverBehavior coverBehavior = hitFacing == null ? null : getCoverAtSide(hitFacing);

EnumActionResult coverResult = coverBehavior == null ? EnumActionResult.PASS :
coverBehavior.onScrewdriverClick(playerIn, hand, hitResult);

return coverResult == EnumActionResult.SUCCESS;
}
return false;
}
Expand Down

0 comments on commit 7804265

Please sign in to comment.