Implements opening containers from items with and without a block context.

This commit is contained in:
Sebastian Hartte
2020-06-14 21:23:42 +02:00
parent bdd522e8d9
commit d43e8d19dd
30 changed files with 342 additions and 204 deletions
@@ -28,6 +28,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import javax.annotation.Nullable;
/**
* Implemented on Item objects, to return objects used to manage, and interact
@@ -35,6 +37,14 @@ import net.minecraft.world.World;
*/
public interface IGuiItem
{
IGuiItemObject getGuiObject( ItemStack is, World world, BlockPos pos );
/**
*
* @param is The item used to open the container.
* @param playerInventorySlot The slot in the player's inventory the item is in.
* @param world The world the player is in.
* @param pos If the item was used on a block in the world, has that block's position. Null if no block was targetted.
* @return Null if no GUI object is available.
*/
@Nullable
IGuiItemObject getGuiObject( ItemStack is, int playerInventorySlot, World world, @Nullable BlockPos pos );
}