1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-11-10 10:23:00 +00:00

Merge pull request #158 from SquidDev-CC/feature/require-container

Require the player to be interacting with the computer when typing
This commit is contained in:
Daniel Ratcliffe
2017-05-04 21:08:34 +01:00
committed by GitHub
9 changed files with 121 additions and 3 deletions

View File

@@ -7,6 +7,8 @@
package dan200.computercraft.shared.turtle.inventory;
import dan200.computercraft.api.turtle.ITurtleAccess;
import dan200.computercraft.shared.computer.core.IComputer;
import dan200.computercraft.shared.computer.core.IContainerComputer;
import dan200.computercraft.shared.turtle.blocks.TileTurtle;
import dan200.computercraft.shared.turtle.core.TurtleBrain;
import net.minecraft.entity.player.EntityPlayer;
@@ -16,7 +18,10 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import javax.annotation.Nullable;
public class ContainerTurtle extends Container
implements IContainerComputer
{
private static final int PROGRESS_ID_SELECTED_SLOT = 0;
@@ -24,6 +29,7 @@ public class ContainerTurtle extends Container
public final int m_turtleInvStartX;
protected ITurtleAccess m_turtle;
private IComputer m_computer;
private int m_selectedSlot;
protected ContainerTurtle( IInventory playerInventory, ITurtleAccess turtle, int playerInvStartY, int turtleInvStartX )
@@ -71,6 +77,12 @@ public class ContainerTurtle extends Container
this( playerInventory, turtle, 134, 175 );
}
public ContainerTurtle( IInventory playerInventory, ITurtleAccess turtle, IComputer computer )
{
this( playerInventory, turtle );
m_computer = computer;
}
public int getSelectedSlot()
{
return m_selectedSlot;
@@ -178,4 +190,11 @@ public class ContainerTurtle extends Container
}
return null;
}
@Nullable
@Override
public IComputer getComputer()
{
return m_computer;
}
}