mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-07-04 02:52:56 +00:00
Don't use the TileTurtle as our property source
We probably need to do this for some other inventories too - to investigate. Fixes #198
This commit is contained in:
parent
19b7ed538a
commit
2a716244e9
@ -7,8 +7,8 @@
|
|||||||
package dan200.computercraft.client.proxy;
|
package dan200.computercraft.client.proxy;
|
||||||
|
|
||||||
import dan200.computercraft.ComputerCraft;
|
import dan200.computercraft.ComputerCraft;
|
||||||
import dan200.computercraft.client.FrameInfo;
|
|
||||||
import dan200.computercraft.client.ClientRegistry;
|
import dan200.computercraft.client.ClientRegistry;
|
||||||
|
import dan200.computercraft.client.FrameInfo;
|
||||||
import dan200.computercraft.client.gui.*;
|
import dan200.computercraft.client.gui.*;
|
||||||
import dan200.computercraft.client.render.TileEntityCableRenderer;
|
import dan200.computercraft.client.render.TileEntityCableRenderer;
|
||||||
import dan200.computercraft.client.render.TileEntityMonitorRenderer;
|
import dan200.computercraft.client.render.TileEntityMonitorRenderer;
|
||||||
@ -26,6 +26,8 @@ import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry;
|
|||||||
import net.fabricmc.fabric.api.client.render.BlockEntityRendererRegistry;
|
import net.fabricmc.fabric.api.client.render.BlockEntityRendererRegistry;
|
||||||
import net.fabricmc.fabric.api.event.client.ClientSpriteRegistryCallback;
|
import net.fabricmc.fabric.api.event.client.ClientSpriteRegistryCallback;
|
||||||
import net.fabricmc.fabric.api.event.client.ClientTickCallback;
|
import net.fabricmc.fabric.api.event.client.ClientTickCallback;
|
||||||
|
import net.minecraft.container.ArrayPropertyDelegate;
|
||||||
|
import net.minecraft.inventory.BasicInventory;
|
||||||
|
|
||||||
public final class ComputerCraftProxyClient
|
public final class ComputerCraftProxyClient
|
||||||
{
|
{
|
||||||
@ -56,7 +58,10 @@ public final class ComputerCraftProxyClient
|
|||||||
ContainerType.registerGui( TileEntityContainerType::printer, GuiPrinter::new );
|
ContainerType.registerGui( TileEntityContainerType::printer, GuiPrinter::new );
|
||||||
ContainerType.registerGui( TileEntityContainerType::turtle, ( id, packet, player ) -> {
|
ContainerType.registerGui( TileEntityContainerType::turtle, ( id, packet, player ) -> {
|
||||||
TileTurtle turtle = (TileTurtle) packet.getTileEntity( player );
|
TileTurtle turtle = (TileTurtle) packet.getTileEntity( player );
|
||||||
return new GuiTurtle( turtle, new ContainerTurtle( id, player.inventory, turtle.getAccess(), turtle.getClientComputer() ), player.inventory );
|
return new GuiTurtle( turtle,
|
||||||
|
new ContainerTurtle( id, player.inventory, new BasicInventory( TileTurtle.INVENTORY_SIZE ), new ArrayPropertyDelegate( 1 ) ),
|
||||||
|
player.inventory
|
||||||
|
);
|
||||||
} );
|
} );
|
||||||
|
|
||||||
ContainerType.registerGui( PocketComputerContainerType::new, GuiPocketComputer::new );
|
ContainerType.registerGui( PocketComputerContainerType::new, GuiPocketComputer::new );
|
||||||
|
@ -35,7 +35,7 @@ public class ContainerTurtle extends Container implements IContainerComputer
|
|||||||
private final InputState input = new InputState( this );
|
private final InputState input = new InputState( this );
|
||||||
private int m_selectedSlot;
|
private int m_selectedSlot;
|
||||||
|
|
||||||
protected ContainerTurtle( int id, PlayerInventory playerInventory, Inventory inventory, PropertyDelegate properties, int playerInvStartY, int turtleInvStartX )
|
private ContainerTurtle( int id, PlayerInventory playerInventory, Inventory inventory, PropertyDelegate properties, int playerInvStartY, int turtleInvStartX )
|
||||||
{
|
{
|
||||||
super( null, id );
|
super( null, id );
|
||||||
|
|
||||||
@ -71,6 +71,11 @@ public class ContainerTurtle extends Container implements IContainerComputer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ContainerTurtle( int id, PlayerInventory playerInventory, Inventory inventory, PropertyDelegate properties )
|
||||||
|
{
|
||||||
|
this( id, playerInventory, inventory, properties, 134, 175 );
|
||||||
|
}
|
||||||
|
|
||||||
public ContainerTurtle( int id, PlayerInventory playerInventory, ITurtleAccess turtle, IComputer computer )
|
public ContainerTurtle( int id, PlayerInventory playerInventory, ITurtleAccess turtle, IComputer computer )
|
||||||
{
|
{
|
||||||
this( id, playerInventory, turtle.getInventory(), new DefaultPropertyDelegate()
|
this( id, playerInventory, turtle.getInventory(), new DefaultPropertyDelegate()
|
||||||
@ -78,8 +83,7 @@ public class ContainerTurtle extends Container implements IContainerComputer
|
|||||||
@Override
|
@Override
|
||||||
public int get( int id )
|
public int get( int id )
|
||||||
{
|
{
|
||||||
if( id == PROPERTY_SLOT ) return turtle.getSelectedSlot();
|
return id == PROPERTY_SLOT ? turtle.getSelectedSlot() : 0;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -87,7 +91,7 @@ public class ContainerTurtle extends Container implements IContainerComputer
|
|||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}, 134, 175 );
|
} );
|
||||||
this.computer = computer;
|
this.computer = computer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user