Migrations
This commit is contained in:
@@ -20,11 +20,11 @@ package appeng.fluids.block;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
@@ -43,10 +43,10 @@ public class FluidInterfaceBlock extends AEBaseTileBlock<FluidInterfaceTileEntit
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity p, final Hand hand,
|
||||
public ActionResult onActivated(final World w, final BlockPos pos, final PlayerEntity p, final Hand hand,
|
||||
final @Nullable ItemStack heldItem, final BlockRayTraceResult hit) {
|
||||
if (p.isCrouching()) {
|
||||
return ActionResultType.PASS;
|
||||
return ActionResult.PASS;
|
||||
}
|
||||
|
||||
final TileEntity tg = this.getTileEntity(w, pos);
|
||||
@@ -55,8 +55,8 @@ public class FluidInterfaceBlock extends AEBaseTileBlock<FluidInterfaceTileEntit
|
||||
ContainerOpener.openContainer(FluidInterfaceContainer.TYPE, p,
|
||||
ContainerLocator.forTileEntitySide(tg, hit.getFace()));
|
||||
}
|
||||
return ActionResultType.SUCCESS;
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
return ActionResultType.PASS;
|
||||
return ActionResult.PASS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,9 +20,9 @@ package appeng.fluids.helper;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
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.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidAttributes;
|
||||
@@ -402,13 +402,13 @@ public class DualityFluidInterface
|
||||
this.priority = newValue;
|
||||
}
|
||||
|
||||
public void writeToNBT(final CompoundNBT data) {
|
||||
public void writeToNBT(final CompoundTag data) {
|
||||
data.putInt("priority", this.priority);
|
||||
this.tanks.writeToNBT(data, "storage");
|
||||
this.config.writeToNBT(data, "config");
|
||||
}
|
||||
|
||||
public void readFromNBT(final CompoundNBT data) {
|
||||
public void readFromNBT(final CompoundTag data) {
|
||||
this.config.readFromNBT(data, "config");
|
||||
this.tanks.readFromNBT(data, "storage");
|
||||
this.priority = data.getInt("priority");
|
||||
|
||||
@@ -21,7 +21,7 @@ package appeng.fluids.helper;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
import appeng.api.implementations.IUpgradeableHost;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
|
||||
@@ -21,7 +21,7 @@ package appeng.fluids.items;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fluids.FluidAttributes;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
@@ -52,7 +52,7 @@ public class FluidDummyItem extends AEBaseItem {
|
||||
|
||||
public FluidStack getFluidStack(ItemStack is) {
|
||||
if (is.hasTag()) {
|
||||
CompoundNBT tag = is.getTag();
|
||||
CompoundTag tag = is.getTag();
|
||||
return FluidStack.loadFluidStackFromNBT(tag);
|
||||
}
|
||||
return FluidStack.EMPTY;
|
||||
@@ -62,7 +62,7 @@ public class FluidDummyItem extends AEBaseItem {
|
||||
if (fs.isEmpty()) {
|
||||
is.setTag(null);
|
||||
} else {
|
||||
CompoundNBT tag = new CompoundNBT();
|
||||
CompoundTag tag = new CompoundTag();
|
||||
fs.writeToNBT(tag);
|
||||
is.setTag(tag);
|
||||
}
|
||||
|
||||
@@ -14,10 +14,10 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
import net.minecraftforge.fluids.FluidAttributes;
|
||||
@@ -179,7 +179,7 @@ public class FluidAnnihilationPlanePart extends BasicStatePart implements IGridT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborChanged(IBlockReader w, BlockPos pos, BlockPos neighbor) {
|
||||
public void onNeighborChanged(BlockView w, BlockPos pos, BlockPos neighbor) {
|
||||
if (pos.offset(this.getSide().getFacing()).equals(neighbor)) {
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -149,14 +149,14 @@ public class FluidFormationPlanePart extends AbstractFormationPlanePart<IAEFluid
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final CompoundNBT data) {
|
||||
public void readFromNBT(final CompoundTag data) {
|
||||
super.readFromNBT(data);
|
||||
this.config.readFromNBT(data, "config");
|
||||
this.updateHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(final CompoundNBT data) {
|
||||
public void writeToNBT(final CompoundTag data) {
|
||||
super.writeToNBT(data);
|
||||
this.config.writeToNBT(data, "config");
|
||||
}
|
||||
|
||||
@@ -23,9 +23,9 @@ import java.util.EnumSet;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
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.Hand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
@@ -113,13 +113,13 @@ public class FluidInterfacePart extends BasicStatePart
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final CompoundNBT data) {
|
||||
public void readFromNBT(final CompoundTag data) {
|
||||
super.readFromNBT(data);
|
||||
this.duality.readFromNBT(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(final CompoundNBT data) {
|
||||
public void writeToNBT(final CompoundTag data) {
|
||||
super.writeToNBT(data);
|
||||
this.duality.writeToNBT(data);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.Random;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.particles.RedstoneParticleData;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Hand;
|
||||
@@ -304,7 +304,7 @@ public class FluidLevelEmitterPart extends UpgradeablePart
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final CompoundNBT data) {
|
||||
public void readFromNBT(final CompoundTag data) {
|
||||
super.readFromNBT(data);
|
||||
this.lastReportedValue = data.getLong("lastReportedValue");
|
||||
this.reportingValue = data.getLong("reportingValue");
|
||||
@@ -313,7 +313,7 @@ public class FluidLevelEmitterPart extends UpgradeablePart
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(final CompoundNBT data) {
|
||||
public void writeToNBT(final CompoundTag data) {
|
||||
super.writeToNBT(data);
|
||||
data.putLong("lastReportedValue", this.lastReportedValue);
|
||||
data.putLong("reportingValue", this.reportingValue);
|
||||
|
||||
@@ -27,9 +27,9 @@ import javax.annotation.Nonnull;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
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.Hand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
@@ -228,13 +228,13 @@ public class FluidStorageBusPart extends SharedStorageBusPart
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final CompoundNBT data) {
|
||||
public void readFromNBT(final CompoundTag data) {
|
||||
super.readFromNBT(data);
|
||||
this.config.readFromNBT(data, "config");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(final CompoundNBT data) {
|
||||
public void writeToNBT(final CompoundTag data) {
|
||||
super.writeToNBT(data);
|
||||
this.config.writeToNBT(data, "config");
|
||||
}
|
||||
|
||||
@@ -20,14 +20,14 @@ package appeng.fluids.parts;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
@@ -67,7 +67,7 @@ public abstract class SharedFluidBusPart extends UpgradeablePart implements IGri
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborChanged(IBlockReader w, BlockPos pos, BlockPos neighbor) {
|
||||
public void onNeighborChanged(BlockView w, BlockPos pos, BlockPos neighbor) {
|
||||
this.updateState();
|
||||
if (this.lastRedstone != this.getHost().hasRedstone(this.getSide())) {
|
||||
this.lastRedstone = !this.lastRedstone;
|
||||
@@ -138,13 +138,13 @@ public abstract class SharedFluidBusPart extends UpgradeablePart implements IGri
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(CompoundNBT extra) {
|
||||
public void readFromNBT(CompoundTag extra) {
|
||||
super.readFromNBT(extra);
|
||||
this.config.readFromNBT(extra, "config");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(CompoundNBT extra) {
|
||||
public void writeToNBT(CompoundTag extra) {
|
||||
super.writeToNBT(extra);
|
||||
this.config.writeToNBT(extra, "config");
|
||||
}
|
||||
|
||||
@@ -24,10 +24,10 @@ import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
@@ -95,14 +95,14 @@ public class FluidInterfaceTileEntity extends AENetworkTileEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundNBT write(final CompoundNBT data) {
|
||||
public CompoundTag write(final CompoundTag data) {
|
||||
super.write(data);
|
||||
this.duality.writeToNBT(data);
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(final CompoundNBT data) {
|
||||
public void read(final CompoundTag data) {
|
||||
super.read(data);
|
||||
this.duality.readFromNBT(data);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.Objects;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
@@ -266,16 +266,16 @@ public class AEFluidInventory implements IAEFluidTank {
|
||||
return stack;
|
||||
}
|
||||
|
||||
public void writeToNBT(final CompoundNBT data, final String name) {
|
||||
final CompoundNBT c = new CompoundNBT();
|
||||
public void writeToNBT(final CompoundTag data, final String name) {
|
||||
final CompoundTag c = new CompoundTag();
|
||||
this.writeToNBT(c);
|
||||
data.put(name, c);
|
||||
}
|
||||
|
||||
private void writeToNBT(final CompoundNBT target) {
|
||||
private void writeToNBT(final CompoundTag target) {
|
||||
for (int x = 0; x < this.fluids.length; x++) {
|
||||
try {
|
||||
final CompoundNBT c = new CompoundNBT();
|
||||
final CompoundTag c = new CompoundTag();
|
||||
|
||||
if (this.fluids[x] != null) {
|
||||
this.fluids[x].writeToNBT(c);
|
||||
@@ -287,17 +287,17 @@ public class AEFluidInventory implements IAEFluidTank {
|
||||
}
|
||||
}
|
||||
|
||||
public void readFromNBT(final CompoundNBT data, final String name) {
|
||||
final CompoundNBT c = data.getCompound(name);
|
||||
public void readFromNBT(final CompoundTag data, final String name) {
|
||||
final CompoundTag c = data.getCompound(name);
|
||||
if (!c.isEmpty()) {
|
||||
this.readFromNBT(c);
|
||||
}
|
||||
}
|
||||
|
||||
private void readFromNBT(final CompoundNBT target) {
|
||||
private void readFromNBT(final CompoundTag target) {
|
||||
for (int x = 0; x < this.fluids.length; x++) {
|
||||
try {
|
||||
final CompoundNBT c = target.getCompound("#" + x);
|
||||
final CompoundTag c = target.getCompound("#" + x);
|
||||
|
||||
if (!c.isEmpty()) {
|
||||
this.fluids[x] = AEFluidStack.fromNBT(c);
|
||||
|
||||
@@ -27,7 +27,7 @@ import net.minecraft.fluid.EmptyFluid;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
@@ -51,7 +51,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
|
||||
private static final String NBT_FLUID_TAG = "ft";
|
||||
|
||||
private final Fluid fluid;
|
||||
private CompoundNBT tagCompound;
|
||||
private CompoundTag tagCompound;
|
||||
|
||||
private AEFluidStack(final AEFluidStack fluidStack) {
|
||||
this.fluid = fluidStack.fluid;
|
||||
@@ -66,7 +66,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
|
||||
}
|
||||
}
|
||||
|
||||
private AEFluidStack(@Nonnull Fluid fluid, long amount, @Nullable CompoundNBT tag) {
|
||||
private AEFluidStack(@Nonnull Fluid fluid, long amount, @Nullable CompoundTag tag) {
|
||||
if (fluid == Fluids.EMPTY) {
|
||||
System.out.println();
|
||||
}
|
||||
@@ -88,21 +88,21 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
|
||||
}
|
||||
|
||||
long amount = input.getAmount();
|
||||
CompoundNBT tag = null;
|
||||
CompoundTag tag = null;
|
||||
if (input.getTag() != null) {
|
||||
tag = input.getTag().copy();
|
||||
}
|
||||
return new AEFluidStack(fluid, amount, tag);
|
||||
}
|
||||
|
||||
public static IAEFluidStack fromNBT(final CompoundNBT data) {
|
||||
public static IAEFluidStack fromNBT(final CompoundTag data) {
|
||||
ResourceLocation fluidId = new ResourceLocation(data.getString(NBT_FLUID_ID));
|
||||
Fluid fluid = ForgeRegistries.FLUIDS.getValue(fluidId);
|
||||
if (fluid == null || fluid == Fluids.EMPTY) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CompoundNBT tag = null;
|
||||
CompoundTag tag = null;
|
||||
if (data.contains(NBT_FLUID_TAG, Constants.NBT.TAG_COMPOUND)) {
|
||||
tag = data.getCompound(NBT_FLUID_TAG);
|
||||
}
|
||||
@@ -126,7 +126,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(final CompoundNBT data) {
|
||||
public void writeToNBT(final CompoundTag data) {
|
||||
data.putString(NBT_FLUID_ID, this.fluid.getRegistryName().toString());
|
||||
if (this.hasTagCompound()) {
|
||||
data.put(NBT_FLUID_TAG, this.tagCompound);
|
||||
|
||||
Reference in New Issue
Block a user