Search in sources :

Example 1 with TileEntityHoverController

use of ValkyrienWarfareControl.TileEntity.TileEntityHoverController in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class TileEntityEtherCompressor method getForceOutput.

public Vector getForceOutput(World world, BlockPos pos, IBlockState state, PhysicsWrapperEntity shipEntity, double secondsToApply) {
    if (controllerPos.equals(BlockPos.ORIGIN)) {
        return null;
    }
    if (!shipEntity.wrapping.ownsChunk(controllerPos.getX() >> 4, controllerPos.getZ() >> 4)) {
        return null;
    }
    IBlockState controllerState = shipEntity.wrapping.VKChunkCache.getBlockState(controllerPos);
    TileEntity tileEnt = shipEntity.wrapping.VKChunkCache.getTileEntity(controllerPos);
    if (!(controllerState.getBlock() instanceof BlockHovercraftController)) {
        if (tileEnt instanceof TileEntityHoverController) {
            tileEnt.invalidate();
        }
        return null;
    }
    if (!(tileEnt instanceof TileEntityHoverController)) {
        return null;
    }
    TileEntityHoverController controller = (TileEntityHoverController) tileEnt;
    return controller.getForceForEngine(this, world, pos, state, shipEntity.wrapping, secondsToApply);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) BlockHovercraftController(ValkyrienWarfareControl.Block.BlockHovercraftController) IBlockState(net.minecraft.block.state.IBlockState) TileEntityHoverController(ValkyrienWarfareControl.TileEntity.TileEntityHoverController)

Example 2 with TileEntityHoverController

use of ValkyrienWarfareControl.TileEntity.TileEntityHoverController in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class ControlGUIHandler method getServerGuiElement.

@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
    if (ID == ControlGUIEnum.HoverCraftController.ordinal()) {
        TileEntity tileEnt = world.getTileEntity(new BlockPos(x, y, z));
        if (!(tileEnt instanceof TileEntityHoverController)) {
            return null;
        }
        TileEntityHoverController tile = (TileEntityHoverController) tileEnt;
        ((EntityPlayerMP) player).connection.sendPacket(tile.getUpdatePacket());
        return new HovercraftControllerContainer(player.inventory, tile);
    }
    return null;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) BlockPos(net.minecraft.util.math.BlockPos) TileEntityHoverController(ValkyrienWarfareControl.TileEntity.TileEntityHoverController)

Example 3 with TileEntityHoverController

use of ValkyrienWarfareControl.TileEntity.TileEntityHoverController in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class HovercraftControllerGUIInputHandler method onMessage.

@Override
public IMessage onMessage(final HovercraftControllerGUIInputMessage message, final MessageContext ctx) {
    IThreadListener mainThread = ctx.getServerHandler().serverController;
    mainThread.addScheduledTask(new Runnable() {

        @Override
        public void run() {
            PhysicsWrapperEntity wrapper = ValkyrienWarfareMod.physicsManager.getObjectManagingPos(ctx.getServerHandler().playerEntity.worldObj, message.tilePos);
            TileEntity tileEnt = wrapper.wrapping.VKChunkCache.getTileEntity(message.tilePos);
            if (tileEnt != null) {
                if (tileEnt instanceof TileEntityHoverController) {
                    ((TileEntityHoverController) tileEnt).handleGUIInput(message, ctx);
                }
            } else {
                System.out.println("Player: " + ctx.getServerHandler().playerEntity.getName() + " sent a broken packet");
            }
        }
    });
    return null;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) PhysicsWrapperEntity(ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity) IThreadListener(net.minecraft.util.IThreadListener) TileEntityHoverController(ValkyrienWarfareControl.TileEntity.TileEntityHoverController)

Aggregations

TileEntityHoverController (ValkyrienWarfareControl.TileEntity.TileEntityHoverController)3 TileEntity (net.minecraft.tileentity.TileEntity)3 PhysicsWrapperEntity (ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity)1 BlockHovercraftController (ValkyrienWarfareControl.Block.BlockHovercraftController)1 IBlockState (net.minecraft.block.state.IBlockState)1 IThreadListener (net.minecraft.util.IThreadListener)1 BlockPos (net.minecraft.util.math.BlockPos)1