mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-08-30 17:17:55 +00:00
Keep ids of unlabelled computers and turtles
This commit is contained in:
@@ -128,7 +128,7 @@ public abstract class BlockComputerBase extends BlockDirectional
|
|||||||
if( tile instanceof TileComputerBase )
|
if( tile instanceof TileComputerBase )
|
||||||
{
|
{
|
||||||
TileComputerBase computer = (TileComputerBase) tile;
|
TileComputerBase computer = (TileComputerBase) tile;
|
||||||
if( !player.capabilities.isCreativeMode || computer.getLabel() != null )
|
if( !player.capabilities.isCreativeMode || computer.getLabel() != null || computer.getComputerID() != -1 )
|
||||||
{
|
{
|
||||||
spawnAsEntity( world, pos, getItem( computer ) );
|
spawnAsEntity( world, pos, getItem( computer ) );
|
||||||
}
|
}
|
||||||
|
@@ -19,9 +19,7 @@ public final class ComputerItemFactory
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
public static ItemStack create( TileComputer tile )
|
public static ItemStack create( TileComputer tile )
|
||||||
{
|
{
|
||||||
String label = tile.getLabel();
|
return create( tile.getComputerID(), tile.getLabel(), tile.getFamily() );
|
||||||
int id = label != null ? tile.getComputerID() : -1;
|
|
||||||
return create( id, label, tile.getFamily() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
package dan200.computercraft.shared.turtle.items;
|
package dan200.computercraft.shared.turtle.items;
|
||||||
|
|
||||||
import dan200.computercraft.ComputerCraft;
|
import dan200.computercraft.ComputerCraft;
|
||||||
|
import dan200.computercraft.api.turtle.ITurtleAccess;
|
||||||
import dan200.computercraft.api.turtle.ITurtleUpgrade;
|
import dan200.computercraft.api.turtle.ITurtleUpgrade;
|
||||||
import dan200.computercraft.api.turtle.TurtleSide;
|
import dan200.computercraft.api.turtle.TurtleSide;
|
||||||
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||||
@@ -22,18 +23,13 @@ public final class TurtleItemFactory
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
public static ItemStack create( ITurtleTile turtle )
|
public static ItemStack create( ITurtleTile turtle )
|
||||||
{
|
{
|
||||||
ITurtleUpgrade leftUpgrade = turtle.getAccess().getUpgrade( TurtleSide.Left );
|
ITurtleAccess access = turtle.getAccess();
|
||||||
ITurtleUpgrade rightUpgrade = turtle.getAccess().getUpgrade( TurtleSide.Right );
|
|
||||||
|
|
||||||
String label = turtle.getLabel();
|
return create(
|
||||||
if( label == null )
|
turtle.getComputerID(), turtle.getLabel(), turtle.getColour(), turtle.getFamily(),
|
||||||
{
|
access.getUpgrade( TurtleSide.Left ), access.getUpgrade( TurtleSide.Right ),
|
||||||
return create( -1, null, turtle.getColour(), turtle.getFamily(), leftUpgrade, rightUpgrade, 0, turtle.getOverlay() );
|
access.getFuelLevel(), turtle.getOverlay()
|
||||||
}
|
);
|
||||||
|
|
||||||
int id = turtle.getComputerID();
|
|
||||||
int fuelLevel = turtle.getAccess().getFuelLevel();
|
|
||||||
return create( id, label, turtle.getColour(), turtle.getFamily(), leftUpgrade, rightUpgrade, fuelLevel, turtle.getOverlay() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
|
Reference in New Issue
Block a user