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