mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-03-04 10:38:12 +00:00
Keep ids of unlabelled computers and turtles
This commit is contained in:
parent
3fb906ef6c
commit
ed4229ab70
@ -128,7 +128,7 @@ public abstract class BlockComputerBase extends BlockDirectional
|
||||
if( tile instanceof TileComputerBase )
|
||||
{
|
||||
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 ) );
|
||||
}
|
||||
|
@ -19,9 +19,7 @@ public final class ComputerItemFactory
|
||||
@Nonnull
|
||||
public static ItemStack create( TileComputer tile )
|
||||
{
|
||||
String label = tile.getLabel();
|
||||
int id = label != null ? tile.getComputerID() : -1;
|
||||
return create( id, label, tile.getFamily() );
|
||||
return create( tile.getComputerID(), tile.getLabel(), tile.getFamily() );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -6,6 +6,7 @@
|
||||
package dan200.computercraft.shared.turtle.items;
|
||||
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.api.turtle.ITurtleAccess;
|
||||
import dan200.computercraft.api.turtle.ITurtleUpgrade;
|
||||
import dan200.computercraft.api.turtle.TurtleSide;
|
||||
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||
@ -22,18 +23,13 @@ public final class TurtleItemFactory
|
||||
@Nonnull
|
||||
public static ItemStack create( ITurtleTile turtle )
|
||||
{
|
||||
ITurtleUpgrade leftUpgrade = turtle.getAccess().getUpgrade( TurtleSide.Left );
|
||||
ITurtleUpgrade rightUpgrade = turtle.getAccess().getUpgrade( TurtleSide.Right );
|
||||
ITurtleAccess access = turtle.getAccess();
|
||||
|
||||
String label = turtle.getLabel();
|
||||
if( label == null )
|
||||
{
|
||||
return create( -1, null, turtle.getColour(), turtle.getFamily(), leftUpgrade, rightUpgrade, 0, turtle.getOverlay() );
|
||||
}
|
||||
|
||||
int id = turtle.getComputerID();
|
||||
int fuelLevel = turtle.getAccess().getFuelLevel();
|
||||
return create( id, label, turtle.getColour(), turtle.getFamily(), leftUpgrade, rightUpgrade, fuelLevel, turtle.getOverlay() );
|
||||
return create(
|
||||
turtle.getComputerID(), turtle.getLabel(), turtle.getColour(), turtle.getFamily(),
|
||||
access.getUpgrade( TurtleSide.Left ), access.getUpgrade( TurtleSide.Right ),
|
||||
access.getFuelLevel(), turtle.getOverlay()
|
||||
);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
Loading…
x
Reference in New Issue
Block a user