fix being unable to open portable grid when aiming at block fixes #3076
This commit is contained in:
		@@ -66,13 +66,24 @@ public class PortableGridBlockItem extends EnergyBlockItem {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public ActionResultType onItemUse(ItemUseContext context) {
 | 
					    public ActionResultType onItemUse(ItemUseContext context) {
 | 
				
			||||||
        if (!context.getPlayer().isCrouching()) {
 | 
					        if (context.getPlayer() == null) {
 | 
				
			||||||
            return ActionResultType.FAIL;
 | 
					            return ActionResultType.FAIL;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //Place
 | 
				
			||||||
 | 
					        if (context.getPlayer().isCrouching()) {
 | 
				
			||||||
            return super.onItemUse(context);
 | 
					            return super.onItemUse(context);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        ItemStack stack = context.getPlayer().getHeldItem(context.getHand());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (!context.getWorld().isRemote) {
 | 
				
			||||||
 | 
					            API.instance().getGridManager().openGrid(PortableGridGridFactory.ID, (ServerPlayerEntity) context.getPlayer(), stack, PlayerSlot.getSlotForHand(context.getPlayer(), context.getHand()));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return ActionResultType.SUCCESS;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public int getEntityLifespan(ItemStack stack, World world) {
 | 
					    public int getEntityLifespan(ItemStack stack, World world) {
 | 
				
			||||||
        return Integer.MAX_VALUE;
 | 
					        return Integer.MAX_VALUE;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user