Migrations
This commit is contained in:
@@ -26,9 +26,9 @@ import java.util.Deque;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
@@ -281,9 +281,9 @@ public class GridNode implements IGridNode, IPathItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadFromNBT(final String name, final CompoundNBT nodeData) {
|
||||
public void loadFromNBT(final String name, final CompoundTag nodeData) {
|
||||
if (this.myGrid == null) {
|
||||
final CompoundNBT node = nodeData.getCompound(name);
|
||||
final CompoundTag node = nodeData.getCompound(name);
|
||||
this.playerID = node.getInt("p");
|
||||
this.setLastSecurityKey(node.getLong("k"));
|
||||
|
||||
@@ -296,9 +296,9 @@ public class GridNode implements IGridNode, IPathItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveToNBT(final String name, final CompoundNBT nodeData) {
|
||||
public void saveToNBT(final String name, final CompoundTag nodeData) {
|
||||
if (this.myStorage != null) {
|
||||
final CompoundNBT node = new CompoundNBT();
|
||||
final CompoundTag node = new CompoundTag();
|
||||
|
||||
node.putInt("p", this.playerID);
|
||||
node.putLong("k", this.getLastSecurityKey());
|
||||
|
||||
@@ -21,7 +21,7 @@ package appeng.me;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridStorage;
|
||||
@@ -30,7 +30,7 @@ import appeng.core.worlddata.WorldData;
|
||||
public class GridStorage implements IGridStorage {
|
||||
|
||||
private final long myID;
|
||||
private final CompoundNBT data;
|
||||
private final CompoundTag data;
|
||||
private final WeakHashMap<GridStorage, Boolean> divided = new WeakHashMap<>();
|
||||
private WeakReference<IGrid> internalGrid = null;
|
||||
|
||||
@@ -41,7 +41,7 @@ public class GridStorage implements IGridStorage {
|
||||
*/
|
||||
public GridStorage(final long id) {
|
||||
this.myID = id;
|
||||
this.data = new CompoundNBT();
|
||||
this.data = new CompoundTag();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,7 +50,7 @@ public class GridStorage implements IGridStorage {
|
||||
* @param data The Grid data.
|
||||
* @param id ID of grid storage
|
||||
*/
|
||||
public GridStorage(final long id, final CompoundNBT data) {
|
||||
public GridStorage(final long id, final CompoundTag data) {
|
||||
this.myID = id;
|
||||
this.data = data;
|
||||
}
|
||||
@@ -60,7 +60,7 @@ public class GridStorage implements IGridStorage {
|
||||
*/
|
||||
public GridStorage() {
|
||||
this.myID = 0;
|
||||
this.data = new CompoundNBT();
|
||||
this.data = new CompoundTag();
|
||||
}
|
||||
|
||||
public void saveState() {
|
||||
@@ -79,7 +79,7 @@ public class GridStorage implements IGridStorage {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundNBT dataObject() {
|
||||
public CompoundTag dataObject() {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import com.google.common.collect.ImmutableList;
|
||||
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
@@ -862,8 +862,8 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
|
||||
+ Integer.toString(hmm, Character.MAX_RADIX);
|
||||
}
|
||||
|
||||
private CompoundNBT generateLinkData(final String craftingID, final boolean standalone, final boolean req) {
|
||||
final CompoundNBT tag = new CompoundNBT();
|
||||
private CompoundTag generateLinkData(final String craftingID, final boolean standalone, final boolean req) {
|
||||
final CompoundTag tag = new CompoundTag();
|
||||
|
||||
tag.putString("CraftID", craftingID);
|
||||
tag.putBoolean("canceled", false);
|
||||
@@ -976,21 +976,21 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
|
||||
return is;
|
||||
}
|
||||
|
||||
public void writeToNBT(final CompoundNBT data) {
|
||||
public void writeToNBT(final CompoundTag data) {
|
||||
data.put("finalOutput", this.writeItem(this.finalOutput));
|
||||
data.put("inventory", this.writeList(this.inventory.getItemList()));
|
||||
data.putBoolean("waiting", this.waiting);
|
||||
data.putBoolean("isComplete", this.isComplete);
|
||||
|
||||
if (this.myLastLink != null) {
|
||||
final CompoundNBT link = new CompoundNBT();
|
||||
final CompoundTag link = new CompoundTag();
|
||||
this.myLastLink.writeToNBT(link);
|
||||
data.put("link", link);
|
||||
}
|
||||
|
||||
final ListNBT list = new ListNBT();
|
||||
for (final Entry<ICraftingPatternDetails, TaskProgress> e : this.tasks.entrySet()) {
|
||||
final CompoundNBT item = this.writeItem(AEItemStack.fromItemStack(e.getKey().getPattern()));
|
||||
final CompoundTag item = this.writeItem(AEItemStack.fromItemStack(e.getKey().getPattern()));
|
||||
item.putLong("craftingProgress", e.getValue().value);
|
||||
list.add(item);
|
||||
}
|
||||
@@ -1003,8 +1003,8 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
|
||||
data.putLong("remainingItemCount", this.getRemainingItemCount());
|
||||
}
|
||||
|
||||
private CompoundNBT writeItem(final IAEItemStack finalOutput2) {
|
||||
final CompoundNBT out = new CompoundNBT();
|
||||
private CompoundTag writeItem(final IAEItemStack finalOutput2) {
|
||||
final CompoundTag out = new CompoundTag();
|
||||
|
||||
if (finalOutput2 != null) {
|
||||
finalOutput2.writeToNBT(out);
|
||||
@@ -1037,7 +1037,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
|
||||
this.updateName();
|
||||
}
|
||||
|
||||
public void readFromNBT(final CompoundNBT data) {
|
||||
public void readFromNBT(final CompoundTag data) {
|
||||
this.finalOutput = AEItemStack.fromNBT(data.getCompound("finalOutput"));
|
||||
for (final IAEItemStack ais : this.readList(data.getList("inventory", 10))) {
|
||||
this.inventory.injectItems(ais, Actionable.MODULATE, this.machineSrc);
|
||||
@@ -1047,14 +1047,14 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
|
||||
this.isComplete = data.getBoolean("isComplete");
|
||||
|
||||
if (data.contains("link")) {
|
||||
final CompoundNBT link = data.getCompound("link");
|
||||
final CompoundTag link = data.getCompound("link");
|
||||
this.myLastLink = new CraftingLink(link, this);
|
||||
this.submitLink(this.myLastLink);
|
||||
}
|
||||
|
||||
final ListNBT list = data.getList("tasks", 10);
|
||||
for (int x = 0; x < list.size(); x++) {
|
||||
final CompoundNBT item = list.getCompound(x);
|
||||
final CompoundTag item = list.getCompound(x);
|
||||
final IAEItemStack pattern = AEItemStack.fromNBT(item);
|
||||
if (pattern != null && pattern.getItem() instanceof ICraftingPatternItem) {
|
||||
final ICraftingPatternItem cpi = (ICraftingPatternItem) pattern.getItem();
|
||||
|
||||
@@ -20,7 +20,7 @@ package appeng.me.cluster.implementations;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
@@ -135,7 +135,7 @@ public class QuantumCalculator extends MBCalculator {
|
||||
return te instanceof QuantumBridgeTileEntity;
|
||||
}
|
||||
|
||||
private boolean isBlockAtLocation(final IBlockReader w, final BlockPos pos, final IBlockDefinition def) {
|
||||
private boolean isBlockAtLocation(final BlockView w, final BlockPos pos, final IBlockDefinition def) {
|
||||
return def.maybeBlock().map(block -> block == w.getBlockState(pos).getBlock()).orElse(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@ import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.networking.GridFlags;
|
||||
@@ -59,7 +59,7 @@ public class AENetworkProxy implements IGridBlock {
|
||||
private final boolean worldNode;
|
||||
private final String nbtName; // name
|
||||
private AEColor myColor = AEColor.TRANSPARENT;
|
||||
private CompoundNBT data = null; // input
|
||||
private CompoundTag data = null; // input
|
||||
private ItemStack myRepInstance = ItemStack.EMPTY;
|
||||
private boolean isReady = false;
|
||||
private IGridNode node = null;
|
||||
@@ -81,7 +81,7 @@ public class AENetworkProxy implements IGridBlock {
|
||||
this.myRepInstance = is;
|
||||
}
|
||||
|
||||
public void writeToNBT(final CompoundNBT tag) {
|
||||
public void writeToNBT(final CompoundTag tag) {
|
||||
if (this.node != null) {
|
||||
this.node.saveToNBT(this.nbtName, tag);
|
||||
}
|
||||
@@ -137,7 +137,7 @@ public class AENetworkProxy implements IGridBlock {
|
||||
return this.node;
|
||||
}
|
||||
|
||||
public void readFromNBT(final CompoundNBT tag) {
|
||||
public void readFromNBT(final CompoundTag tag) {
|
||||
this.data = tag;
|
||||
if (this.node != null && this.data != null) {
|
||||
this.node.loadFromNBT(this.nbtName, this.data);
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package appeng.me.storage;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
@@ -47,7 +47,7 @@ public abstract class AbstractCellInventory<T extends IAEStack<T>> implements IC
|
||||
protected static final String ITEM_PRE_FORMATTED_FUZZY = "FP";
|
||||
private static final String[] ITEM_SLOT_KEYS = new String[MAX_ITEM_TYPES];
|
||||
private static final String[] ITEM_SLOT_COUNT_KEYS = new String[MAX_ITEM_TYPES];
|
||||
private final CompoundNBT tagCompound;
|
||||
private final CompoundTag tagCompound;
|
||||
protected final ISaveProvider container;
|
||||
private int maxItemTypes = MAX_ITEM_TYPES;
|
||||
private short storedItems = 0;
|
||||
@@ -107,7 +107,7 @@ public abstract class AbstractCellInventory<T extends IAEStack<T>> implements IC
|
||||
for (final T v : this.cellItems) {
|
||||
itemCount += v.getStackSize();
|
||||
|
||||
final CompoundNBT g = new CompoundNBT();
|
||||
final CompoundTag g = new CompoundTag();
|
||||
v.writeToNBT(g);
|
||||
this.tagCompound.put(ITEM_SLOT_KEYS[x], g);
|
||||
this.tagCompound.putInt(ITEM_SLOT_COUNT_KEYS[x], (int) v.getStackSize());
|
||||
@@ -168,7 +168,7 @@ public abstract class AbstractCellInventory<T extends IAEStack<T>> implements IC
|
||||
boolean needsUpdate = false;
|
||||
|
||||
for (int slot = 0; slot < types; slot++) {
|
||||
CompoundNBT compoundTag = this.tagCompound.getCompound(ITEM_SLOT_KEYS[slot]);
|
||||
CompoundTag compoundTag = this.tagCompound.getCompound(ITEM_SLOT_KEYS[slot]);
|
||||
int stackSize = this.tagCompound.getInt(ITEM_SLOT_COUNT_KEYS[slot]);
|
||||
needsUpdate |= !this.loadCellItem(compoundTag, stackSize);
|
||||
}
|
||||
@@ -185,7 +185,7 @@ public abstract class AbstractCellInventory<T extends IAEStack<T>> implements IC
|
||||
* @param stackSize
|
||||
* @return true when successfully loaded
|
||||
*/
|
||||
protected abstract boolean loadCellItem(CompoundNBT compoundTag, int stackSize);
|
||||
protected abstract boolean loadCellItem(CompoundTag compoundTag, int stackSize);
|
||||
|
||||
@Override
|
||||
public IItemList<T> getAvailableItems(final IItemList<T> out) {
|
||||
|
||||
@@ -3,7 +3,7 @@ package appeng.me.storage;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.exceptions.AppEngException;
|
||||
@@ -208,7 +208,7 @@ public class BasicCellInventory<T extends IAEStack<T>> extends AbstractCellInven
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean loadCellItem(CompoundNBT compoundTag, int stackSize) {
|
||||
protected boolean loadCellItem(CompoundTag compoundTag, int stackSize) {
|
||||
// Now load the item stack
|
||||
final T t;
|
||||
try {
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package appeng.me.storage;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
@@ -122,7 +122,7 @@ public class BasicCellInventoryHandler<T extends IAEStack<T>> extends MEInventor
|
||||
return this.getWhitelist();
|
||||
}
|
||||
|
||||
CompoundNBT openNbtData() {
|
||||
CompoundTag openNbtData() {
|
||||
return this.getCellInv().getItemStack().getOrCreateTag();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user