Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void writeToNBT(NBTTagCompound var1)
- {
- super.writeToNBT(var1);
- CoroUtilNBT.writeCoords("posPointStart", posPointStart, var1);
- CoroUtilNBT.writeCoords("posPointEnd", posPointEnd, var1);
- var1.setInteger("thickness", thickness);
- var1.setInteger("height", height);
- NBTTagCompound data = new NBTTagCompound();
- for (int i = 0; i < listConnectedIDs.size(); i++) {
- data.setInteger("data_" + i, listConnectedIDs.get(i));
- }
- var1.setCompoundTag("listConnectedIDs", data);
- data = new NBTTagCompound();
- for (int i = 0; i < listConnectedLinePoints.size(); i++) {
- data.setFloat("data_" + i, listConnectedLinePoints.get(i));
- }
- var1.setCompoundTag("listConnectedLinePoints", data);
- NBTTagCompound dataHeightMap = new NBTTagCompound();
- int writeCount = 0;
- Iterator it = heightMap.entrySet().iterator();
- while (it.hasNext()) {
- writeCount++;
- Map.Entry pairs = (Map.Entry)it.next();
- long key = (Long)pairs.getKey();
- int height = (Integer)pairs.getValue();
- dataHeightMap.setInteger(""+key, height);
- }
- //System.out.println("writeCount: " + writeCount);
- var1.setCompoundTag("dataHeightMap", dataHeightMap);
- }
- @Override
- public void readFromNBT(NBTTagCompound var1)
- {
- super.readFromNBT(var1);
- posPointStart = CoroUtilNBT.readCoords("posPointStart", var1);
- posPointEnd = CoroUtilNBT.readCoords("posPointEnd", var1);
- thickness = var1.getInteger("thickness");
- height = var1.getInteger("height");
- Collection dataListCl = var1.getCompoundTag("listConnectedIDs").getTags();
- Iterator it = dataListCl.iterator();
- while (it.hasNext()) {
- NBTTagInt data = (NBTTagInt)it.next();
- listConnectedIDs.add(data.data);
- }
- dataListCl = var1.getCompoundTag("listConnectedLinePoints").getTags();
- it = dataListCl.iterator();
- while (it.hasNext()) {
- NBTTagFloat data = (NBTTagFloat)it.next();
- listConnectedLinePoints.add(data.data);
- }
- int readCount = 0;
- it = var1.getCompoundTag("dataHeightMap").getTags().iterator();
- while (it.hasNext()) {
- readCount++;
- NBTTagInt data = (NBTTagInt)it.next();
- heightMap.put(Long.valueOf(data.getName()), data.data);
- }
- //System.out.println("readCount: " + readCount);
- updateCache = true; //mark to update, cant update till all town objects are registered
- }
Advertisement
Add Comment
Please, Sign In to add comment