Search in sources :

Example 6 with TileEntityLaserTurret

use of micdoodle8.mods.galacticraft.planets.venus.tile.TileEntityLaserTurret in project Galacticraft by micdoodle8.

the class PacketSimpleVenus method handleServerSide.

@Override
public void handleServerSide(EntityPlayer player) {
    EntityPlayerMP playerBase = PlayerUtil.getPlayerBaseServerFromPlayer(player, false);
    switch(this.type) {
        case S_UPDATE_ADVANCED_GUI:
            TileEntity tile0 = player.world.getTileEntity((BlockPos) this.data.get(1));
            switch((Integer) this.data.get(0)) {
                case 0:
                    if (tile0 instanceof TileEntityLaserTurret) {
                        TileEntityLaserTurret launchController = (TileEntityLaserTurret) tile0;
                        launchController.blacklistMode = ((Integer) this.data.get(2)) != 0;
                    }
                    break;
                case 1:
                    if (tile0 instanceof TileEntityLaserTurret) {
                        TileEntityLaserTurret launchController = (TileEntityLaserTurret) tile0;
                        launchController.targetMeteors = ((Integer) this.data.get(2)) != 0;
                    }
                    break;
                case 2:
                    if (tile0 instanceof TileEntityLaserTurret) {
                        TileEntityLaserTurret launchController = (TileEntityLaserTurret) tile0;
                        launchController.alwaysIgnoreSpaceRace = ((Integer) this.data.get(2)) != 0;
                    }
                    break;
                case 3:
                    if (tile0 instanceof TileEntityLaserTurret) {
                        TileEntityLaserTurret launchController = (TileEntityLaserTurret) tile0;
                        launchController.priorityClosest = ((Integer) this.data.get(2));
                    }
                    break;
                case 4:
                    if (tile0 instanceof TileEntityLaserTurret) {
                        TileEntityLaserTurret launchController = (TileEntityLaserTurret) tile0;
                        launchController.priorityLowestHealth = ((Integer) this.data.get(2));
                    }
                    break;
                case 5:
                    if (tile0 instanceof TileEntityLaserTurret) {
                        TileEntityLaserTurret launchController = (TileEntityLaserTurret) tile0;
                        launchController.priorityHighestHealth = ((Integer) this.data.get(2));
                    }
                    break;
                default:
                    break;
            }
            break;
        case S_OPEN_LASER_TURRET_GUI:
            BlockPos pos = (BlockPos) this.data.get(0);
            player.openGui(GalacticraftPlanets.instance, GuiIdsPlanets.MACHINE_VENUS, player.world, pos.getX(), pos.getY(), pos.getZ());
            break;
        case S_MODIFY_LASER_TARGET:
            TileEntity tile1 = player.world.getTileEntity((BlockPos) this.data.get(1));
            switch((Integer) this.data.get(0)) {
                case 0:
                    if (tile1 instanceof TileEntityLaserTurret) {
                        ((TileEntityLaserTurret) tile1).addPlayer((String) this.data.get(2));
                    }
                    break;
                case 1:
                    if (tile1 instanceof TileEntityLaserTurret) {
                        ((TileEntityLaserTurret) tile1).addEntity(new ResourceLocation((String) this.data.get(2)));
                    }
                    break;
                case 2:
                    if (tile1 instanceof TileEntityLaserTurret) {
                        ((TileEntityLaserTurret) tile1).removePlayer((String) this.data.get(2));
                    }
                    break;
                case 3:
                    if (tile1 instanceof TileEntityLaserTurret) {
                        ((TileEntityLaserTurret) tile1).removeEntity(new ResourceLocation((String) this.data.get(2)));
                    }
                    break;
            }
            break;
        default:
            break;
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) ResourceLocation(net.minecraft.util.ResourceLocation) TileEntityLaserTurret(micdoodle8.mods.galacticraft.planets.venus.tile.TileEntityLaserTurret) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) BlockPos(net.minecraft.util.math.BlockPos)

Aggregations

TileEntity (net.minecraft.tileentity.TileEntity)5 TileEntityLaserTurret (micdoodle8.mods.galacticraft.planets.venus.tile.TileEntityLaserTurret)4 BlockPos (net.minecraft.util.math.BlockPos)3 Map (java.util.Map)1 Vector3 (micdoodle8.mods.galacticraft.api.vector.Vector3)1 TileEntityEnergyStorageModule (micdoodle8.mods.galacticraft.core.tile.TileEntityEnergyStorageModule)1 ContainerCrashedProbe (micdoodle8.mods.galacticraft.planets.venus.inventory.ContainerCrashedProbe)1 ContainerGeothermal (micdoodle8.mods.galacticraft.planets.venus.inventory.ContainerGeothermal)1 ContainerLaserTurret (micdoodle8.mods.galacticraft.planets.venus.inventory.ContainerLaserTurret)1 ContainerSolarArrayController (micdoodle8.mods.galacticraft.planets.venus.inventory.ContainerSolarArrayController)1 Entity (net.minecraft.entity.Entity)1 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)1 ItemStack (net.minecraft.item.ItemStack)1 MinecraftServer (net.minecraft.server.MinecraftServer)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 Rotation (net.minecraft.util.Rotation)1 StructureBoundingBox (net.minecraft.world.gen.structure.StructureBoundingBox)1 PlacementSettings (net.minecraft.world.gen.structure.template.PlacementSettings)1 Template (net.minecraft.world.gen.structure.template.Template)1 TemplateManager (net.minecraft.world.gen.structure.template.TemplateManager)1