Search in sources :

Example 1 with PacketSimpleMars

use of micdoodle8.mods.galacticraft.planets.mars.network.PacketSimpleMars in project Galacticraft by micdoodle8.

the class MarsUtil method openSlimelingInventory.

public static void openSlimelingInventory(EntityPlayerMP player, EntitySlimeling slimeling) {
    player.getNextWindowId();
    player.closeContainer();
    int windowId = player.currentWindowId;
    GalacticraftCore.packetPipeline.sendTo(new PacketSimpleMars(EnumSimplePacketMars.C_OPEN_CUSTOM_GUI, GCCoreUtil.getDimensionID(player.worldObj), new Object[] { windowId, 0, slimeling.getEntityId() }), player);
    player.openContainer = new ContainerSlimeling(player.inventory, slimeling, player);
    player.openContainer.windowId = windowId;
    player.openContainer.onCraftGuiOpened(player);
}
Also used : ContainerSlimeling(micdoodle8.mods.galacticraft.planets.mars.inventory.ContainerSlimeling) PacketSimpleMars(micdoodle8.mods.galacticraft.planets.mars.network.PacketSimpleMars)

Example 2 with PacketSimpleMars

use of micdoodle8.mods.galacticraft.planets.mars.network.PacketSimpleMars in project Galacticraft by micdoodle8.

the class TileEntityLaunchController method update.

@Override
public void update() {
    super.update();
    if (!this.worldObj.isRemote) {
        this.controlEnabled = this.launchSchedulingEnabled && this.hasEnoughEnergyToRun && !this.getDisabled(0);
        if (this.frequencyCheckNeeded) {
            this.checkDestFrequencyValid();
            this.frequencyCheckNeeded = false;
        }
        if (this.requiresClientUpdate) {
            // PacketDispatcher.sendPacketToAllPlayers(this.getPacket());
            // TODO
            this.requiresClientUpdate = false;
        }
        if (this.ticks % 40 == 0) {
            this.setFrequency(this.frequency);
            this.setDestinationFrequency(this.destFrequency);
        }
        if (this.ticks % 20 == 0) {
            if (this.chunkLoadTicket != null) {
                for (int i = 0; i < this.connectedPads.size(); i++) {
                    BlockPos coords = this.connectedPads.get(i);
                    Block block = this.worldObj.getBlockState(coords).getBlock();
                    if (block != GCBlocks.landingPadFull) {
                        this.connectedPads.remove(i);
                        ForgeChunkManager.unforceChunk(this.chunkLoadTicket, new ChunkCoordIntPair(coords.getX() >> 4, coords.getZ() >> 4));
                    }
                }
            }
        }
    } else {
        if (this.frequency == -1 && this.destFrequency == -1) {
            GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_UPDATE_ADVANCED_GUI, GCCoreUtil.getDimensionID(this.worldObj), new Object[] { 5, this.getPos(), 0 }));
        }
    }
}
Also used : ChunkCoordIntPair(net.minecraft.world.ChunkCoordIntPair) Block(net.minecraft.block.Block) BlockPos(net.minecraft.util.BlockPos) PacketSimpleMars(micdoodle8.mods.galacticraft.planets.mars.network.PacketSimpleMars)

Example 3 with PacketSimpleMars

use of micdoodle8.mods.galacticraft.planets.mars.network.PacketSimpleMars in project Galacticraft by micdoodle8.

the class GuiLaunchController method onTextChanged.

@Override
public void onTextChanged(GuiElementTextBox textBox, String newText) {
    if (PlayerUtil.getName(this.mc.thePlayer).equals(this.launchController.getOwnerName())) {
        if (textBox.equals(this.frequency)) {
            this.launchController.frequency = textBox.getIntegerValue();
            GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_UPDATE_ADVANCED_GUI, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { 0, this.launchController.getPos(), this.launchController.frequency }));
        } else if (textBox.equals(this.destinationFrequency)) {
            this.launchController.destFrequency = textBox.getIntegerValue();
            GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_UPDATE_ADVANCED_GUI, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { 2, this.launchController.getPos(), this.launchController.destFrequency }));
        }
    }
}
Also used : PacketSimpleMars(micdoodle8.mods.galacticraft.planets.mars.network.PacketSimpleMars)

Example 4 with PacketSimpleMars

use of micdoodle8.mods.galacticraft.planets.mars.network.PacketSimpleMars in project Galacticraft by micdoodle8.

the class GuiLaunchControllerAdvanced method onSelectionChanged.

@Override
public void onSelectionChanged(GuiElementDropdown dropdown, int selection) {
    if (dropdown.equals(this.dropdownTest)) {
        this.launchController.launchDropdownSelection = selection;
        GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_UPDATE_ADVANCED_GUI, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { 1, this.launchController.getPos(), this.launchController.launchDropdownSelection }));
    }
}
Also used : PacketSimpleMars(micdoodle8.mods.galacticraft.planets.mars.network.PacketSimpleMars)

Example 5 with PacketSimpleMars

use of micdoodle8.mods.galacticraft.planets.mars.network.PacketSimpleMars in project Galacticraft by micdoodle8.

the class TileEntityCryogenicChamber method onActivated.

@Override
public boolean onActivated(EntityPlayer entityPlayer) {
    if (this.worldObj.isRemote) {
        return false;
    }
    EnumStatus enumstatus = this.sleepInBedAt(entityPlayer, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ());
    switch(enumstatus) {
        case OK:
            ((EntityPlayerMP) entityPlayer).playerNetServerHandler.setPlayerLocation(entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, entityPlayer.rotationYaw, entityPlayer.rotationPitch);
            GalacticraftCore.packetPipeline.sendTo(new PacketSimpleMars(EnumSimplePacketMars.C_BEGIN_CRYOGENIC_SLEEP, GCCoreUtil.getDimensionID(entityPlayer.worldObj), new Object[] { this.getPos() }), (EntityPlayerMP) entityPlayer);
            return true;
        case NOT_POSSIBLE_NOW:
            GCPlayerStats stats = GCPlayerStats.get(entityPlayer);
            entityPlayer.addChatMessage(new ChatComponentText(GCCoreUtil.translateWithFormat("gui.cryogenic.chat.cant_use", stats.getCryogenicChamberCooldown() / 20)));
            return false;
        default:
            return false;
    }
}
Also used : EnumStatus(net.minecraft.entity.player.EntityPlayer.EnumStatus) GCPlayerStats(micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats) PacketSimpleMars(micdoodle8.mods.galacticraft.planets.mars.network.PacketSimpleMars) ChatComponentText(net.minecraft.util.ChatComponentText)

Aggregations

PacketSimpleMars (micdoodle8.mods.galacticraft.planets.mars.network.PacketSimpleMars)11 GCPlayerStats (micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats)1 ContainerRocketInventory (micdoodle8.mods.galacticraft.core.inventory.ContainerRocketInventory)1 ContainerLaunchControllerAdvanced (micdoodle8.mods.galacticraft.planets.mars.inventory.ContainerLaunchControllerAdvanced)1 ContainerSlimeling (micdoodle8.mods.galacticraft.planets.mars.inventory.ContainerSlimeling)1 Block (net.minecraft.block.Block)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 EnumStatus (net.minecraft.entity.player.EntityPlayer.EnumStatus)1 BlockPos (net.minecraft.util.BlockPos)1 ChatComponentText (net.minecraft.util.ChatComponentText)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 ChunkCoordIntPair (net.minecraft.world.ChunkCoordIntPair)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1