Sneaking clears grid filter

This commit is contained in:
Raoul Van den Berge
2016-07-30 01:33:42 +02:00
parent 8480ec2433
commit 66107f3f78

View File

@@ -8,6 +8,7 @@ import net.minecraft.util.EnumHand;
import net.minecraft.world.World; import net.minecraft.world.World;
import refinedstorage.RefinedStorage; import refinedstorage.RefinedStorage;
import refinedstorage.RefinedStorageGui; import refinedstorage.RefinedStorageGui;
import refinedstorage.RefinedStorageItems;
public class ItemGridFilter extends ItemBase { public class ItemGridFilter extends ItemBase {
public ItemGridFilter() { public ItemGridFilter() {
@@ -19,6 +20,10 @@ public class ItemGridFilter extends ItemBase {
@Override @Override
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) { public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) {
if (!world.isRemote) { if (!world.isRemote) {
if (player.isSneaking()) {
return new ActionResult(EnumActionResult.SUCCESS, new ItemStack(RefinedStorageItems.GRID_FILTER));
}
player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.GRID_FILTER, world, hand.ordinal(), 0, 0); player.openGui(RefinedStorage.INSTANCE, RefinedStorageGui.GRID_FILTER, world, hand.ordinal(), 0, 0);
return new ActionResult(EnumActionResult.SUCCESS, stack); return new ActionResult(EnumActionResult.SUCCESS, stack);