Search in sources :

Example 1 with RailcraftTileEntity

use of mods.railcraft.common.blocks.RailcraftTileEntity in project Railcraft by Railcraft.

the class PacketTileRequest method readData.

@Override
public void readData(RailcraftInputStream data) throws IOException {
    World world = DimensionManager.getWorld(data.readInt());
    if (world == null)
        return;
    int x = data.readInt();
    int y = data.readInt();
    int z = data.readInt();
    tile = world.getTileEntity(new BlockPos(x, y, z));
    if (tile instanceof RailcraftTileEntity && player != null)
        PacketBuilder.instance().sendTileEntityPacket(tile, player);
}
Also used : RailcraftTileEntity(mods.railcraft.common.blocks.RailcraftTileEntity) BlockPos(net.minecraft.util.math.BlockPos) World(net.minecraft.world.World)

Example 2 with RailcraftTileEntity

use of mods.railcraft.common.blocks.RailcraftTileEntity in project Railcraft by Railcraft.

the class CommandDebug method executeSubCommand.

@Override
public void executeSubCommand(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
    if (args.length != 0)
        CommandHelpers.throwWrongUsage(sender, this);
    RayTraceResult rayTraceResult = MiscTools.rayTracePlayerLook((EntityPlayer) sender);
    List<String> debug = Collections.emptyList();
    switch(rayTraceResult.typeOfHit) {
        case ENTITY:
            Entity entity = rayTraceResult.entityHit;
            if (entity instanceof EntityMinecart) {
                debug = CartTools.getDebugOutput((EntityMinecart) entity);
            } else {
                CommandHelpers.throwWrongUsage(sender, this);
            }
            break;
        case BLOCK:
            World world = CommandHelpers.getWorld(sender);
            TileEntity tile = WorldPlugin.getBlockTile(world, rayTraceResult.getBlockPos());
            if (tile instanceof RailcraftTileEntity) {
                debug = ((RailcraftTileEntity) tile).getDebugOutput();
            } else {
                CommandHelpers.throwWrongUsage(sender, this);
            }
            break;
    }
    for (String s : debug) {
        printLine(sender, s);
    }
}
Also used : RailcraftTileEntity(mods.railcraft.common.blocks.RailcraftTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) Entity(net.minecraft.entity.Entity) RailcraftTileEntity(mods.railcraft.common.blocks.RailcraftTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) RailcraftTileEntity(mods.railcraft.common.blocks.RailcraftTileEntity) RayTraceResult(net.minecraft.util.math.RayTraceResult) World(net.minecraft.world.World) EntityMinecart(net.minecraft.entity.item.EntityMinecart)

Aggregations

RailcraftTileEntity (mods.railcraft.common.blocks.RailcraftTileEntity)2 World (net.minecraft.world.World)2 Entity (net.minecraft.entity.Entity)1 EntityMinecart (net.minecraft.entity.item.EntityMinecart)1 TileEntity (net.minecraft.tileentity.TileEntity)1 BlockPos (net.minecraft.util.math.BlockPos)1 RayTraceResult (net.minecraft.util.math.RayTraceResult)1