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);
}
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 }));
}
}
}
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 }));
}
}
}
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 }));
}
}
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;
}
}
Aggregations