mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-02-14 10:00:06 +00:00
Initial work on GUIs
Needs a bit of a cleanup, but it's a start!
This commit is contained in:
parent
f90da739eb
commit
d10b657a54
@ -3,5 +3,5 @@ mod_version=1.83.1
|
||||
|
||||
# Minecraft properties
|
||||
mc_version=1.14.2
|
||||
forge_version=26.0.12
|
||||
forge_version=26.0.16
|
||||
mappings_version=20190609-1.14.2
|
||||
|
@ -24,7 +24,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
||||
public class GuiComputer<T extends Container & IContainerComputer> extends ContainerScreen<T>
|
||||
public final class GuiComputer<T extends Container & IContainerComputer> extends ContainerScreen<T>
|
||||
{
|
||||
public static final ResourceLocation BACKGROUND_NORMAL = new ResourceLocation( ComputerCraft.MOD_ID, "textures/gui/corners_normal.png" );
|
||||
public static final ResourceLocation BACKGROUND_ADVANCED = new ResourceLocation( ComputerCraft.MOD_ID, "textures/gui/corners_advanced.png" );
|
||||
@ -39,7 +39,7 @@ public class GuiComputer<T extends Container & IContainerComputer> extends Conta
|
||||
private WidgetTerminal terminal;
|
||||
private WidgetWrapper terminalWrapper;
|
||||
|
||||
public GuiComputer(
|
||||
private GuiComputer(
|
||||
T container, PlayerInventory player, ITextComponent title,
|
||||
ComputerFamily family, ClientComputer computer, int termWidth, int termHeight
|
||||
)
|
||||
@ -58,8 +58,7 @@ public class GuiComputer<T extends Container & IContainerComputer> extends Conta
|
||||
container, inventory, component,
|
||||
container.getFamily(),
|
||||
(ClientComputer) container.getComputer(),
|
||||
ComputerCraft.terminalWidth_computer,
|
||||
ComputerCraft.terminalHeight_computer
|
||||
ComputerCraft.terminalWidth_computer, ComputerCraft.terminalHeight_computer
|
||||
);
|
||||
}
|
||||
|
||||
@ -70,8 +69,7 @@ public class GuiComputer<T extends Container & IContainerComputer> extends Conta
|
||||
container, inventory, component,
|
||||
item instanceof ItemPocketComputer ? ((ItemPocketComputer) item).getFamily() : ComputerFamily.Normal,
|
||||
(ClientComputer) container.getComputer(),
|
||||
ComputerCraft.terminalWidth_computer,
|
||||
ComputerCraft.terminalHeight_computer
|
||||
ComputerCraft.terminalWidth_computer, ComputerCraft.terminalHeight_computer
|
||||
);
|
||||
}
|
||||
|
||||
@ -79,8 +77,9 @@ public class GuiComputer<T extends Container & IContainerComputer> extends Conta
|
||||
{
|
||||
return new GuiComputer<>(
|
||||
container, inventory, component,
|
||||
// TODO: Waiting to see how Forge handles this before implementing anything else.
|
||||
null, (ClientComputer) container.getComputer(), 0, 0
|
||||
container.getFamily(),
|
||||
(ClientComputer) container.getComputer(),
|
||||
container.getWidth(), container.getHeight()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ public class GuiTurtle extends ContainerScreen<ContainerTurtle>
|
||||
super( container, player, title );
|
||||
|
||||
m_container = container;
|
||||
m_family = null; // TODO
|
||||
m_family = container.getFamily();
|
||||
m_computer = (ClientComputer) container.getComputer();
|
||||
|
||||
xSize = 254;
|
||||
|
@ -20,7 +20,6 @@ import dan200.computercraft.core.tracking.TrackingField;
|
||||
import dan200.computercraft.shared.command.text.TableBuilder;
|
||||
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||
import dan200.computercraft.shared.computer.core.ServerComputer;
|
||||
import dan200.computercraft.shared.network.container.ViewComputerContainerData;
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
@ -217,7 +216,7 @@ public final class CommandComputerCraft
|
||||
.executes( context -> {
|
||||
ServerPlayerEntity player = context.getSource().asPlayer();
|
||||
ServerComputer computer = getComputerArgument( context, "computer" );
|
||||
new ViewComputerContainerData( computer ).open( player );
|
||||
// TODO: new ViewComputerContainerData( computer ).open( player );
|
||||
return 1;
|
||||
} ) )
|
||||
|
||||
|
@ -19,7 +19,7 @@ import javax.annotation.Nonnull;
|
||||
|
||||
public class ContainerHeldItem extends Container
|
||||
{
|
||||
public static final ContainerType<ContainerHeldItem> PRINTOUT_TYPE = ContainerData.create( PrintoutContainerData::new );
|
||||
public static final ContainerType<ContainerHeldItem> PRINTOUT_TYPE = ContainerData.toType( PrintoutContainerData::new, null /* TODO */ );
|
||||
|
||||
private final ItemStack m_stack;
|
||||
private final Hand m_hand;
|
||||
|
@ -11,13 +11,19 @@ import dan200.computercraft.core.computer.ComputerSide;
|
||||
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||
import dan200.computercraft.shared.computer.core.ComputerState;
|
||||
import dan200.computercraft.shared.computer.core.ServerComputer;
|
||||
import dan200.computercraft.shared.computer.inventory.ContainerComputer;
|
||||
import dan200.computercraft.shared.util.NamedTileEntityType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class TileComputer extends TileComputerBase
|
||||
{
|
||||
public static final NamedTileEntityType<TileComputer> FACTORY_NORMAL = NamedTileEntityType.create(
|
||||
@ -67,12 +73,6 @@ public class TileComputer extends TileComputerBase
|
||||
return m_proxy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openGUI( PlayerEntity player )
|
||||
{
|
||||
// TODO: Containers.openComputerGUI( player, this );
|
||||
}
|
||||
|
||||
public boolean isUsableByPlayer( PlayerEntity player )
|
||||
{
|
||||
return isUsable( player, false );
|
||||
@ -103,4 +103,11 @@ public class TileComputer extends TileComputerBase
|
||||
if( localSide == ComputerSide.LEFT ) return ComputerSide.RIGHT;
|
||||
return localSide;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Container createMenu( int id, @Nonnull PlayerInventory inventory, @Nonnull PlayerEntity player )
|
||||
{
|
||||
return new ContainerComputer( id, this );
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ import dan200.computercraft.shared.computer.core.ClientComputer;
|
||||
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||
import dan200.computercraft.shared.computer.core.ComputerState;
|
||||
import dan200.computercraft.shared.computer.core.ServerComputer;
|
||||
import dan200.computercraft.shared.network.container.ComputerContainerData;
|
||||
import dan200.computercraft.shared.util.DirectionUtil;
|
||||
import dan200.computercraft.shared.util.RedstoneUtil;
|
||||
import joptsimple.internal.Strings;
|
||||
@ -25,6 +26,7 @@ import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.RedstoneDiodeBlock;
|
||||
import net.minecraft.block.RedstoneWireBlock;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.container.INamedContainerProvider;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
@ -43,7 +45,7 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Objects;
|
||||
|
||||
public abstract class TileComputerBase extends TileGeneric implements IComputerTile, ITickableTileEntity, IPeripheralTile, INameable
|
||||
public abstract class TileComputerBase extends TileGeneric implements IComputerTile, ITickableTileEntity, IPeripheralTile, INameable, INamedContainerProvider
|
||||
{
|
||||
private static final String NBT_ID = "ComputerId";
|
||||
private static final String NBT_LABEL = "Label";
|
||||
@ -97,8 +99,6 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
|
||||
super.remove();
|
||||
}
|
||||
|
||||
public abstract void openGUI( PlayerEntity player );
|
||||
|
||||
protected boolean canNameWithTag( PlayerEntity player )
|
||||
{
|
||||
return false;
|
||||
@ -124,7 +124,7 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
|
||||
if( !getWorld().isRemote && isUsable( player, false ) )
|
||||
{
|
||||
createServerComputer().turnOn();
|
||||
openGUI( player );
|
||||
new ComputerContainerData( createServerComputer() ).open( player, this );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -455,4 +455,11 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
|
||||
{
|
||||
return hasCustomName() ? new StringTextComponent( m_label ) : null;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ITextComponent getDisplayName()
|
||||
{
|
||||
return INameable.super.getDisplayName();
|
||||
}
|
||||
}
|
||||
|
@ -7,60 +7,22 @@
|
||||
package dan200.computercraft.shared.computer.inventory;
|
||||
|
||||
import dan200.computercraft.shared.computer.blocks.TileComputer;
|
||||
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||
import dan200.computercraft.shared.computer.core.IComputer;
|
||||
import dan200.computercraft.shared.computer.core.IContainerComputer;
|
||||
import dan200.computercraft.shared.computer.core.InputState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import dan200.computercraft.shared.network.container.ComputerContainerData;
|
||||
import dan200.computercraft.shared.network.container.ContainerData;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ContainerComputer extends Container implements IContainerComputer
|
||||
public class ContainerComputer extends ContainerComputerBase
|
||||
{
|
||||
public static final ContainerType<ContainerComputer> TYPE = new ContainerType<>( ( id, player ) -> null );
|
||||
public static final ContainerType<ContainerComputer> TYPE = ContainerData.toType( ComputerContainerData::new, ContainerComputer::new );
|
||||
|
||||
private final TileComputer computer;
|
||||
private final InputState input = new InputState( this );
|
||||
|
||||
public ContainerComputer( int id, TileComputer computer )
|
||||
public ContainerComputer( int id, TileComputer tile )
|
||||
{
|
||||
super( TYPE, id );
|
||||
this.computer = computer;
|
||||
super( TYPE, id, tile::isUsableByPlayer, tile.createServerComputer(), tile.getFamily() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith( @Nonnull PlayerEntity player )
|
||||
private ContainerComputer( int id, PlayerInventory player, ComputerContainerData data )
|
||||
{
|
||||
return computer.isUsableByPlayer( player );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ComputerFamily getFamily()
|
||||
{
|
||||
return computer.getFamily();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IComputer getComputer()
|
||||
{
|
||||
return computer.getServerComputer();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public InputState getInput()
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed( PlayerEntity player )
|
||||
{
|
||||
super.onContainerClosed( player );
|
||||
input.close();
|
||||
super( TYPE, id, player, data );
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
||||
* Send enquiries to dratcliffe@gmail.com
|
||||
*/
|
||||
|
||||
package dan200.computercraft.shared.computer.inventory;
|
||||
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||
import dan200.computercraft.shared.computer.core.IComputer;
|
||||
import dan200.computercraft.shared.computer.core.IContainerComputer;
|
||||
import dan200.computercraft.shared.computer.core.InputState;
|
||||
import dan200.computercraft.shared.network.container.ComputerContainerData;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class ContainerComputerBase extends Container implements IContainerComputer
|
||||
{
|
||||
private final Predicate<PlayerEntity> canUse;
|
||||
private final IComputer computer;
|
||||
private final ComputerFamily family;
|
||||
private final InputState input = new InputState( this );
|
||||
|
||||
protected ContainerComputerBase( ContainerType<? extends ContainerComputerBase> type, int id, Predicate<PlayerEntity> canUse, IComputer computer, ComputerFamily family )
|
||||
{
|
||||
super( type, id );
|
||||
this.canUse = canUse;
|
||||
this.computer = computer;
|
||||
this.family = family;
|
||||
}
|
||||
|
||||
protected ContainerComputerBase( ContainerType<? extends ContainerComputerBase> type, int id, PlayerInventory player, ComputerContainerData data )
|
||||
{
|
||||
this( type, id, x -> true,
|
||||
(player.player.world.isRemote
|
||||
? ComputerCraft.clientComputerRegistry
|
||||
: ComputerCraft.serverComputerRegistry).get( data.getInstanceId() ),
|
||||
data.getFamily() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith( @Nonnull PlayerEntity player )
|
||||
{
|
||||
return canUse.test( player );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ComputerFamily getFamily()
|
||||
{
|
||||
return family;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IComputer getComputer()
|
||||
{
|
||||
return computer;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public InputState getInput()
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed( PlayerEntity player )
|
||||
{
|
||||
super.onContainerClosed( player );
|
||||
input.close();
|
||||
}
|
||||
}
|
@ -7,82 +7,72 @@
|
||||
package dan200.computercraft.shared.computer.inventory;
|
||||
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.shared.computer.core.*;
|
||||
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||
import dan200.computercraft.shared.computer.core.IContainerComputer;
|
||||
import dan200.computercraft.shared.computer.core.ServerComputer;
|
||||
import dan200.computercraft.shared.network.container.ContainerData;
|
||||
import dan200.computercraft.shared.network.container.ViewComputerContainerData;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ContainerViewComputer extends Container implements IContainerComputer
|
||||
public class ContainerViewComputer extends ContainerComputerBase implements IContainerComputer
|
||||
{
|
||||
public static final ContainerType<ContainerViewComputer> TYPE = ContainerData.create( ViewComputerContainerData::new );
|
||||
public static final ContainerType<ContainerViewComputer> TYPE = ContainerData.toType( ViewComputerContainerData::new, ContainerViewComputer::new );
|
||||
|
||||
private final IComputer computer;
|
||||
private final InputState input = new InputState( this );
|
||||
private final int width;
|
||||
private final int height;
|
||||
|
||||
public ContainerViewComputer( int id, IComputer computer )
|
||||
public ContainerViewComputer( int id, ServerComputer computer )
|
||||
{
|
||||
super( TYPE, id );
|
||||
this.computer = computer;
|
||||
super( TYPE, id, player -> canInteractWith( computer, player ), computer, computer.getFamily() );
|
||||
this.width = this.height = 0;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IComputer getComputer()
|
||||
public ContainerViewComputer( int id, PlayerInventory player, ViewComputerContainerData data )
|
||||
{
|
||||
return computer;
|
||||
super( TYPE, id, player, data );
|
||||
this.width = data.getWidth();
|
||||
this.height = data.getHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith( @Nonnull PlayerEntity player )
|
||||
private static boolean canInteractWith( @Nonnull ServerComputer computer, @Nonnull PlayerEntity player )
|
||||
{
|
||||
if( computer instanceof ServerComputer )
|
||||
// If this computer no longer exists then discard it.
|
||||
if( ComputerCraft.serverComputerRegistry.get( computer.getInstanceID() ) != computer )
|
||||
{
|
||||
ServerComputer serverComputer = (ServerComputer) computer;
|
||||
return false;
|
||||
}
|
||||
|
||||
// If this computer no longer exists then discard it.
|
||||
if( ComputerCraft.serverComputerRegistry.get( serverComputer.getInstanceID() ) != serverComputer )
|
||||
// If we're a command computer then ensure we're in creative
|
||||
if( computer.getFamily() == ComputerFamily.Command )
|
||||
{
|
||||
MinecraftServer server = player.getServer();
|
||||
if( server == null || !server.isCommandBlockEnabled() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// If we're a command computer then ensure we're in creative
|
||||
if( serverComputer.getFamily() == ComputerFamily.Command )
|
||||
else if( !player.canUseCommandBlock() )
|
||||
{
|
||||
MinecraftServer server = player.getServer();
|
||||
if( server == null || !server.isCommandBlockEnabled() )
|
||||
{
|
||||
player.sendStatusMessage( new TranslationTextComponent( "advMode.notEnabled" ), false );
|
||||
return false;
|
||||
}
|
||||
else if( !player.canUseCommandBlock() )
|
||||
{
|
||||
player.sendStatusMessage( new TranslationTextComponent( "advMode.notAllowed" ), false );
|
||||
return false;
|
||||
}
|
||||
player.sendStatusMessage( new TranslationTextComponent( "advMode.notAllowed" ), false );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return computer != null;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public InputState getInput()
|
||||
public int getWidth()
|
||||
{
|
||||
return input;
|
||||
return width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed( PlayerEntity player )
|
||||
public int getHeight()
|
||||
{
|
||||
super.onContainerClosed( player );
|
||||
input.close();
|
||||
return height;
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,6 @@
|
||||
package dan200.computercraft.shared.media.items;
|
||||
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.shared.network.container.PrintoutContainerData;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
@ -60,7 +59,7 @@ public class ItemPrintout extends Item
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick( World world, PlayerEntity player, @Nonnull Hand hand )
|
||||
{
|
||||
if( !world.isRemote ) new PrintoutContainerData( hand ).open( player );
|
||||
// TODO: if( !world.isRemote ) new PrintoutContainerData( hand ).open( player );
|
||||
return new ActionResult<>( ActionResultType.SUCCESS, player.getHeldItem( hand ) );
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
|
||||
* Send enquiries to dratcliffe@gmail.com
|
||||
*/
|
||||
|
||||
package dan200.computercraft.shared.network.container;
|
||||
|
||||
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||
import dan200.computercraft.shared.computer.core.ServerComputer;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
|
||||
public class ComputerContainerData implements ContainerData
|
||||
{
|
||||
private final int id;
|
||||
private final ComputerFamily family;
|
||||
|
||||
public ComputerContainerData( ServerComputer computer )
|
||||
{
|
||||
this.id = computer.getInstanceID();
|
||||
this.family = computer.getFamily();
|
||||
}
|
||||
|
||||
public ComputerContainerData( PacketBuffer buf )
|
||||
{
|
||||
this.id = buf.readInt();
|
||||
this.family = buf.readEnumValue( ComputerFamily.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes( PacketBuffer buf )
|
||||
{
|
||||
buf.writeInt( id );
|
||||
buf.writeEnumValue( family );
|
||||
}
|
||||
|
||||
public int getInstanceId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public ComputerFamily getFamily()
|
||||
{
|
||||
return family;
|
||||
}
|
||||
}
|
@ -10,32 +10,36 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.inventory.container.INamedContainerProvider;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraftforge.common.extensions.IForgeContainerType;
|
||||
import net.minecraftforge.fml.network.NetworkHooks;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* A horrible hack to allow opening GUIs until Forge adds a built-in system.
|
||||
* An extension over the basic {@link IForgeContainerType}/{@link NetworkHooks#openGui(ServerPlayerEntity, INamedContainerProvider, Consumer)}
|
||||
* hooks, with a more convenient way of reading and writing data.
|
||||
*/
|
||||
public interface ContainerData<T extends Container> extends INamedContainerProvider
|
||||
public interface ContainerData
|
||||
{
|
||||
void toBytes( PacketBuffer buf );
|
||||
|
||||
default void open( PlayerEntity player )
|
||||
default void open( PlayerEntity player, INamedContainerProvider owner )
|
||||
{
|
||||
NetworkHooks.openGui( (ServerPlayerEntity) player, this, this::toBytes );
|
||||
NetworkHooks.openGui( (ServerPlayerEntity) player, owner, this::toBytes );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
T createMenu( int id, @Nonnull PlayerInventory inventory, @Nonnull PlayerEntity player );
|
||||
|
||||
static <C extends Container, T extends ContainerData<C>> net.minecraft.inventory.container.ContainerType<C> create( Function<PacketBuffer, T> reader )
|
||||
static <C extends Container, T extends ContainerData> ContainerType<C> toType( Function<PacketBuffer, T> reader, Factory<C, T> factory )
|
||||
{
|
||||
return new net.minecraft.inventory.container.ContainerType<>(
|
||||
( id, player ) -> reader.apply( null ).createMenu( id, player, player.player )
|
||||
);
|
||||
return IForgeContainerType.create( ( id, player, data ) -> factory.create( id, player, reader.apply( data ) ) );
|
||||
}
|
||||
|
||||
interface Factory<C extends Container, T extends ContainerData>
|
||||
{
|
||||
C create( int id, @Nonnull PlayerInventory inventory, T data );
|
||||
}
|
||||
}
|
||||
|
@ -11,8 +11,6 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@ -21,7 +19,7 @@ import javax.annotation.Nonnull;
|
||||
*
|
||||
* @see dan200.computercraft.shared.pocket.items.ItemPocketComputer
|
||||
*/
|
||||
public class PocketComputerContainerData implements ContainerData<ContainerPocketComputer>
|
||||
public class PocketComputerContainerData implements ContainerData
|
||||
{
|
||||
private final Hand hand;
|
||||
|
||||
@ -42,14 +40,6 @@ public class PocketComputerContainerData implements ContainerData<ContainerPocke
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ITextComponent getDisplayName()
|
||||
{
|
||||
return new TranslationTextComponent( "gui.computercraft.pocket" );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ContainerPocketComputer createMenu( int id, @Nonnull PlayerInventory inventory, @Nonnull PlayerEntity player )
|
||||
{
|
||||
return new ContainerPocketComputer( id, player, hand );
|
||||
|
@ -11,8 +11,6 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@ -21,7 +19,7 @@ import javax.annotation.Nonnull;
|
||||
*
|
||||
* @see dan200.computercraft.shared.media.items.ItemPrintout
|
||||
*/
|
||||
public class PrintoutContainerData implements ContainerData<ContainerHeldItem>
|
||||
public class PrintoutContainerData implements ContainerData
|
||||
{
|
||||
private final Hand hand;
|
||||
|
||||
@ -42,14 +40,6 @@ public class PrintoutContainerData implements ContainerData<ContainerHeldItem>
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ITextComponent getDisplayName()
|
||||
{
|
||||
return new TranslationTextComponent( "gui.computercraft.printout" );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ContainerHeldItem createMenu( int id, @Nonnull PlayerInventory inventory, @Nonnull PlayerEntity player )
|
||||
{
|
||||
return new ContainerHeldItem( ContainerHeldItem.PRINTOUT_TYPE, id, player, hand );
|
||||
|
@ -6,18 +6,9 @@
|
||||
|
||||
package dan200.computercraft.shared.network.container;
|
||||
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.core.terminal.Terminal;
|
||||
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||
import dan200.computercraft.shared.computer.core.IComputer;
|
||||
import dan200.computercraft.shared.computer.core.ServerComputer;
|
||||
import dan200.computercraft.shared.computer.inventory.ContainerViewComputer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@ -26,18 +17,14 @@ import javax.annotation.Nonnull;
|
||||
*
|
||||
* @see dan200.computercraft.shared.command.CommandComputerCraft
|
||||
*/
|
||||
public class ViewComputerContainerData implements ContainerData<ContainerViewComputer>
|
||||
public class ViewComputerContainerData extends ComputerContainerData
|
||||
{
|
||||
public static final ResourceLocation ID = new ResourceLocation( ComputerCraft.MOD_ID, "view_computer_gui" );
|
||||
|
||||
private final int instanceId;
|
||||
private final int width;
|
||||
private final int height;
|
||||
private final ComputerFamily family;
|
||||
|
||||
public ViewComputerContainerData( ServerComputer computer )
|
||||
{
|
||||
instanceId = computer.getInstanceID();
|
||||
super( computer );
|
||||
Terminal terminal = computer.getTerminal();
|
||||
if( terminal != null )
|
||||
{
|
||||
@ -48,38 +35,30 @@ public class ViewComputerContainerData implements ContainerData<ContainerViewCom
|
||||
{
|
||||
width = height = 0;
|
||||
}
|
||||
family = computer.getFamily();
|
||||
}
|
||||
|
||||
public ViewComputerContainerData( PacketBuffer buffer )
|
||||
{
|
||||
instanceId = buffer.readVarInt();
|
||||
super( buffer );
|
||||
width = buffer.readVarInt();
|
||||
height = buffer.readVarInt();
|
||||
family = buffer.readEnumValue( ComputerFamily.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes( @Nonnull PacketBuffer buf )
|
||||
{
|
||||
buf.writeVarInt( instanceId );
|
||||
super.toBytes( buf );
|
||||
buf.writeVarInt( width );
|
||||
buf.writeVarInt( height );
|
||||
buf.writeEnumValue( family );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ITextComponent getDisplayName()
|
||||
public int getWidth()
|
||||
{
|
||||
return new TranslationTextComponent( "gui.computercraft.view_computer" );
|
||||
return width;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ContainerViewComputer createMenu( int id, @Nonnull PlayerInventory inventory, @Nonnull PlayerEntity player )
|
||||
public int getHeight()
|
||||
{
|
||||
IComputer computer = (player.world.isRemote ? ComputerCraft.clientComputerRegistry : ComputerCraft.serverComputerRegistry).get( id );
|
||||
return new ContainerViewComputer( id, computer );
|
||||
return height;
|
||||
}
|
||||
}
|
||||
|
@ -583,10 +583,11 @@ public final class TileDiskDrive extends TileGeneric implements DefaultInventory
|
||||
return customName != null ? customName : getBlockState().getBlock().getNameTextComponent();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ITextComponent getDisplayName()
|
||||
{
|
||||
return getName();
|
||||
return INameable.super.getDisplayName();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -579,7 +579,7 @@ public final class TilePrinter extends TileGeneric implements DefaultSidedInvent
|
||||
@Override
|
||||
public ITextComponent getDisplayName()
|
||||
{
|
||||
return getName();
|
||||
return INameable.super.getDisplayName();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -23,7 +23,7 @@ import javax.annotation.Nullable;
|
||||
|
||||
public class ContainerPocketComputer extends ContainerHeldItem implements IContainerComputer
|
||||
{
|
||||
public static final ContainerType<ContainerPocketComputer> TYPE = ContainerData.create( PocketComputerContainerData::new );
|
||||
public static final ContainerType<ContainerPocketComputer> TYPE = ContainerData.toType( PocketComputerContainerData::new, null /* TODO */ );
|
||||
|
||||
private final InputState input = new InputState( this );
|
||||
|
||||
|
@ -20,7 +20,6 @@ import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||
import dan200.computercraft.shared.computer.core.ComputerState;
|
||||
import dan200.computercraft.shared.computer.core.ServerComputer;
|
||||
import dan200.computercraft.shared.computer.items.IComputerItem;
|
||||
import dan200.computercraft.shared.network.container.PocketComputerContainerData;
|
||||
import dan200.computercraft.shared.pocket.apis.PocketAPI;
|
||||
import dan200.computercraft.shared.pocket.core.PocketServerComputer;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
@ -154,7 +153,7 @@ public class ItemPocketComputer extends Item implements IComputerItem, IMedia, I
|
||||
}
|
||||
}
|
||||
|
||||
if( !stop ) new PocketComputerContainerData( hand ).open( player );
|
||||
// TODO: if( !stop ) new PocketComputerContainerData( hand ).open( player );
|
||||
}
|
||||
return new ActionResult<>( ActionResultType.SUCCESS, stack );
|
||||
}
|
||||
|
@ -22,8 +22,11 @@ import dan200.computercraft.shared.computer.core.ComputerState;
|
||||
import dan200.computercraft.shared.computer.core.ServerComputer;
|
||||
import dan200.computercraft.shared.turtle.apis.TurtleAPI;
|
||||
import dan200.computercraft.shared.turtle.core.TurtleBrain;
|
||||
import dan200.computercraft.shared.turtle.inventory.ContainerTurtle;
|
||||
import dan200.computercraft.shared.util.*;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.item.DyeColor;
|
||||
import net.minecraft.item.DyeItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -223,12 +226,6 @@ public class TileTurtle extends TileComputerBase implements ITurtleTile, Default
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openGUI( PlayerEntity player )
|
||||
{
|
||||
// TODO: Containers.openTurtleGUI( player, this );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double getInteractRange( PlayerEntity player )
|
||||
{
|
||||
@ -622,4 +619,11 @@ public class TileTurtle extends TileComputerBase implements ITurtleTile, Default
|
||||
}
|
||||
return super.getCapability( cap, side );
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Container createMenu( int id, @Nonnull PlayerInventory inventory, @Nonnull PlayerEntity player )
|
||||
{
|
||||
return new ContainerTurtle( id, inventory, m_brain );
|
||||
}
|
||||
}
|
||||
|
@ -6,9 +6,12 @@
|
||||
|
||||
package dan200.computercraft.shared.turtle.inventory;
|
||||
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||
import dan200.computercraft.shared.computer.core.IComputer;
|
||||
import dan200.computercraft.shared.computer.core.IContainerComputer;
|
||||
import dan200.computercraft.shared.computer.core.InputState;
|
||||
import dan200.computercraft.shared.computer.inventory.ContainerComputerBase;
|
||||
import dan200.computercraft.shared.network.container.ComputerContainerData;
|
||||
import dan200.computercraft.shared.network.container.ContainerData;
|
||||
import dan200.computercraft.shared.turtle.blocks.TileTurtle;
|
||||
import dan200.computercraft.shared.turtle.core.TurtleBrain;
|
||||
import dan200.computercraft.shared.util.SingleIntArray;
|
||||
@ -16,7 +19,6 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.inventory.container.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -24,25 +26,23 @@ import net.minecraft.util.IIntArray;
|
||||
import net.minecraft.util.IntArray;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class ContainerTurtle extends Container implements IContainerComputer
|
||||
public class ContainerTurtle extends ContainerComputerBase
|
||||
{
|
||||
public static final ContainerType<ContainerTurtle> TYPE = new ContainerType<>( ContainerTurtle::new );
|
||||
public static final ContainerType<ContainerTurtle> TYPE = ContainerData.toType( ComputerContainerData::new, ContainerTurtle::new );
|
||||
|
||||
public static final int PLAYER_START_Y = 134;
|
||||
public static final int TURTLE_START_X = 175;
|
||||
|
||||
private final IIntArray properties;
|
||||
|
||||
private IComputer computer;
|
||||
private TurtleBrain turtle;
|
||||
|
||||
private final InputState input = new InputState( this );
|
||||
|
||||
protected ContainerTurtle( int id, PlayerInventory playerInventory, IInventory inventory, IIntArray properties )
|
||||
private ContainerTurtle(
|
||||
int id, Predicate<PlayerEntity> canUse, IComputer computer, ComputerFamily family,
|
||||
PlayerInventory playerInventory, IInventory inventory, IIntArray properties
|
||||
)
|
||||
{
|
||||
super( TYPE, id );
|
||||
super( TYPE, id, canUse, computer, family );
|
||||
this.properties = properties;
|
||||
|
||||
func_216961_a( properties );
|
||||
@ -72,16 +72,22 @@ public class ContainerTurtle extends Container implements IContainerComputer
|
||||
}
|
||||
}
|
||||
|
||||
public ContainerTurtle( int id, PlayerInventory playerInventory, TurtleBrain turtle, IComputer computer )
|
||||
public ContainerTurtle( int id, PlayerInventory player, TurtleBrain turtle )
|
||||
{
|
||||
this( id, playerInventory, turtle.getInventory(), (SingleIntArray) turtle::getSelectedSlot );
|
||||
this.turtle = turtle;
|
||||
this.computer = computer;
|
||||
this(
|
||||
id, p -> turtle.getOwner().isUsableByPlayer( p ), turtle.getOwner().createServerComputer(), turtle.getFamily(),
|
||||
player, turtle.getInventory(), (SingleIntArray) turtle::getSelectedSlot
|
||||
);
|
||||
}
|
||||
|
||||
private ContainerTurtle( int id, PlayerInventory playerInventory )
|
||||
private ContainerTurtle( int id, PlayerInventory player, ComputerContainerData data )
|
||||
{
|
||||
this( id, playerInventory, new Inventory( TileTurtle.INVENTORY_SIZE ), new IntArray( 1 ) );
|
||||
this( id, x -> true,
|
||||
(player.player.world.isRemote
|
||||
? ComputerCraft.clientComputerRegistry
|
||||
: ComputerCraft.serverComputerRegistry).get( data.getInstanceId() ),
|
||||
data.getFamily(),
|
||||
player, new Inventory( TileTurtle.INVENTORY_SIZE ), new IntArray( 1 ) );
|
||||
}
|
||||
|
||||
public int getSelectedSlot()
|
||||
@ -89,13 +95,6 @@ public class ContainerTurtle extends Container implements IContainerComputer
|
||||
return properties.get( 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith( @Nonnull PlayerEntity player )
|
||||
{
|
||||
// If we've no turtle, we'll be on the client.
|
||||
return turtle == null || (turtle.getOwner() != null && turtle.getOwner().isUsableByPlayer( player ));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private ItemStack tryItemMerge( PlayerEntity player, int slotNum, int firstSlot, int lastSlot, boolean reverse )
|
||||
{
|
||||
@ -145,25 +144,4 @@ public class ContainerTurtle extends Container implements IContainerComputer
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IComputer getComputer()
|
||||
{
|
||||
return computer;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public InputState getInput()
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed( PlayerEntity player )
|
||||
{
|
||||
super.onContainerClosed( player );
|
||||
input.close();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,36 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"rolls": 1,
|
||||
"entries": [
|
||||
{ "type": "minecraft:item", "name": "computercraft:cable" }
|
||||
],
|
||||
"conditions": [
|
||||
{ "condition": "minecraft:survives_explosion" },
|
||||
{
|
||||
"condition": "minecraft:block_state_property",
|
||||
"block": "computercraft:cable",
|
||||
"properties": { "cable": "true" }
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"rolls": 1,
|
||||
"entries": [
|
||||
{ "type": "minecraft:item", "name": "computercraft:wired_modem" }
|
||||
],
|
||||
"conditions": [
|
||||
{ "condition": "minecraft:survives_explosion" },
|
||||
{
|
||||
"condition": "minecraft:inverted",
|
||||
"term": {
|
||||
"condition": "minecraft:block_state_property",
|
||||
"block": "computercraft:cable",
|
||||
"properties": { "modem": "none" }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"rolls": 1,
|
||||
"entries": [
|
||||
{ "type": "minecraft:dynamic", "name": "computercraft:computer" }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"rolls": 1,
|
||||
"entries": [
|
||||
{ "type": "minecraft:dynamic", "name": "computercraft:computer" }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"rolls": 1,
|
||||
"entries": [ { "type": "minecraft:dynamic", "name": "computercraft:computer" } ]
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"rolls": 1,
|
||||
"entries": [ { "type": "minecraft:item", "name": "computercraft:disk_drive" } ],
|
||||
"conditions": [ { "condition": "minecraft:survives_explosion" } ]
|
||||
},
|
||||
{
|
||||
"rolls": 1,
|
||||
"entries": [ { "type": "minecraft:dynamic", "name": "computercraft:contents" } ],
|
||||
"conditions": [ { "condition": "minecraft:survives_explosion" } ]
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"rolls": 1,
|
||||
"entries": [
|
||||
{ "type": "minecraft:item", "name": "computercraft:monitor_advanced" }
|
||||
],
|
||||
"conditions": [ { "condition": "minecraft:survives_explosion" } ]
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"rolls": 1,
|
||||
"entries": [
|
||||
{ "type": "minecraft:item", "name": "computercraft:monitor_normal" }
|
||||
],
|
||||
"conditions": [ { "condition": "minecraft:survives_explosion" } ]
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"rolls": 1,
|
||||
"entries": [ { "type": "minecraft:item", "name": "computercraft:printer" } ],
|
||||
"conditions": [ { "condition": "minecraft:survives_explosion" } ]
|
||||
},
|
||||
{
|
||||
"rolls": 1,
|
||||
"entries": [ { "type": "minecraft:dynamic", "name": "computercraft:contents" } ],
|
||||
"conditions": [ { "condition": "minecraft:survives_explosion" } ]
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"rolls": 1,
|
||||
"entries": [
|
||||
{ "type": "minecraft:item", "name": "computercraft:speaker" }
|
||||
],
|
||||
"conditions": [ { "condition": "minecraft:survives_explosion" } ]
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"rolls": 1,
|
||||
"entries": [
|
||||
{ "type": "minecraft:dynamic", "name": "computercraft:computer" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"rolls": 1,
|
||||
"entries": [ { "type": "minecraft:dynamic", "name": "computercraft:contents" } ],
|
||||
"conditions": [ { "condition": "minecraft:survives_explosion" } ]
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"rolls": 1,
|
||||
"entries": [ { "type": "minecraft:dynamic", "name": "computercraft:computer" } ]
|
||||
},
|
||||
{
|
||||
"rolls": 1,
|
||||
"entries": [ { "type": "minecraft:dynamic", "name": "computercraft:contents" } ],
|
||||
"conditions": [ { "condition": "minecraft:survives_explosion" } ]
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"rolls": 1,
|
||||
"entries": [
|
||||
{ "type": "minecraft:item", "name": "computercraft:wired_modem_full" }
|
||||
],
|
||||
"conditions": [ { "condition": "minecraft:survives_explosion" } ]
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"rolls": 1,
|
||||
"entries": [
|
||||
{ "type": "minecraft:item", "name": "computercraft:wireless_modem_advanced" }
|
||||
],
|
||||
"conditions": [ { "condition": "minecraft:survives_explosion" } ]
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"rolls": 1,
|
||||
"entries": [
|
||||
{ "type": "minecraft:item", "name": "computercraft:wireless_modem_normal" }
|
||||
],
|
||||
"conditions": [ { "condition": "minecraft:survives_explosion" } ]
|
||||
}
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user