Adapted Save system to WIP changes
This commit is contained in:
parent
12f715a4d7
commit
5c6fd1d1fa
4 changed files with 16 additions and 37 deletions
.nb-gradle/profiles/private
src/main/java/com/zixiken/dimdoors
|
@ -3,11 +3,5 @@
|
||||||
<!--DO NOT EDIT THIS FILE! - Used by the Gradle plugin of NetBeans.-->
|
<!--DO NOT EDIT THIS FILE! - Used by the Gradle plugin of NetBeans.-->
|
||||||
<auxiliary>
|
<auxiliary>
|
||||||
<editor-bookmarks lastBookmarkId="0" xmlns="http://www.netbeans.org/ns/editor-bookmarks/2"/>
|
<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>
|
</auxiliary>
|
||||||
</gradle-project-properties>
|
</gradle-project-properties>
|
||||||
|
|
|
@ -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.
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -5,6 +5,7 @@
|
||||||
*/
|
*/
|
||||||
package com.zixiken.dimdoors.shared;
|
package com.zixiken.dimdoors.shared;
|
||||||
|
|
||||||
|
import com.zixiken.dimdoors.tileentities.DDTileEntityBase;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
@ -20,7 +21,7 @@ public class RiftRegistry {
|
||||||
|
|
||||||
// Privates
|
// Privates
|
||||||
private int nextUnusedID;
|
private int nextUnusedID;
|
||||||
private final Map<Integer, Rift> riftList;
|
private final Map<Integer, DDTileEntityBase> riftList;
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
public RiftRegistry() {
|
public RiftRegistry() {
|
||||||
|
@ -41,7 +42,7 @@ public class RiftRegistry {
|
||||||
String tag = "" + i;
|
String tag = "" + i;
|
||||||
while (riftsNBT.hasKey(tag)) {
|
while (riftsNBT.hasKey(tag)) {
|
||||||
NBTTagCompound riftNBT = riftsNBT.getCompoundTag(tag);
|
NBTTagCompound riftNBT = riftsNBT.getCompoundTag(tag);
|
||||||
Rift rift = Rift.readFromNBT(i, riftNBT);
|
DDTileEntityBase rift = DDTileEntityBase.readFromNBT(i, riftNBT);
|
||||||
riftList.put(i, rift);
|
riftList.put(i, rift);
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
|
@ -53,13 +54,13 @@ public class RiftRegistry {
|
||||||
public void writeToNBT(NBTTagCompound nbt) {
|
public void writeToNBT(NBTTagCompound nbt) {
|
||||||
nbt.setInteger("nextUnusedID", nextUnusedID);
|
nbt.setInteger("nextUnusedID", nextUnusedID);
|
||||||
NBTTagCompound riftsNBT = new NBTTagCompound();
|
NBTTagCompound riftsNBT = new NBTTagCompound();
|
||||||
for (Map.Entry<Integer, Rift> entry : riftList.entrySet()) {
|
for (Map.Entry<Integer, DDTileEntityBase> entry : riftList.entrySet()) {
|
||||||
riftsNBT.setTag("" + entry.getKey(), Rift.writeToNBT(entry.getValue()));
|
riftsNBT.setTag("" + entry.getKey(), DDTileEntityBase.writeToNBT(entry.getValue()));
|
||||||
}
|
}
|
||||||
nbt.setTag("riftData", riftsNBT);
|
nbt.setTag("riftData", riftsNBT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int registerNewRift(Rift rift, World world) {
|
public int registerNewRift(DDTileEntityBase rift, World world) {
|
||||||
riftList.put(nextUnusedID, rift);
|
riftList.put(nextUnusedID, rift);
|
||||||
|
|
||||||
nextUnusedID++;
|
nextUnusedID++;
|
||||||
|
@ -74,7 +75,7 @@ public class RiftRegistry {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Rift getRift(int ID) {
|
public DDTileEntityBase getRift(int ID) {
|
||||||
return riftList.get(ID);
|
return riftList.get(ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.zixiken.dimdoors.world.RiftHandler;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
@ -50,4 +51,12 @@ public abstract class DDTileEntityBase extends TileEntity
|
||||||
rifthandler.unpair(pairedRiftID);
|
rifthandler.unpair(pairedRiftID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static NBTTagCompound writeToNBT(DDTileEntityBase rift) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DDTileEntityBase readFromNBT(int dim, NBTTagCompound riftNBT) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue