Search in sources :

Example 11 with ISchematicPage

use of micdoodle8.mods.galacticraft.api.recipe.ISchematicPage in project Galacticraft by micdoodle8.

the class StatsCapability method saveNBTData.

@Override
public void saveNBTData(NBTTagCompound nbt) {
    nbt.setTag("ExtendedInventoryGC", this.extendedInventory.writeToNBT(new NBTTagList()));
    nbt.setInteger("playerAirRemaining", this.airRemaining);
    nbt.setInteger("damageCounter", this.damageCounter);
    nbt.setBoolean("OxygenSetupValid", this.oxygenSetupValid);
    nbt.setBoolean("usingParachute2", this.usingParachute);
    nbt.setBoolean("usingPlanetSelectionGui", this.usingPlanetSelectionGui);
    nbt.setInteger("teleportCooldown", this.teleportCooldown);
    nbt.setDouble("coordsTeleportedFromX", this.coordsTeleportedFromX);
    nbt.setDouble("coordsTeleportedFromZ", this.coordsTeleportedFromZ);
    nbt.setString("startDimension", this.startDimension);
    nbt.setString("spaceStationDimensionInfo", WorldUtil.spaceStationDataToString(this.spaceStationDimensionData));
    nbt.setInteger("thermalLevel", this.thermalLevel);
    Collections.sort(this.unlockedSchematics);
    NBTTagList tagList = new NBTTagList();
    for (ISchematicPage page : this.unlockedSchematics) {
        if (page != null) {
            final NBTTagCompound nbttagcompound = new NBTTagCompound();
            nbttagcompound.setInteger("UnlockedPage", page.getPageID());
            tagList.appendTag(nbttagcompound);
        }
    }
    nbt.setTag("Schematics", tagList);
    nbt.setInteger("rocketStacksLength", this.rocketStacks.length);
    nbt.setInteger("SpaceshipTier", this.spaceshipTier);
    nbt.setInteger("FuelLevel", this.fuelLevel);
    if (this.rocketItem != null) {
        ItemStack returnRocket = new ItemStack(this.rocketItem, 1, this.rocketType);
        nbt.setTag("ReturnRocket", returnRocket.writeToNBT(new NBTTagCompound()));
    }
    final NBTTagList var2 = new NBTTagList();
    for (int var3 = 0; var3 < this.rocketStacks.length; ++var3) {
        if (this.rocketStacks[var3] != null) {
            final NBTTagCompound var4 = new NBTTagCompound();
            var4.setByte("Slot", (byte) var3);
            this.rocketStacks[var3].writeToNBT(var4);
            var2.appendTag(var4);
        }
    }
    nbt.setTag("RocketItems", var2);
    final NBTTagCompound var4 = new NBTTagCompound();
    if (this.launchpadStack != null) {
        nbt.setTag("LaunchpadStack", this.launchpadStack.writeToNBT(var4));
    } else {
        nbt.setTag("LaunchpadStack", var4);
    }
    nbt.setInteger("CryogenicChamberCooldown", this.cryogenicChamberCooldown);
    nbt.setBoolean("ReceivedSoundWarning", this.receivedSoundWarning);
    nbt.setBoolean("ReceivedBedWarning", this.receivedBedWarning);
    nbt.setInteger("BuildFlags", this.buildFlags);
    nbt.setBoolean("ShownSpaceRace", this.openedSpaceRaceManager);
    nbt.setInteger("AstroMinerCount", this.astroMinerCount);
    NBTTagList astroList = new NBTTagList();
    for (BlockVec3 data : this.activeAstroMinerChunks) {
        if (data != null) {
            astroList.appendTag(data.writeToNBT(new NBTTagCompound()));
        }
    }
    nbt.setTag("AstroData", astroList);
    nbt.setInteger("GlassColor1", this.glassColor1);
    nbt.setInteger("GlassColor2", this.glassColor2);
    nbt.setInteger("GlassColor3", this.glassColor3);
    NBTTagList panelList = new NBTTagList();
    for (int i = 0; i < BlockPanelLighting.PANELTYPES_LENGTH; ++i) {
        final NBTTagCompound stateNBT = new NBTTagCompound();
        IBlockState bs = this.panelLightingBases[i];
        if (bs != null) {
            TileEntityPanelLight.writeBlockState(stateNBT, bs);
        }
        panelList.appendTag(stateNBT);
    }
    nbt.setTag("PanLi", panelList);
    nbt.setInteger("PanCo", this.panelLightingColor);
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) IBlockState(net.minecraft.block.state.IBlockState) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ItemStack(net.minecraft.item.ItemStack) ISchematicPage(micdoodle8.mods.galacticraft.api.recipe.ISchematicPage) BlockVec3(micdoodle8.mods.galacticraft.api.vector.BlockVec3)

Example 12 with ISchematicPage

use of micdoodle8.mods.galacticraft.api.recipe.ISchematicPage in project Galacticraft by micdoodle8.

the class EventHandlerGC method getLastSchematic.

@SideOnly(Side.CLIENT)
private static ISchematicPage getLastSchematic(int currentIndex) {
    EntityPlayerSP player = PlayerUtil.getPlayerBaseClientFromPlayer(FMLClientHandler.instance().getClient().thePlayer, false);
    GCPlayerStatsClient stats = GCPlayerStatsClient.get(player);
    final int size = stats.getUnlockedSchematics().size();
    final HashMap<Integer, Integer> idList = new HashMap<Integer, Integer>(size, 1F);
    for (int i = 0; i < size; i++) {
        idList.put(i, stats.getUnlockedSchematics().get(i).getPageID());
    }
    final SortedSet<Integer> keys = new TreeSet<Integer>(idList.keySet());
    final Iterator<Integer> iterator = keys.iterator();
    for (int count = 0; count < keys.size(); count++) {
        final int i = iterator.next();
        final ISchematicPage page = SchematicRegistry.getMatchingRecipeForID(idList.get(i));
        if (page.getPageID() == currentIndex) {
            if (count - 1 >= 0) {
                return stats.getUnlockedSchematics().get(count - 1);
            } else {
                return null;
            }
        }
    }
    return null;
}
Also used : GCPlayerStatsClient(micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStatsClient) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) ISchematicPage(micdoodle8.mods.galacticraft.api.recipe.ISchematicPage) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

ISchematicPage (micdoodle8.mods.galacticraft.api.recipe.ISchematicPage)12 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)5 EntityPlayerSP (net.minecraft.client.entity.EntityPlayerSP)4 ItemStack (net.minecraft.item.ItemStack)4 TileEntity (net.minecraft.tileentity.TileEntity)4 EntityTieredRocket (micdoodle8.mods.galacticraft.api.prefab.entity.EntityTieredRocket)3 BlockVec3 (micdoodle8.mods.galacticraft.api.vector.BlockVec3)3 GCPlayerStats (micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats)3 GCPlayerStatsClient (micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStatsClient)3 PacketSimple (micdoodle8.mods.galacticraft.core.network.PacketSimple)3 Footprint (micdoodle8.mods.galacticraft.core.wrappers.Footprint)3 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)3 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)3 GameProfile (com.mojang.authlib.GameProfile)2 Property (com.mojang.authlib.properties.Property)2 IOException (java.io.IOException)2 CelestialBody (micdoodle8.mods.galacticraft.api.galaxies.CelestialBody)2 SolarSystem (micdoodle8.mods.galacticraft.api.galaxies.SolarSystem)2 ITileClientUpdates (micdoodle8.mods.galacticraft.api.tile.ITileClientUpdates)2 Vector3 (micdoodle8.mods.galacticraft.api.vector.Vector3)2