Migrate mappings, 1888 errors to go
This commit is contained in:
parent
b0c7a733c7
commit
9520a3e607
83 changed files with 407 additions and 408 deletions
|
@ -29,7 +29,7 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.NbtHelper;
|
||||
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
|
||||
import net.minecraft.text.LiteralText;
|
||||
|
@ -122,20 +122,20 @@ public class CableBlockEntity extends BlockEntity
|
|||
|
||||
// BlockEntity
|
||||
@Override
|
||||
public CompoundTag toInitialChunkDataTag() {
|
||||
return toTag(new CompoundTag());
|
||||
public NbtCompound toInitialChunkDataNbt() {
|
||||
return writeNbt(new NbtCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockEntityUpdateS2CPacket toUpdatePacket() {
|
||||
CompoundTag nbtTag = new CompoundTag();
|
||||
toTag(nbtTag);
|
||||
NbtCompound nbtTag = new NbtCompound();
|
||||
writeNbt(nbtTag);
|
||||
return new BlockEntityUpdateS2CPacket(getPos(), 1, nbtTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromTag(BlockState blockState, CompoundTag compound) {
|
||||
super.fromTag(blockState, compound);
|
||||
public void readNbt(BlockState blockState, NbtCompound compound) {
|
||||
super.readNbt(blockState, compound);
|
||||
if (compound.contains("energy")) {
|
||||
energy = compound.getDouble("energy");
|
||||
}
|
||||
|
@ -147,8 +147,8 @@ public class CableBlockEntity extends BlockEntity
|
|||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag toTag(CompoundTag compound) {
|
||||
super.toTag(compound);
|
||||
public NbtCompound writeNbt(NbtCompound compound) {
|
||||
super.writeNbt(compound);
|
||||
compound.putDouble("energy", energy);
|
||||
if (cover != null) {
|
||||
compound.put("cover", NbtHelper.fromBlockState(cover));
|
||||
|
|
|
@ -27,7 +27,7 @@ package techreborn.blockentity.generator;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import reborncore.api.IToolDrop;
|
||||
|
@ -167,14 +167,14 @@ public abstract class BaseFluidGeneratorBlockEntity extends PowerAcceptorBlockEn
|
|||
}
|
||||
|
||||
@Override
|
||||
public void fromTag(BlockState blockState, CompoundTag tagCompound) {
|
||||
super.fromTag(blockState, tagCompound);
|
||||
public void readNbt(BlockState blockState, NbtCompound tagCompound) {
|
||||
super.readNbt(blockState, tagCompound);
|
||||
tank.read(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag toTag(CompoundTag tagCompound) {
|
||||
super.toTag(tagCompound);
|
||||
public NbtCompound writeNbt(NbtCompound tagCompound) {
|
||||
super.writeNbt(tagCompound);
|
||||
tank.write(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
|
@ -264,13 +264,13 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
|
|||
}
|
||||
|
||||
@Override
|
||||
public void fromTag(BlockState blockState, CompoundTag tag) {
|
||||
public void readNbt(BlockState blockState, NbtCompound tag) {
|
||||
if (world == null) {
|
||||
// We are in BlockEntity.create method during chunk load.
|
||||
this.checkOverfill = false;
|
||||
}
|
||||
updatePanel();
|
||||
super.fromTag(blockState, tag);
|
||||
super.readNbt(blockState, tag);
|
||||
}
|
||||
|
||||
// MachineBaseBlockEntity
|
||||
|
|
|
@ -30,7 +30,7 @@ import net.minecraft.block.entity.AbstractFurnaceBlockEntity;
|
|||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.blockentity.InventoryProvider;
|
||||
import reborncore.common.blockentity.MachineBaseBlockEntity;
|
||||
|
@ -132,16 +132,16 @@ public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEnt
|
|||
|
||||
// MachineBaseBlockEntity
|
||||
@Override
|
||||
public void fromTag(BlockState blockState, CompoundTag compoundTag) {
|
||||
super.fromTag(blockState, compoundTag);
|
||||
public void readNbt(BlockState blockState, NbtCompound compoundTag) {
|
||||
super.readNbt(blockState, compoundTag);
|
||||
burnTime = compoundTag.getInt("BurnTime");
|
||||
totalBurnTime = compoundTag.getInt("TotalBurnTime");
|
||||
progress = compoundTag.getInt("Progress");
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag toTag(CompoundTag compoundTag) {
|
||||
super.toTag(compoundTag);
|
||||
public NbtCompound writeNbt(NbtCompound compoundTag) {
|
||||
super.writeNbt(compoundTag);
|
||||
compoundTag.putInt("BurnTime", burnTime);
|
||||
compoundTag.putInt("TotalBurnTime", totalBurnTime);
|
||||
compoundTag.putInt("Progress", progress);
|
||||
|
|
|
@ -28,7 +28,7 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.entity.ExperienceOrbEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.recipe.AbstractCookingRecipe;
|
||||
import net.minecraft.recipe.Recipe;
|
||||
import net.minecraft.recipe.RecipeType;
|
||||
|
@ -143,14 +143,14 @@ public class IronFurnaceBlockEntity extends AbstractIronMachineBlockEntity imple
|
|||
}
|
||||
|
||||
@Override
|
||||
public void fromTag(BlockState blockState, CompoundTag compoundTag) {
|
||||
super.fromTag(blockState, compoundTag);
|
||||
public void readNbt(BlockState blockState, NbtCompound compoundTag) {
|
||||
super.readNbt(blockState, compoundTag);
|
||||
experience = compoundTag.getFloat("Experience");
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag toTag(CompoundTag compoundTag) {
|
||||
super.toTag(compoundTag);
|
||||
public NbtCompound writeNbt(NbtCompound compoundTag) {
|
||||
super.writeNbt(compoundTag);
|
||||
compoundTag.putFloat("Experience", experience);
|
||||
return compoundTag;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.util.Formatting;
|
||||
|
@ -66,20 +66,20 @@ public class AlarmBlockEntity extends BlockEntity
|
|||
|
||||
// BlockEntity
|
||||
@Override
|
||||
public CompoundTag toTag(CompoundTag compound) {
|
||||
public NbtCompound writeNbt(NbtCompound compound) {
|
||||
if (compound == null) {
|
||||
compound = new CompoundTag();
|
||||
compound = new NbtCompound();
|
||||
}
|
||||
compound.putInt("selectedSound", this.selectedSound);
|
||||
return super.toTag(compound);
|
||||
return super.writeNbt(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromTag(BlockState blockState, CompoundTag compound) {
|
||||
public void readNbt(BlockState blockState, NbtCompound compound) {
|
||||
if (compound != null && compound.contains("selectedSound")) {
|
||||
selectedSound = compound.getInt("selectedSound");
|
||||
}
|
||||
super.fromTag(blockState, compound);
|
||||
super.readNbt(blockState, compound);
|
||||
}
|
||||
|
||||
// Tickable
|
||||
|
|
|
@ -27,7 +27,7 @@ package techreborn.blockentity.machine.multiblock;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.client.screen.BuiltScreenHandlerProvider;
|
||||
import reborncore.client.screen.builder.BuiltScreenHandler;
|
||||
|
@ -99,14 +99,14 @@ public class FluidReplicatorBlockEntity extends GenericMachineBlockEntity implem
|
|||
|
||||
// TilePowerAcceptor
|
||||
@Override
|
||||
public void fromTag(BlockState blockState, final CompoundTag tagCompound) {
|
||||
super.fromTag(blockState, tagCompound);
|
||||
public void readNbt(BlockState blockState, final NbtCompound tagCompound) {
|
||||
super.readNbt(blockState, tagCompound);
|
||||
tank.read(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag toTag(final CompoundTag tagCompound) {
|
||||
super.toTag(tagCompound);
|
||||
public NbtCompound writeNbt(final NbtCompound tagCompound) {
|
||||
super.writeNbt(tagCompound);
|
||||
tank.write(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ package techreborn.blockentity.machine.multiblock;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
@ -352,8 +352,8 @@ public class FusionControlComputerBlockEntity extends GenericMachineBlockEntity
|
|||
}
|
||||
|
||||
@Override
|
||||
public void fromTag(BlockState blockState, final CompoundTag tagCompound) {
|
||||
super.fromTag(blockState, tagCompound);
|
||||
public void readNbt(BlockState blockState, final NbtCompound tagCompound) {
|
||||
super.readNbt(blockState, tagCompound);
|
||||
this.craftingTickTime = tagCompound.getInt("craftingTickTime");
|
||||
this.neededPower = tagCompound.getInt("neededPower");
|
||||
this.hasStartedCrafting = tagCompound.getBoolean("hasStartedCrafting");
|
||||
|
@ -368,8 +368,8 @@ public class FusionControlComputerBlockEntity extends GenericMachineBlockEntity
|
|||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag toTag(final CompoundTag tagCompound) {
|
||||
super.toTag(tagCompound);
|
||||
public NbtCompound writeNbt(final NbtCompound tagCompound) {
|
||||
super.writeNbt(tagCompound);
|
||||
tagCompound.putInt("craftingTickTime", this.craftingTickTime);
|
||||
tagCompound.putInt("neededPower", this.neededPower);
|
||||
tagCompound.putBoolean("hasStartedCrafting", this.hasStartedCrafting);
|
||||
|
|
|
@ -28,7 +28,7 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.client.screen.BuiltScreenHandlerProvider;
|
||||
import reborncore.client.screen.builder.BuiltScreenHandler;
|
||||
|
@ -93,14 +93,14 @@ public class IndustrialGrinderBlockEntity extends GenericMachineBlockEntity impl
|
|||
}
|
||||
|
||||
@Override
|
||||
public void fromTag(BlockState blockState, final CompoundTag tagCompound) {
|
||||
super.fromTag(blockState, tagCompound);
|
||||
public void readNbt(BlockState blockState, final NbtCompound tagCompound) {
|
||||
super.readNbt(blockState, tagCompound);
|
||||
tank.read(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag toTag(final CompoundTag tagCompound) {
|
||||
super.toTag(tagCompound);
|
||||
public NbtCompound writeNbt(final NbtCompound tagCompound) {
|
||||
super.writeNbt(tagCompound);
|
||||
tank.write(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.client.screen.BuiltScreenHandlerProvider;
|
||||
import reborncore.client.screen.builder.BuiltScreenHandler;
|
||||
|
@ -95,14 +95,14 @@ public class IndustrialSawmillBlockEntity extends GenericMachineBlockEntity impl
|
|||
|
||||
// TilePowerAcceptor
|
||||
@Override
|
||||
public void fromTag(BlockState blockState, final CompoundTag tagCompound) {
|
||||
super.fromTag(blockState, tagCompound);
|
||||
public void readNbt(BlockState blockState, final NbtCompound tagCompound) {
|
||||
super.readNbt(blockState, tagCompound);
|
||||
tank.read(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag toTag(final CompoundTag tagCompound) {
|
||||
super.toTag(tagCompound);
|
||||
public NbtCompound writeNbt(final NbtCompound tagCompound) {
|
||||
super.writeNbt(tagCompound);
|
||||
tank.write(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.recipe.CraftingRecipe;
|
||||
import net.minecraft.recipe.Ingredient;
|
||||
import net.minecraft.recipe.RecipeType;
|
||||
|
@ -162,7 +162,7 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
|
|||
|
||||
if (!hasOutputSpace(recipe.getOutput(), OUTPUT_SLOT)) return false;
|
||||
|
||||
DefaultedList<ItemStack> remainingStacks = recipe.getRemainingStacks(crafting);
|
||||
DefaultedList<ItemStack> remainingStacks = recipe.getRemainder(crafting);
|
||||
for (ItemStack stack : remainingStacks){
|
||||
if (!stack.isEmpty() && !hasRoomForExtraItem(stack)) return false;
|
||||
}
|
||||
|
@ -193,8 +193,8 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
|
|||
if (recipe == null || !canMake(recipe)) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < recipe.getPreviewInputs().size(); i++) {
|
||||
DefaultedList<Ingredient> ingredients = recipe.getPreviewInputs();
|
||||
for (int i = 0; i < recipe.getIngredients().size(); i++) {
|
||||
DefaultedList<Ingredient> ingredients = recipe.getIngredients();
|
||||
Ingredient ingredient = ingredients.get(i);
|
||||
// Looks for the best slot to take it from
|
||||
ItemStack bestSlot = inventory.getStack(i);
|
||||
|
@ -267,13 +267,13 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
|
|||
return Optional.empty();
|
||||
}
|
||||
List<Integer> possibleSlots = new ArrayList<>();
|
||||
for (int s = 0; s < currentRecipe.getPreviewInputs().size(); s++) {
|
||||
for (int s = 0; s < currentRecipe.getIngredients().size(); s++) {
|
||||
for (int i = 0; i < 9; i++) {
|
||||
if (possibleSlots.contains(i)) {
|
||||
continue;
|
||||
}
|
||||
ItemStack stackInSlot = inventory.getStack(i);
|
||||
Ingredient ingredient = currentRecipe.getPreviewInputs().get(s);
|
||||
Ingredient ingredient = currentRecipe.getIngredients().get(s);
|
||||
if (ingredient != Ingredient.EMPTY && ingredient.test(sourceStack)) {
|
||||
if (stackInSlot.getItem() == sourceStack.getItem()) {
|
||||
possibleSlots.add(i);
|
||||
|
@ -405,17 +405,17 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
|
|||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag toTag(CompoundTag tag) {
|
||||
public NbtCompound writeNbt(NbtCompound tag) {
|
||||
tag.putBoolean("locked", locked);
|
||||
return super.toTag(tag);
|
||||
return super.writeNbt(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromTag(BlockState blockState, CompoundTag tag) {
|
||||
public void readNbt(BlockState blockState, NbtCompound tag) {
|
||||
if (tag.contains("locked")) {
|
||||
locked = tag.getBoolean("locked");
|
||||
}
|
||||
super.fromTag(blockState, tag);
|
||||
super.readNbt(blockState, tag);
|
||||
}
|
||||
|
||||
// MachineBaseBlockEntity
|
||||
|
|
|
@ -27,7 +27,7 @@ package techreborn.blockentity.machine.tier1;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.common.powerSystem.PowerAcceptorBlockEntity;
|
||||
import reborncore.common.util.WorldUtils;
|
||||
|
@ -117,14 +117,14 @@ public class PlayerDectectorBlockEntity extends PowerAcceptorBlockEntity impleme
|
|||
}
|
||||
|
||||
@Override
|
||||
public void fromTag(BlockState blockState, CompoundTag tag) {
|
||||
super.fromTag(blockState, tag);
|
||||
public void readNbt(BlockState blockState, NbtCompound tag) {
|
||||
super.readNbt(blockState, tag);
|
||||
owenerUdid = tag.getString("ownerID");
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag toTag(CompoundTag tag) {
|
||||
super.toTag(tag);
|
||||
public NbtCompound writeNbt(NbtCompound tag) {
|
||||
super.writeNbt(tag);
|
||||
tag.putString("ownerID", owenerUdid);
|
||||
return tag;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ import net.minecraft.block.entity.HopperBlockEntity;
|
|||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
@ -141,15 +141,15 @@ public class ResinBasinBlockEntity extends MachineBaseBlockEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag toTag(CompoundTag tagCompound) {
|
||||
super.toTag(tagCompound);
|
||||
public NbtCompound writeNbt(NbtCompound tagCompound) {
|
||||
super.writeNbt(tagCompound);
|
||||
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromTag(BlockState blockState, CompoundTag tagCompound) {
|
||||
super.fromTag(blockState, tagCompound);
|
||||
public void readNbt(BlockState blockState, NbtCompound tagCompound) {
|
||||
super.readNbt(blockState, tagCompound);
|
||||
|
||||
this.isFull = blockState.get(ResinBasinBlock.FULL);
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.recipe.Ingredient;
|
||||
import net.minecraft.screen.ScreenHandler;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -206,9 +206,9 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity
|
|||
return Optional.empty();
|
||||
}
|
||||
List<Integer> possibleSlots = new ArrayList<>();
|
||||
for (int s = 0; s < currentRecipe.getPreviewInputs().size(); s++) {
|
||||
for (int s = 0; s < currentRecipe.getIngredients().size(); s++) {
|
||||
ItemStack stackInSlot = inventory.getStack(s);
|
||||
Ingredient ingredient = currentRecipe.getPreviewInputs().get(s);
|
||||
Ingredient ingredient = currentRecipe.getIngredients().get(s);
|
||||
if (ingredient != Ingredient.EMPTY && ingredient.test(sourceStack)) {
|
||||
if (stackInSlot.isEmpty()) {
|
||||
possibleSlots.add(s);
|
||||
|
@ -343,16 +343,16 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity
|
|||
}
|
||||
|
||||
@Override
|
||||
public void fromTag(BlockState blockState, final CompoundTag tagCompound) {
|
||||
super.fromTag(blockState, tagCompound);
|
||||
public void readNbt(BlockState blockState, final NbtCompound tagCompound) {
|
||||
super.readNbt(blockState, tagCompound);
|
||||
this.isRunning = tagCompound.getBoolean("isRunning");
|
||||
this.tickTime = tagCompound.getInt("tickTime");
|
||||
this.locked = tagCompound.getBoolean("locked");
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag toTag(final CompoundTag tagCompound) {
|
||||
super.toTag(tagCompound);
|
||||
public NbtCompound writeNbt(final NbtCompound tagCompound) {
|
||||
super.writeNbt(tagCompound);
|
||||
tagCompound.putBoolean("isRunning", this.isRunning);
|
||||
tagCompound.putInt("tickTime", this.tickTime);
|
||||
tagCompound.putBoolean("locked", locked);
|
||||
|
|
|
@ -28,7 +28,7 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
|
@ -124,8 +124,8 @@ public class ChunkLoaderBlockEntity extends MachineBaseBlockEntity implements IT
|
|||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag toTag(CompoundTag tagCompound) {
|
||||
super.toTag(tagCompound);
|
||||
public NbtCompound writeNbt(NbtCompound tagCompound) {
|
||||
super.writeNbt(tagCompound);
|
||||
tagCompound.putInt("radius", radius);
|
||||
if (ownerUdid != null && !ownerUdid.isEmpty()){
|
||||
tagCompound.putString("ownerUdid", ownerUdid);
|
||||
|
@ -135,8 +135,8 @@ public class ChunkLoaderBlockEntity extends MachineBaseBlockEntity implements IT
|
|||
}
|
||||
|
||||
@Override
|
||||
public void fromTag(BlockState blockState, CompoundTag nbttagcompound) {
|
||||
super.fromTag(blockState, nbttagcompound);
|
||||
public void readNbt(BlockState blockState, NbtCompound nbttagcompound) {
|
||||
super.readNbt(blockState, nbttagcompound);
|
||||
this.radius = nbttagcompound.getInt("radius");
|
||||
this.ownerUdid = nbttagcompound.getString("ownerUdid");
|
||||
if (!StringUtils.isBlank(ownerUdid)) {
|
||||
|
|
|
@ -27,7 +27,7 @@ package techreborn.blockentity.storage.energy;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import reborncore.api.blockentity.IUpgrade;
|
||||
import reborncore.client.screen.BuiltScreenHandlerProvider;
|
||||
import reborncore.client.screen.builder.BuiltScreenHandler;
|
||||
|
@ -76,10 +76,10 @@ public class AdjustableSUBlockEntity extends EnergyStorageBlockEntity implements
|
|||
}
|
||||
|
||||
public ItemStack getDropWithNBT() {
|
||||
CompoundTag blockEntity = new CompoundTag();
|
||||
NbtCompound blockEntity = new NbtCompound();
|
||||
ItemStack dropStack = TRContent.Machine.ADJUSTABLE_SU.getStack();
|
||||
toTag(blockEntity);
|
||||
dropStack.setTag(new CompoundTag());
|
||||
writeNbt(blockEntity);
|
||||
dropStack.setTag(new NbtCompound());
|
||||
dropStack.getOrCreateTag().put("blockEntity", blockEntity);
|
||||
return dropStack;
|
||||
}
|
||||
|
@ -137,15 +137,15 @@ public class AdjustableSUBlockEntity extends EnergyStorageBlockEntity implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag toTag(CompoundTag tagCompound) {
|
||||
super.toTag(tagCompound);
|
||||
public NbtCompound writeNbt(NbtCompound tagCompound) {
|
||||
super.writeNbt(tagCompound);
|
||||
tagCompound.putInt("output", OUTPUT);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromTag(BlockState blockState, CompoundTag nbttagcompound) {
|
||||
super.fromTag(blockState, nbttagcompound);
|
||||
public void readNbt(BlockState blockState, NbtCompound nbttagcompound) {
|
||||
super.readNbt(blockState, nbttagcompound);
|
||||
this.OUTPUT = nbttagcompound.getInt("output");
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.blockentity.storage.energy.idsu;
|
||||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.world.PersistentState;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -59,14 +59,14 @@ public class IDSUManager extends PersistentState {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void fromTag(CompoundTag tag) {
|
||||
public void fromNbt(NbtCompound tag) {
|
||||
for (String uuid : tag.getKeys()) {
|
||||
playerHashMap.put(uuid, new IDSUPlayer(tag.getCompound(uuid)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag toTag(CompoundTag tag) {
|
||||
public NbtCompound writeNbt(NbtCompound tag) {
|
||||
playerHashMap.forEach((uuid, player) -> tag.put(uuid, player.write()));
|
||||
return tag;
|
||||
}
|
||||
|
@ -78,20 +78,20 @@ public class IDSUManager extends PersistentState {
|
|||
private IDSUPlayer() {
|
||||
}
|
||||
|
||||
private IDSUPlayer(CompoundTag compoundTag) {
|
||||
private IDSUPlayer(NbtCompound compoundTag) {
|
||||
read(compoundTag);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CompoundTag write() {
|
||||
CompoundTag tag = new CompoundTag();
|
||||
public NbtCompound write() {
|
||||
NbtCompound tag = new NbtCompound();
|
||||
tag.putDouble("energy", energy);
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull CompoundTag tag) {
|
||||
public void read(@NotNull NbtCompound tag) {
|
||||
energy = tag.getDouble("energy");
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ package techreborn.blockentity.storage.energy.idsu;
|
|||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import reborncore.client.screen.BuiltScreenHandlerProvider;
|
||||
import reborncore.client.screen.builder.BuiltScreenHandler;
|
||||
|
@ -96,14 +96,14 @@ public class InterdimensionalSUBlockEntity extends EnergyStorageBlockEntity impl
|
|||
}
|
||||
|
||||
@Override
|
||||
public void fromTag(BlockState blockState, CompoundTag nbttagcompound) {
|
||||
super.fromTag(blockState, nbttagcompound);
|
||||
public void readNbt(BlockState blockState, NbtCompound nbttagcompound) {
|
||||
super.readNbt(blockState, nbttagcompound);
|
||||
this.ownerUdid = nbttagcompound.getString("ownerUdid");
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag toTag(CompoundTag nbttagcompound) {
|
||||
super.toTag(nbttagcompound);
|
||||
public NbtCompound writeNbt(NbtCompound nbttagcompound) {
|
||||
super.writeNbt(nbttagcompound);
|
||||
if (ownerUdid == null || StringUtils.isEmpty(ownerUdid)) {
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ package techreborn.blockentity.storage.fluid;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
|
@ -76,9 +76,9 @@ public class TankUnitBaseBlockEntity extends MachineBaseBlockEntity implements I
|
|||
|
||||
public ItemStack getDropWithNBT() {
|
||||
ItemStack dropStack = new ItemStack(getBlockType(), 1);
|
||||
final CompoundTag blockEntity = new CompoundTag();
|
||||
this.toTag(blockEntity);
|
||||
dropStack.setTag(new CompoundTag());
|
||||
final NbtCompound blockEntity = new NbtCompound();
|
||||
this.writeNbt(blockEntity);
|
||||
dropStack.setTag(new NbtCompound());
|
||||
dropStack.getOrCreateTag().put("blockEntity", blockEntity);
|
||||
return dropStack;
|
||||
}
|
||||
|
@ -115,8 +115,8 @@ public class TankUnitBaseBlockEntity extends MachineBaseBlockEntity implements I
|
|||
}
|
||||
|
||||
@Override
|
||||
public void fromTag(BlockState blockState, final CompoundTag tagCompound) {
|
||||
super.fromTag(blockState, tagCompound);
|
||||
public void readNbt(BlockState blockState, final NbtCompound tagCompound) {
|
||||
super.readNbt(blockState, tagCompound);
|
||||
if (tagCompound.contains("unitType")) {
|
||||
this.type = TRContent.TankUnit.valueOf(tagCompound.getString("unitType"));
|
||||
configureEntity(type);
|
||||
|
@ -125,8 +125,8 @@ public class TankUnitBaseBlockEntity extends MachineBaseBlockEntity implements I
|
|||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag toTag(final CompoundTag tagCompound) {
|
||||
super.toTag(tagCompound);
|
||||
public NbtCompound writeNbt(final NbtCompound tagCompound) {
|
||||
super.writeNbt(tagCompound);
|
||||
tagCompound.putString("unitType", this.type.name());
|
||||
tank.write(tagCompound);
|
||||
return tagCompound;
|
||||
|
|
|
@ -28,7 +28,7 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
|
@ -285,8 +285,8 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implement
|
|||
}
|
||||
|
||||
@Override
|
||||
public void fromTag(BlockState blockState, CompoundTag tagCompound) {
|
||||
super.fromTag(blockState, tagCompound);
|
||||
public void readNbt(BlockState blockState, NbtCompound tagCompound) {
|
||||
super.readNbt(blockState, tagCompound);
|
||||
|
||||
if (tagCompound.contains("unitType")) {
|
||||
this.type = TRContent.StorageUnit.valueOf(tagCompound.getString("unitType"));
|
||||
|
@ -298,7 +298,7 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implement
|
|||
storeItemStack = ItemStack.EMPTY;
|
||||
|
||||
if (tagCompound.contains("storedStack")) {
|
||||
storeItemStack = ItemStack.fromTag(tagCompound.getCompound("storedStack"));
|
||||
storeItemStack = ItemStack.fromNbt(tagCompound.getCompound("storedStack"));
|
||||
}
|
||||
|
||||
if (!storeItemStack.isEmpty()) {
|
||||
|
@ -311,15 +311,15 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implement
|
|||
}
|
||||
|
||||
if (tagCompound.contains("lockedItem")) {
|
||||
lockedItemStack = ItemStack.fromTag(tagCompound.getCompound("lockedItem"));
|
||||
lockedItemStack = ItemStack.fromNbt(tagCompound.getCompound("lockedItem"));
|
||||
}
|
||||
|
||||
inventory.read(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag toTag(CompoundTag tagCompound) {
|
||||
super.toTag(tagCompound);
|
||||
public NbtCompound writeNbt(NbtCompound tagCompound) {
|
||||
super.writeNbt(tagCompound);
|
||||
|
||||
tagCompound.putString("unitType", this.type.name());
|
||||
|
||||
|
@ -328,7 +328,7 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implement
|
|||
if (storeItemStack.getCount() > storeItemStack.getMaxCount()) {
|
||||
temp.setCount(storeItemStack.getMaxCount());
|
||||
}
|
||||
tagCompound.put("storedStack", temp.toTag(new CompoundTag()));
|
||||
tagCompound.put("storedStack", temp.writeNbt(new NbtCompound()));
|
||||
tagCompound.putInt("storedQuantity", Math.min(storeItemStack.getCount(), maxCapacity));
|
||||
} else {
|
||||
tagCompound.putInt("storedQuantity", 0);
|
||||
|
@ -338,7 +338,7 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implement
|
|||
tagCompound.putInt("totalStoredAmount", getCurrentCapacity());
|
||||
|
||||
if (isLocked()) {
|
||||
tagCompound.put("lockedItem", lockedItemStack.toTag(new CompoundTag()));
|
||||
tagCompound.put("lockedItem", lockedItemStack.writeNbt(new NbtCompound()));
|
||||
}
|
||||
|
||||
inventory.write(tagCompound);
|
||||
|
@ -408,10 +408,10 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implement
|
|||
@Override
|
||||
public ItemStack getToolDrop(PlayerEntity entityPlayer) {
|
||||
ItemStack dropStack = new ItemStack(getBlockType(), 1);
|
||||
final CompoundTag blockEntity = new CompoundTag();
|
||||
final NbtCompound blockEntity = new NbtCompound();
|
||||
|
||||
this.toTag(blockEntity);
|
||||
dropStack.setTag(new CompoundTag());
|
||||
this.writeNbt(blockEntity);
|
||||
dropStack.setTag(new NbtCompound());
|
||||
dropStack.getOrCreateTag().put("blockEntity", blockEntity);
|
||||
|
||||
return dropStack;
|
||||
|
@ -492,13 +492,13 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implement
|
|||
this.serverCapacity = maxCapacity;
|
||||
}
|
||||
|
||||
public CompoundTag getStoredStackNBT() {
|
||||
CompoundTag tag = new CompoundTag();
|
||||
getStoredStack().toTag(tag);
|
||||
public NbtCompound getStoredStackNBT() {
|
||||
NbtCompound tag = new NbtCompound();
|
||||
getStoredStack().writeNbt(tag);
|
||||
return tag;
|
||||
}
|
||||
|
||||
public void setStoredStackFromNBT(CompoundTag tag) {
|
||||
storeItemStack = ItemStack.fromTag(tag);
|
||||
public void setStoredStackFromNBT(NbtCompound tag) {
|
||||
storeItemStack = ItemStack.fromNbt(tag);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue