mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2026-03-17 13:29:44 +00:00
Require the player to be interacting with the computer when typing
Packets will be discarded if the sending player is not currently interacting with the appropriate computer. This ensures players cannot control other people's computers. This is enforced by checking if the current container is a "computer container", and this container holds the correct computer.
This commit is contained in:
@@ -42,6 +42,7 @@ import dan200.computercraft.shared.peripheral.modem.TileWirelessModem;
|
||||
import dan200.computercraft.shared.peripheral.monitor.TileMonitor;
|
||||
import dan200.computercraft.shared.peripheral.printer.ContainerPrinter;
|
||||
import dan200.computercraft.shared.peripheral.printer.TilePrinter;
|
||||
import dan200.computercraft.shared.pocket.inventory.ContainerPocketComputer;
|
||||
import dan200.computercraft.shared.pocket.items.ItemPocketComputer;
|
||||
import dan200.computercraft.shared.pocket.items.PocketComputerItemFactory;
|
||||
import dan200.computercraft.shared.pocket.recipes.PocketComputerUpgradeRecipe;
|
||||
@@ -540,7 +541,7 @@ public abstract class ComputerCraftProxyCommon implements IComputerCraftProxy
|
||||
if (tile != null && tile instanceof TileTurtle)
|
||||
{
|
||||
TileTurtle turtle = (TileTurtle) tile;
|
||||
return new ContainerTurtle( player.inventory, turtle.getAccess() );
|
||||
return new ContainerTurtle( player.inventory, turtle.getAccess(), turtle.getServerComputer() );
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -550,7 +551,7 @@ public abstract class ComputerCraftProxyCommon implements IComputerCraftProxy
|
||||
}
|
||||
case ComputerCraft.pocketComputerGUIID:
|
||||
{
|
||||
return new ContainerHeldItem( player, x == 0 ? EnumHand.MAIN_HAND : EnumHand.OFF_HAND );
|
||||
return new ContainerPocketComputer( player, x == 0 ? EnumHand.MAIN_HAND : EnumHand.OFF_HAND );
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user