Adapted Save system to WIP changes

This commit is contained in:
Mathijs Riezebos 2017-01-12 16:00:51 +01:00
parent 12f715a4d7
commit 5c6fd1d1fa
4 changed files with 16 additions and 37 deletions

View file

@ -3,11 +3,5 @@
<!--DO NOT EDIT THIS FILE! - Used by the Gradle plugin of NetBeans.-->
<auxiliary>
<editor-bookmarks lastBookmarkId="0" xmlns="http://www.netbeans.org/ns/editor-bookmarks/2"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/C:/Users/Gebruiker/Documents/GitHub/DimDoors/src/main/java/com/zixiken/dimdoors/CommonProxy.java</file>
<file>file:/C:/Users/Gebruiker/Documents/GitHub/DimDoors/src/main/java/com/zixiken/dimdoors/ModelManager.java</file>
</group>
</open-files>
</auxiliary>
</gradle-project-properties>

View file

@ -1,25 +0,0 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.zixiken.dimdoors.shared;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
/**
*
* @author Robijnvogel
*/
class Rift {
static Rift readFromNBT(int i, NBTTagCompound riftNBT) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
static NBTBase writeToNBT(Rift value) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}

View file

@ -5,6 +5,7 @@
*/
package com.zixiken.dimdoors.shared;
import com.zixiken.dimdoors.tileentities.DDTileEntityBase;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.nbt.NBTTagCompound;
@ -20,7 +21,7 @@ public class RiftRegistry {
// Privates
private int nextUnusedID;
private final Map<Integer, Rift> riftList;
private final Map<Integer, DDTileEntityBase> riftList;
// Methods
public RiftRegistry() {
@ -41,7 +42,7 @@ public class RiftRegistry {
String tag = "" + i;
while (riftsNBT.hasKey(tag)) {
NBTTagCompound riftNBT = riftsNBT.getCompoundTag(tag);
Rift rift = Rift.readFromNBT(i, riftNBT);
DDTileEntityBase rift = DDTileEntityBase.readFromNBT(i, riftNBT);
riftList.put(i, rift);
i++;
@ -53,13 +54,13 @@ public class RiftRegistry {
public void writeToNBT(NBTTagCompound nbt) {
nbt.setInteger("nextUnusedID", nextUnusedID);
NBTTagCompound riftsNBT = new NBTTagCompound();
for (Map.Entry<Integer, Rift> entry : riftList.entrySet()) {
riftsNBT.setTag("" + entry.getKey(), Rift.writeToNBT(entry.getValue()));
for (Map.Entry<Integer, DDTileEntityBase> entry : riftList.entrySet()) {
riftsNBT.setTag("" + entry.getKey(), DDTileEntityBase.writeToNBT(entry.getValue()));
}
nbt.setTag("riftData", riftsNBT);
}
public int registerNewRift(Rift rift, World world) {
public int registerNewRift(DDTileEntityBase rift, World world) {
riftList.put(nextUnusedID, rift);
nextUnusedID++;
@ -74,7 +75,7 @@ public class RiftRegistry {
}
}
public Rift getRift(int ID) {
public DDTileEntityBase getRift(int ID) {
return riftList.get(ID);
}
}

View file

@ -4,6 +4,7 @@ import com.zixiken.dimdoors.world.RiftHandler;
import java.util.Random;
import net.minecraft.block.state.IBlockState;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@ -50,4 +51,12 @@ public abstract class DDTileEntityBase extends TileEntity
rifthandler.unpair(pairedRiftID);
}
}
public static NBTTagCompound writeToNBT(DDTileEntityBase rift) {
}
public static DDTileEntityBase readFromNBT(int dim, NBTTagCompound riftNBT) {
}
}