Migrate mappings, 1888 errors to go
This commit is contained in:
parent
b0c7a733c7
commit
9520a3e607
83 changed files with 407 additions and 408 deletions
|
@ -28,8 +28,8 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||
import net.minecraft.inventory.Inventories;
|
||||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.NbtElement;
|
||||
import net.minecraft.util.collection.DefaultedList;
|
||||
|
||||
public abstract class InventoryBase implements Inventory {
|
||||
|
@ -42,15 +42,15 @@ public abstract class InventoryBase implements Inventory {
|
|||
stacks = DefaultedList.ofSize(size, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
public Tag serializeNBT() {
|
||||
CompoundTag tag = new CompoundTag();
|
||||
Inventories.toTag(tag, stacks);
|
||||
public NbtElement serializeNBT() {
|
||||
NbtCompound tag = new NbtCompound();
|
||||
Inventories.writeNbt(tag, stacks);
|
||||
return tag;
|
||||
}
|
||||
|
||||
public void deserializeNBT(CompoundTag tag) {
|
||||
public void deserializeNBT(NbtCompound tag) {
|
||||
stacks = DefaultedList.ofSize(size, ItemStack.EMPTY);
|
||||
Inventories.fromTag(tag, stacks);
|
||||
Inventories.readNbt(tag, stacks);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -35,9 +35,9 @@ import net.minecraft.client.render.entity.feature.FeatureRendererContext;
|
|||
import net.minecraft.client.render.entity.model.EntityModel;
|
||||
import net.minecraft.client.render.entity.model.PlayerEntityModel;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.client.util.math.Vector3f;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import reborncore.common.RebornCoreConfig;
|
||||
import reborncore.common.util.CalenderUtils;
|
||||
|
||||
|
@ -74,8 +74,8 @@ public class HolidayRenderManager {
|
|||
float yaw = player.prevYaw + (player.yaw - player.prevYaw) * tickDelta - (player.prevBodyYaw + (player.bodyYaw - player.prevBodyYaw) * tickDelta);
|
||||
float pitch = player.prevPitch + (player.pitch - player.prevPitch) * tickDelta;
|
||||
|
||||
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(yaw));
|
||||
matrixStack.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(pitch));
|
||||
matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(yaw));
|
||||
matrixStack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(pitch));
|
||||
santaHat.render(matrixStack, vertexConsumer, i, LivingEntityRenderer.getOverlay(player, 0.0F), 1F, 1F, 1F, 1F);
|
||||
matrixStack.pop();
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ import net.minecraft.client.item.TooltipContext;
|
|||
import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.MutableText;
|
||||
import net.minecraft.text.Text;
|
||||
|
@ -109,9 +109,9 @@ public class StackToolTipHandler implements ItemTooltipCallback {
|
|||
BlockEntity blockEntity = ((BlockEntityProvider) block).createBlockEntity(MinecraftClient.getInstance().world);
|
||||
boolean hasData = false;
|
||||
if (itemStack.hasTag() && itemStack.getOrCreateTag().contains("blockEntity_data")) {
|
||||
CompoundTag blockEntityData = itemStack.getOrCreateTag().getCompound("blockEntity_data");
|
||||
NbtCompound blockEntityData = itemStack.getOrCreateTag().getCompound("blockEntity_data");
|
||||
if (blockEntity != null) {
|
||||
blockEntity.fromTag(block.getDefaultState(), blockEntityData);
|
||||
blockEntity.readNbt(block.getDefaultState(), blockEntityData);
|
||||
hasData = true;
|
||||
tooltipLines.add(new LiteralText(I18n.translate("reborncore.tooltip.has_data")).formatted(Formatting.DARK_GREEN));
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ public class GuiButtonCustomTexture extends ButtonWidget {
|
|||
if (this.visible) {
|
||||
boolean flag = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width
|
||||
&& mouseY < this.y + this.height;
|
||||
mc.getTextureManager().bindTexture(WIDGETS_LOCATION);
|
||||
mc.getTextureManager().bindTexture(WIDGETS_TEXTURE);
|
||||
int u = textureU;
|
||||
int v = textureV;
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ public class GuiButtonItemTexture extends ButtonWidget {
|
|||
MinecraftClient mc = MinecraftClient.getInstance();
|
||||
boolean flag = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width
|
||||
&& mouseY < this.y + this.height;
|
||||
mc.getTextureManager().bindTexture(WIDGETS_LOCATION);
|
||||
mc.getTextureManager().bindTexture(WIDGETS_TEXTURE);
|
||||
int u = textureU;
|
||||
int v = textureV;
|
||||
if (flag) {
|
||||
|
|
|
@ -31,7 +31,7 @@ import net.minecraft.block.entity.BlockEntity;
|
|||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
||||
import net.minecraft.client.gui.widget.AbstractButtonWidget;
|
||||
import net.minecraft.client.gui.widget.ClickableWidget;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
@ -277,7 +277,7 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
|
|||
offset += 24;
|
||||
}
|
||||
|
||||
for (AbstractButtonWidget abstractButtonWidget : buttons) {
|
||||
for (ClickableWidget abstractButtonWidget : buttons) {
|
||||
if (abstractButtonWidget.isHovered()) {
|
||||
abstractButtonWidget.renderToolTip(matrixStack, mouseX, mouseY);
|
||||
break;
|
||||
|
|
|
@ -35,11 +35,11 @@ import net.minecraft.client.render.block.BlockRenderManager;
|
|||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.client.util.math.Vector3f;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Quaternion;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.RebornCore;
|
||||
import reborncore.client.gui.GuiUtil;
|
||||
|
@ -76,12 +76,12 @@ public class FluidConfigPopupElement extends ElementBase {
|
|||
BlockRenderManager dispatcher = MinecraftClient.getInstance().getBlockRenderManager();
|
||||
BakedModel model = dispatcher.getModels().getModel(state.getBlock().getDefaultState());
|
||||
MinecraftClient.getInstance().getTextureManager().bindTexture(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE);
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 4, 23, Vector3f.POSITIVE_Y.getDegreesQuaternion(90F)); //left
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 23, 4, Vector3f.NEGATIVE_X.getDegreesQuaternion(90F)); //top
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 4, 23, Vec3f.POSITIVE_Y.getDegreesQuaternion(90F)); //left
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 23, 4, Vec3f.NEGATIVE_X.getDegreesQuaternion(90F)); //top
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 23, 23, null); //centre
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 23, 26, Vector3f.POSITIVE_X.getDegreesQuaternion(90F)); //bottom
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 42, 23, Vector3f.POSITIVE_Y.getDegreesQuaternion(90F)); //right
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 26, 42, Vector3f.POSITIVE_Y.getDegreesQuaternion(180F)); //back
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 23, 26, Vec3f.POSITIVE_X.getDegreesQuaternion(90F)); //bottom
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 42, 23, Vec3f.POSITIVE_Y.getDegreesQuaternion(90F)); //right
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 26, 42, Vec3f.POSITIVE_Y.getDegreesQuaternion(180F)); //back
|
||||
|
||||
drawSateColor(gui.getMachine(), MachineFacing.UP.getFacing(machine), 22, -1, gui);
|
||||
drawSateColor(gui.getMachine(), MachineFacing.FRONT.getFacing(machine), 22, 18, gui);
|
||||
|
|
|
@ -35,11 +35,11 @@ import net.minecraft.client.render.block.BlockRenderManager;
|
|||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.client.util.math.Vector3f;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Quaternion;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.RebornCore;
|
||||
import reborncore.client.gui.GuiUtil;
|
||||
|
@ -80,12 +80,12 @@ public class SlotConfigPopupElement extends ElementBase {
|
|||
BlockRenderManager dispatcher = MinecraftClient.getInstance().getBlockRenderManager();
|
||||
BakedModel model = dispatcher.getModels().getModel(state.getBlock().getDefaultState());
|
||||
MinecraftClient.getInstance().getTextureManager().bindTexture(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE);
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 4, 23, Vector3f.POSITIVE_Y.getDegreesQuaternion(90F)); //left
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 23, 4, Vector3f.NEGATIVE_X.getDegreesQuaternion(90F)); //top
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 4, 23, Vec3f.POSITIVE_Y.getDegreesQuaternion(90F)); //left
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 23, 4, Vec3f.NEGATIVE_X.getDegreesQuaternion(90F)); //top
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 23, 23, null); //centre
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 23, 26, Vector3f.POSITIVE_X.getDegreesQuaternion(90F)); //bottom
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 42, 23, Vector3f.POSITIVE_Y.getDegreesQuaternion(90F)); //right
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 26, 42, Vector3f.POSITIVE_Y.getDegreesQuaternion(180F)); //back
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 23, 26, Vec3f.POSITIVE_X.getDegreesQuaternion(90F)); //bottom
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 42, 23, Vec3f.POSITIVE_Y.getDegreesQuaternion(90F)); //right
|
||||
drawState(gui, world, model, actualState, pos, dispatcher, 26, 42, Vec3f.POSITIVE_Y.getDegreesQuaternion(180F)); //back
|
||||
|
||||
drawSlotSateColor(gui.getMachine(), MachineFacing.UP.getFacing(machine), id, 22, -1, gui);
|
||||
drawSlotSateColor(gui.getMachine(), MachineFacing.FRONT.getFacing(machine), id, 22, 18, gui);
|
||||
|
|
|
@ -48,7 +48,7 @@ public class GuiHiddenButton extends ButtonWidget {
|
|||
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
|
||||
if (this.visible) {
|
||||
TextRenderer fontrenderer = MinecraftClient.getInstance().textRenderer;
|
||||
MinecraftClient.getInstance().getTextureManager().bindTexture(WIDGETS_LOCATION);
|
||||
MinecraftClient.getInstance().getTextureManager().bindTexture(WIDGETS_TEXTURE);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.hovered = mouseX >= this.x && mouseY >= this.y
|
||||
&& mouseX < this.x + this.width && mouseY < this.y + this.height;
|
||||
|
|
|
@ -31,9 +31,9 @@ import net.minecraft.block.entity.BlockEntity;
|
|||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.NbtElement;
|
||||
import net.minecraft.nbt.NbtOps;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import org.apache.commons.lang3.Range;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import reborncore.RebornCore;
|
||||
|
@ -155,11 +155,11 @@ public class BlockEntityScreenHandlerBuilder {
|
|||
|
||||
public <T> BlockEntityScreenHandlerBuilder sync(Codec<T> codec) {
|
||||
return sync(() -> {
|
||||
DataResult<Tag> dataResult = codec.encodeStart(NbtOps.INSTANCE, (T) blockEntity);
|
||||
DataResult<NbtElement> dataResult = codec.encodeStart(NbtOps.INSTANCE, (T) blockEntity);
|
||||
if (dataResult.error().isPresent()) {
|
||||
throw new RuntimeException("Failed to encode: " + dataResult.error().get().message() + " " + blockEntity);
|
||||
} else {
|
||||
return (CompoundTag) dataResult.result().get();
|
||||
return (NbtCompound) dataResult.result().get();
|
||||
}
|
||||
}, compoundTag -> {
|
||||
DataResult<T> dataResult = codec.parse(NbtOps.INSTANCE, compoundTag);
|
||||
|
|
|
@ -258,7 +258,7 @@ public class BuiltScreenHandler extends ScreenHandler implements ExtendedScreenH
|
|||
}
|
||||
}
|
||||
|
||||
slot.onStackChanged(stackInSlot, originalStack);
|
||||
slot.onQuickTransfer(stackInSlot, originalStack);
|
||||
if (stackInSlot.getCount() <= 0) {
|
||||
slot.setStack(ItemStack.EMPTY);
|
||||
} else {
|
||||
|
|
|
@ -30,7 +30,7 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.util.collection.DefaultedList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -48,10 +48,10 @@ public abstract class BaseBlockEntityProvider extends Block implements BlockEnti
|
|||
return Optional.empty();
|
||||
}
|
||||
ItemStack newStack = stack.copy();
|
||||
CompoundTag blockEntityData = blockEntity.toTag(new CompoundTag());
|
||||
NbtCompound blockEntityData = blockEntity.writeNbt(new NbtCompound());
|
||||
stripLocationData(blockEntityData);
|
||||
if (!newStack.hasTag()) {
|
||||
newStack.setTag(new CompoundTag());
|
||||
newStack.setTag(new NbtCompound());
|
||||
}
|
||||
newStack.getTag().put("blockEntity_data", blockEntityData);
|
||||
return Optional.of(newStack);
|
||||
|
@ -61,20 +61,20 @@ public abstract class BaseBlockEntityProvider extends Block implements BlockEnti
|
|||
public void onPlaced(World worldIn, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) {
|
||||
if (stack.hasTag() && stack.getTag().contains("blockEntity_data")) {
|
||||
BlockEntity blockEntity = worldIn.getBlockEntity(pos);
|
||||
CompoundTag nbt = stack.getTag().getCompound("blockEntity_data");
|
||||
NbtCompound nbt = stack.getTag().getCompound("blockEntity_data");
|
||||
injectLocationData(nbt, pos);
|
||||
blockEntity.fromTag(state, nbt);
|
||||
blockEntity.readNbt(state, nbt);
|
||||
blockEntity.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
private void stripLocationData(CompoundTag compound) {
|
||||
private void stripLocationData(NbtCompound compound) {
|
||||
compound.remove("x");
|
||||
compound.remove("y");
|
||||
compound.remove("z");
|
||||
}
|
||||
|
||||
private void injectLocationData(CompoundTag compound, BlockPos pos) {
|
||||
private void injectLocationData(NbtCompound compound, BlockPos pos) {
|
||||
compound.putInt("x", pos.getX());
|
||||
compound.putInt("y", pos.getY());
|
||||
compound.putInt("z", pos.getZ());
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
package reborncore.common.blockentity;
|
||||
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.common.fluid.FluidUtil;
|
||||
|
@ -48,7 +48,7 @@ public class FluidConfiguration implements NBTSerializable {
|
|||
Arrays.stream(Direction.values()).forEach(facing -> sideMap.put(facing, new FluidConfig(facing)));
|
||||
}
|
||||
|
||||
public FluidConfiguration(CompoundTag tagCompound) {
|
||||
public FluidConfiguration(NbtCompound tagCompound) {
|
||||
sideMap = new HashMap<>();
|
||||
read(tagCompound);
|
||||
}
|
||||
|
@ -119,8 +119,8 @@ public class FluidConfiguration implements NBTSerializable {
|
|||
|
||||
@NotNull
|
||||
@Override
|
||||
public CompoundTag write() {
|
||||
CompoundTag compound = new CompoundTag();
|
||||
public NbtCompound write() {
|
||||
NbtCompound compound = new NbtCompound();
|
||||
Arrays.stream(Direction.values()).forEach(facing -> compound.put("side_" + facing.ordinal(), sideMap.get(facing).write()));
|
||||
compound.putBoolean("input", input);
|
||||
compound.putBoolean("output", output);
|
||||
|
@ -128,10 +128,10 @@ public class FluidConfiguration implements NBTSerializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull CompoundTag nbt) {
|
||||
public void read(@NotNull NbtCompound nbt) {
|
||||
sideMap.clear();
|
||||
Arrays.stream(Direction.values()).forEach(facing -> {
|
||||
CompoundTag compound = nbt.getCompound("side_" + facing.ordinal());
|
||||
NbtCompound compound = nbt.getCompound("side_" + facing.ordinal());
|
||||
FluidConfig config = new FluidConfig(compound);
|
||||
sideMap.put(facing, config);
|
||||
});
|
||||
|
@ -153,7 +153,7 @@ public class FluidConfiguration implements NBTSerializable {
|
|||
this.ioConfig = ioConfig;
|
||||
}
|
||||
|
||||
public FluidConfig(CompoundTag tagCompound) {
|
||||
public FluidConfig(NbtCompound tagCompound) {
|
||||
read(tagCompound);
|
||||
}
|
||||
|
||||
|
@ -167,15 +167,15 @@ public class FluidConfiguration implements NBTSerializable {
|
|||
|
||||
@NotNull
|
||||
@Override
|
||||
public CompoundTag write() {
|
||||
CompoundTag tagCompound = new CompoundTag();
|
||||
public NbtCompound write() {
|
||||
NbtCompound tagCompound = new NbtCompound();
|
||||
tagCompound.putInt("side", side.ordinal());
|
||||
tagCompound.putInt("config", ioConfig.ordinal());
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull CompoundTag nbt) {
|
||||
public void read(@NotNull NbtCompound nbt) {
|
||||
side = Direction.values()[nbt.getInt("side")];
|
||||
ioConfig = FluidConfiguration.ExtractConfig.values()[nbt.getInt("config")];
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.inventory.SidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.text.LiteralText;
|
||||
|
@ -129,13 +129,13 @@ public class MachineBaseBlockEntity extends BlockEntity implements Tickable, IUp
|
|||
@Nullable
|
||||
@Override
|
||||
public BlockEntityUpdateS2CPacket toUpdatePacket() {
|
||||
return new BlockEntityUpdateS2CPacket(getPos(), 0, toInitialChunkDataTag());
|
||||
return new BlockEntityUpdateS2CPacket(getPos(), 0, toInitialChunkDataNbt());
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag toInitialChunkDataTag() {
|
||||
CompoundTag compound = super.toTag(new CompoundTag());
|
||||
toTag(compound);
|
||||
public NbtCompound toInitialChunkDataNbt() {
|
||||
NbtCompound compound = super.writeNbt(new NbtCompound());
|
||||
writeNbt(compound);
|
||||
return compound;
|
||||
}
|
||||
|
||||
|
@ -232,8 +232,8 @@ public class MachineBaseBlockEntity extends BlockEntity implements Tickable, IUp
|
|||
}
|
||||
|
||||
@Override
|
||||
public void fromTag(BlockState blockState, CompoundTag tagCompound) {
|
||||
super.fromTag(blockState, tagCompound);
|
||||
public void readNbt(BlockState blockState, NbtCompound tagCompound) {
|
||||
super.readNbt(blockState, tagCompound);
|
||||
if (getOptionalInventory().isPresent()) {
|
||||
getOptionalInventory().get().read(tagCompound);
|
||||
}
|
||||
|
@ -258,8 +258,8 @@ public class MachineBaseBlockEntity extends BlockEntity implements Tickable, IUp
|
|||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag toTag(CompoundTag tagCompound) {
|
||||
super.toTag(tagCompound);
|
||||
public NbtCompound writeNbt(NbtCompound tagCompound) {
|
||||
super.writeNbt(tagCompound);
|
||||
if (getOptionalInventory().isPresent()) {
|
||||
getOptionalInventory().get().write(tagCompound);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ package reborncore.common.blockentity;
|
|||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
@ -147,8 +147,8 @@ public class RedstoneConfiguration implements NBTSerializable, Syncable {
|
|||
|
||||
@NotNull
|
||||
@Override
|
||||
public CompoundTag write() {
|
||||
CompoundTag tag = new CompoundTag();
|
||||
public NbtCompound write() {
|
||||
NbtCompound tag = new NbtCompound();
|
||||
for (Element element : getElements()) {
|
||||
tag.putInt(element.getName(), getState(element).ordinal());
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ public class RedstoneConfiguration implements NBTSerializable, Syncable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull CompoundTag tag) {
|
||||
public void read(@NotNull NbtCompound tag) {
|
||||
stateMap = new HashMap<>();
|
||||
for (String key : tag.getKeys()) {
|
||||
Element element = ELEMENT_MAP.get(key);
|
||||
|
@ -178,7 +178,7 @@ public class RedstoneConfiguration implements NBTSerializable, Syncable {
|
|||
|
||||
@Override
|
||||
public void getSyncPair(List<Pair<Supplier, Consumer>> pairList) {
|
||||
pairList.add(Pair.of(this::write, (Consumer<CompoundTag>) this::read));
|
||||
pairList.add(Pair.of(this::write, (Consumer<NbtCompound>) this::read));
|
||||
}
|
||||
|
||||
public static Element getElementByName(String name) {
|
||||
|
|
|
@ -31,7 +31,7 @@ import it.unimi.dsi.fastutil.ints.IntLists;
|
|||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.inventory.SidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.StringNbtReader;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
|
@ -80,7 +80,7 @@ public class SlotConfiguration implements NBTSerializable {
|
|||
}
|
||||
}
|
||||
|
||||
public SlotConfiguration(CompoundTag tagCompound) {
|
||||
public SlotConfiguration(NbtCompound tagCompound) {
|
||||
read(tagCompound);
|
||||
}
|
||||
|
||||
|
@ -119,8 +119,8 @@ public class SlotConfiguration implements NBTSerializable {
|
|||
|
||||
@NotNull
|
||||
@Override
|
||||
public CompoundTag write() {
|
||||
CompoundTag tagCompound = new CompoundTag();
|
||||
public NbtCompound write() {
|
||||
NbtCompound tagCompound = new NbtCompound();
|
||||
tagCompound.putInt("size", slotDetails.size());
|
||||
for (int i = 0; i < slotDetails.size(); i++) {
|
||||
tagCompound.put("slot_" + i, slotDetails.get(i).write());
|
||||
|
@ -129,10 +129,10 @@ public class SlotConfiguration implements NBTSerializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull CompoundTag nbt) {
|
||||
public void read(@NotNull NbtCompound nbt) {
|
||||
int size = nbt.getInt("size");
|
||||
for (int i = 0; i < size; i++) {
|
||||
CompoundTag tagCompound = nbt.getCompound("slot_" + i);
|
||||
NbtCompound tagCompound = nbt.getCompound("slot_" + i);
|
||||
SlotConfigHolder slotConfigHolder = new SlotConfigHolder(tagCompound);
|
||||
updateSlotDetails(slotConfigHolder);
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ public class SlotConfiguration implements NBTSerializable {
|
|||
Arrays.stream(Direction.values()).forEach(facing -> sideMap.put(facing, new SlotConfig(facing, slotID)));
|
||||
}
|
||||
|
||||
public SlotConfigHolder(CompoundTag tagCompound) {
|
||||
public SlotConfigHolder(NbtCompound tagCompound) {
|
||||
sideMap = new HashMap<>();
|
||||
read(tagCompound);
|
||||
Validate.isTrue(Arrays.stream(Direction.values())
|
||||
|
@ -218,8 +218,8 @@ public class SlotConfiguration implements NBTSerializable {
|
|||
|
||||
@NotNull
|
||||
@Override
|
||||
public CompoundTag write() {
|
||||
CompoundTag compound = new CompoundTag();
|
||||
public NbtCompound write() {
|
||||
NbtCompound compound = new NbtCompound();
|
||||
compound.putInt("slotID", slotID);
|
||||
Arrays.stream(Direction.values()).forEach(facing -> compound.put("side_" + facing.ordinal(), sideMap.get(facing).write()));
|
||||
compound.putBoolean("input", input);
|
||||
|
@ -229,11 +229,11 @@ public class SlotConfiguration implements NBTSerializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull CompoundTag nbt) {
|
||||
public void read(@NotNull NbtCompound nbt) {
|
||||
sideMap.clear();
|
||||
slotID = nbt.getInt("slotID");
|
||||
Arrays.stream(Direction.values()).forEach(facing -> {
|
||||
CompoundTag compound = nbt.getCompound("side_" + facing.ordinal());
|
||||
NbtCompound compound = nbt.getCompound("side_" + facing.ordinal());
|
||||
SlotConfig config = new SlotConfig(compound);
|
||||
sideMap.put(facing, config);
|
||||
});
|
||||
|
@ -264,7 +264,7 @@ public class SlotConfiguration implements NBTSerializable {
|
|||
this.slotID = slotID;
|
||||
}
|
||||
|
||||
public SlotConfig(CompoundTag tagCompound) {
|
||||
public SlotConfig(NbtCompound tagCompound) {
|
||||
read(tagCompound);
|
||||
Validate.notNull(side, "error when loading slot config");
|
||||
Validate.notNull(slotIO, "error when loading slot config");
|
||||
|
@ -358,8 +358,8 @@ public class SlotConfiguration implements NBTSerializable {
|
|||
|
||||
@NotNull
|
||||
@Override
|
||||
public CompoundTag write() {
|
||||
CompoundTag tagCompound = new CompoundTag();
|
||||
public NbtCompound write() {
|
||||
NbtCompound tagCompound = new NbtCompound();
|
||||
tagCompound.putInt("side", side.ordinal());
|
||||
tagCompound.put("config", slotIO.write());
|
||||
tagCompound.putInt("slot", slotID);
|
||||
|
@ -367,7 +367,7 @@ public class SlotConfiguration implements NBTSerializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull CompoundTag nbt) {
|
||||
public void read(@NotNull NbtCompound nbt) {
|
||||
side = Direction.values()[nbt.getInt("side")];
|
||||
slotIO = new SlotIO(nbt.getCompound("config"));
|
||||
slotID = nbt.getInt("slot");
|
||||
|
@ -377,7 +377,7 @@ public class SlotConfiguration implements NBTSerializable {
|
|||
public static class SlotIO implements NBTSerializable {
|
||||
ExtractConfig ioConfig;
|
||||
|
||||
public SlotIO(CompoundTag tagCompound) {
|
||||
public SlotIO(NbtCompound tagCompound) {
|
||||
read(tagCompound);
|
||||
}
|
||||
|
||||
|
@ -391,14 +391,14 @@ public class SlotConfiguration implements NBTSerializable {
|
|||
|
||||
@NotNull
|
||||
@Override
|
||||
public CompoundTag write() {
|
||||
CompoundTag compound = new CompoundTag();
|
||||
public NbtCompound write() {
|
||||
NbtCompound compound = new NbtCompound();
|
||||
compound.putInt("config", ioConfig.ordinal());
|
||||
return compound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(@NotNull CompoundTag nbt) {
|
||||
public void read(@NotNull NbtCompound nbt) {
|
||||
ioConfig = ExtractConfig.values()[nbt.getInt("config")];
|
||||
}
|
||||
}
|
||||
|
@ -434,14 +434,14 @@ public class SlotConfiguration implements NBTSerializable {
|
|||
}
|
||||
|
||||
public String toJson(String machineIdent) {
|
||||
CompoundTag tagCompound = new CompoundTag();
|
||||
NbtCompound tagCompound = new NbtCompound();
|
||||
tagCompound.put("data", write());
|
||||
tagCompound.putString("machine", machineIdent);
|
||||
return tagCompound.toString();
|
||||
}
|
||||
|
||||
public void readJson(String json, String machineIdent) throws UnsupportedOperationException {
|
||||
CompoundTag compound;
|
||||
NbtCompound compound;
|
||||
try {
|
||||
compound = StringNbtReader.parse(json);
|
||||
} catch (CommandSyntaxException e) {
|
||||
|
|
|
@ -26,7 +26,7 @@ package reborncore.common.chunkloading;
|
|||
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.NbtOps;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.server.world.ChunkTicketType;
|
||||
|
@ -68,7 +68,7 @@ public class ChunkLoaderManager extends PersistentState {
|
|||
private final List<LoadedChunk> loadedChunks = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void fromTag(CompoundTag tag) {
|
||||
public void fromNbt(NbtCompound tag) {
|
||||
loadedChunks.clear();
|
||||
|
||||
List<LoadedChunk> chunks = CODEC.parse(NbtOps.INSTANCE, tag.getCompound("loadedchunks"))
|
||||
|
@ -79,7 +79,7 @@ public class ChunkLoaderManager extends PersistentState {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag toTag(CompoundTag compoundTag) {
|
||||
public NbtCompound writeNbt(NbtCompound compoundTag) {
|
||||
CODEC.encodeStart(NbtOps.INSTANCE, loadedChunks)
|
||||
.result()
|
||||
.ifPresent(tag -> compoundTag.put("loadedchunks", tag));
|
||||
|
|
|
@ -158,7 +158,7 @@ public class RebornRecipe implements Recipe<Inventory>, CustomOutputRecipe {
|
|||
// use the RebornIngredient version to ensure stack sizes are checked
|
||||
@Deprecated
|
||||
@Override
|
||||
public DefaultedList<Ingredient> getPreviewInputs() {
|
||||
public DefaultedList<Ingredient> getIngredients() {
|
||||
return ingredients.stream().map(RebornIngredient::getPreview).collect(DefaultedListCollector.toList());
|
||||
}
|
||||
|
||||
|
@ -231,7 +231,7 @@ public class RebornRecipe implements Recipe<Inventory>, CustomOutputRecipe {
|
|||
}
|
||||
|
||||
@Override
|
||||
public DefaultedList<ItemStack> getRemainingStacks(Inventory p_179532_1_) {
|
||||
public DefaultedList<ItemStack> getRemainder(Inventory p_179532_1_) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ import com.mojang.serialization.JsonOps;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.NbtOps;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.JsonHelper;
|
||||
|
@ -73,7 +73,7 @@ public class RecipeUtils {
|
|||
}
|
||||
ItemStack stack = new ItemStack(item, count);
|
||||
if (jsonObject.has("nbt")) {
|
||||
CompoundTag tag = (CompoundTag) Dynamic.convert(JsonOps.INSTANCE, NbtOps.INSTANCE, jsonObject.get("nbt"));
|
||||
NbtCompound tag = (NbtCompound) Dynamic.convert(JsonOps.INSTANCE, NbtOps.INSTANCE, jsonObject.get("nbt"));
|
||||
stack.setTag(tag);
|
||||
}
|
||||
return stack;
|
||||
|
|
|
@ -31,7 +31,7 @@ import com.mojang.serialization.Dynamic;
|
|||
import com.mojang.serialization.JsonOps;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.NbtOps;
|
||||
import net.minecraft.recipe.Ingredient;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
@ -49,10 +49,10 @@ public class StackIngredient extends RebornIngredient {
|
|||
private final List<ItemStack> stacks;
|
||||
|
||||
private final Optional<Integer> count;
|
||||
private final Optional<CompoundTag> tag;
|
||||
private final Optional<NbtCompound> tag;
|
||||
private final boolean requireEmptyTag;
|
||||
|
||||
public StackIngredient(List<ItemStack> stacks, Optional<Integer> count, Optional<CompoundTag> tag, boolean requireEmptyTag) {
|
||||
public StackIngredient(List<ItemStack> stacks, Optional<Integer> count, Optional<NbtCompound> tag, boolean requireEmptyTag) {
|
||||
super(IngredientManager.STACK_RECIPE_TYPE);
|
||||
this.stacks = stacks;
|
||||
this.count = count;
|
||||
|
@ -73,7 +73,7 @@ public class StackIngredient extends RebornIngredient {
|
|||
stackSize = Optional.of(JsonHelper.getInt(json, "count"));
|
||||
}
|
||||
|
||||
Optional<CompoundTag> tag = Optional.empty();
|
||||
Optional<NbtCompound> tag = Optional.empty();
|
||||
boolean requireEmptyTag = false;
|
||||
|
||||
if (json.has("nbt")) {
|
||||
|
@ -82,7 +82,7 @@ public class StackIngredient extends RebornIngredient {
|
|||
requireEmptyTag = true;
|
||||
}
|
||||
} else {
|
||||
tag = Optional.of((CompoundTag) Dynamic.convert(JsonOps.INSTANCE, NbtOps.INSTANCE, json.get("nbt")));
|
||||
tag = Optional.of((NbtCompound) Dynamic.convert(JsonOps.INSTANCE, NbtOps.INSTANCE, json.get("nbt")));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,9 +109,9 @@ public class StackIngredient extends RebornIngredient {
|
|||
//Bit of a meme here, as DataFixer likes to use the most basic primative type over using an int.
|
||||
//So we have to go to json and back on the incoming stack to be sure its using types that match our input.
|
||||
|
||||
CompoundTag compoundTag = itemStack.getTag();
|
||||
NbtCompound compoundTag = itemStack.getTag();
|
||||
JsonElement jsonElement = Dynamic.convert(NbtOps.INSTANCE, JsonOps.INSTANCE, compoundTag);
|
||||
compoundTag = (CompoundTag) Dynamic.convert(JsonOps.INSTANCE, NbtOps.INSTANCE, jsonElement);
|
||||
compoundTag = (NbtCompound) Dynamic.convert(JsonOps.INSTANCE, NbtOps.INSTANCE, jsonElement);
|
||||
|
||||
if (!tag.get().equals(compoundTag)) {
|
||||
return false;
|
||||
|
|
|
@ -124,7 +124,7 @@ public abstract class RebornFluid extends FlowableFluid {
|
|||
|
||||
@Override
|
||||
protected BlockState toBlockState(FluidState fluidState) {
|
||||
return fluidBlockSupplier.get().getDefaultState().with(FluidBlock.LEVEL, method_15741(fluidState));
|
||||
return fluidBlockSupplier.get().getDefaultState().with(FluidBlock.LEVEL, getBlockStateLevel(fluidState));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -80,7 +80,7 @@ public class RebornFluidRenderManager implements ClientSpriteRegistryCallback, S
|
|||
}
|
||||
|
||||
@Override
|
||||
public void apply(ResourceManager manager) {
|
||||
public void reload(ResourceManager manager) {
|
||||
//Reset the cached fluid sprites
|
||||
spriteMap.forEach((key, value) -> value.reset());
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ package reborncore.common.fluid.container;
|
|||
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import reborncore.common.fluid.FluidValue;
|
||||
|
@ -41,7 +41,7 @@ public class FluidInstance implements NBTSerializable {
|
|||
|
||||
protected Fluid fluid;
|
||||
protected FluidValue amount;
|
||||
protected CompoundTag tag;
|
||||
protected NbtCompound tag;
|
||||
|
||||
public FluidInstance(Fluid fluid, FluidValue amount) {
|
||||
this.fluid = fluid;
|
||||
|
@ -56,7 +56,7 @@ public class FluidInstance implements NBTSerializable {
|
|||
this(Fluids.EMPTY);
|
||||
}
|
||||
|
||||
public FluidInstance(CompoundTag tag) {
|
||||
public FluidInstance(NbtCompound tag) {
|
||||
this();
|
||||
read(tag);
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ public class FluidInstance implements NBTSerializable {
|
|||
return amount;
|
||||
}
|
||||
|
||||
public CompoundTag getTag() {
|
||||
public NbtCompound getTag() {
|
||||
return tag;
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ public class FluidInstance implements NBTSerializable {
|
|||
return this;
|
||||
}
|
||||
|
||||
public void setTag(CompoundTag tag) {
|
||||
public void setTag(NbtCompound tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
|
@ -110,8 +110,8 @@ public class FluidInstance implements NBTSerializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag write() {
|
||||
CompoundTag tag = new CompoundTag();
|
||||
public NbtCompound write() {
|
||||
NbtCompound tag = new NbtCompound();
|
||||
tag.putString(FLUID_KEY, Registry.FLUID.getId(fluid).toString());
|
||||
tag.putInt(AMOUNT_KEY, amount.getRawValue());
|
||||
if (this.tag != null && !this.tag.isEmpty()) {
|
||||
|
@ -121,7 +121,7 @@ public class FluidInstance implements NBTSerializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void read(CompoundTag tag) {
|
||||
public void read(NbtCompound tag) {
|
||||
fluid = Registry.FLUID.get(new Identifier(tag.getString(FLUID_KEY)));
|
||||
amount = FluidValue.fromRaw(tag.getInt(AMOUNT_KEY));
|
||||
if (tag.contains(TAG_KEY)) {
|
||||
|
|
|
@ -27,7 +27,7 @@ package reborncore.common.multiblock;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import java.util.Set;
|
||||
|
@ -246,7 +246,7 @@ public abstract class IMultiblockPart extends BlockEntity {
|
|||
* @return The part's saved multiblock game-data in NBT format, or null if
|
||||
* there isn't any.
|
||||
*/
|
||||
public abstract CompoundTag getMultiblockSaveData();
|
||||
public abstract NbtCompound getMultiblockSaveData();
|
||||
|
||||
/**
|
||||
* Called after a block is added and the controller has incorporated the
|
||||
|
|
|
@ -27,8 +27,8 @@ package reborncore.common.multiblock;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.Tickable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
@ -50,7 +50,7 @@ public abstract class MultiblockBlockEntityBase extends IMultiblockPart implemen
|
|||
private boolean visited;
|
||||
|
||||
private boolean saveMultiblockData;
|
||||
private CompoundTag cachedMultiblockData;
|
||||
private NbtCompound cachedMultiblockData;
|
||||
//private boolean paused;
|
||||
|
||||
public MultiblockBlockEntityBase(BlockEntityType<?> tBlockEntityType) {
|
||||
|
@ -112,8 +112,8 @@ public abstract class MultiblockBlockEntityBase extends IMultiblockPart implemen
|
|||
// /// Overrides from base BlockEntity methods
|
||||
|
||||
@Override
|
||||
public void fromTag(BlockState blockState, CompoundTag data) {
|
||||
super.fromTag(blockState, data);
|
||||
public void readNbt(BlockState blockState, NbtCompound data) {
|
||||
super.readNbt(blockState, data);
|
||||
|
||||
// We can't directly initialize a multiblock controller yet, so we cache
|
||||
// the data here until
|
||||
|
@ -125,11 +125,11 @@ public abstract class MultiblockBlockEntityBase extends IMultiblockPart implemen
|
|||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag toTag(CompoundTag data) {
|
||||
super.toTag(data);
|
||||
public NbtCompound writeNbt(NbtCompound data) {
|
||||
super.writeNbt(data);
|
||||
|
||||
if (isMultiblockSaveDelegate() && isConnected()) {
|
||||
CompoundTag multiblockData = new CompoundTag();
|
||||
NbtCompound multiblockData = new NbtCompound();
|
||||
this.controller.write(multiblockData);
|
||||
data.put("multiblockData", multiblockData);
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ public abstract class MultiblockBlockEntityBase extends IMultiblockPart implemen
|
|||
// Network Communication
|
||||
@Override
|
||||
public BlockEntityUpdateS2CPacket toUpdatePacket() {
|
||||
CompoundTag packetData = new CompoundTag();
|
||||
NbtCompound packetData = new NbtCompound();
|
||||
encodeDescriptionPacket(packetData);
|
||||
return new BlockEntityUpdateS2CPacket(getPos(), 0, packetData);
|
||||
}
|
||||
|
@ -188,9 +188,9 @@ public abstract class MultiblockBlockEntityBase extends IMultiblockPart implemen
|
|||
* @param packetData An NBT compound tag into which you should write your custom
|
||||
* description data.
|
||||
*/
|
||||
protected void encodeDescriptionPacket(CompoundTag packetData) {
|
||||
protected void encodeDescriptionPacket(NbtCompound packetData) {
|
||||
if (this.isMultiblockSaveDelegate() && isConnected()) {
|
||||
CompoundTag tag = new CompoundTag();
|
||||
NbtCompound tag = new NbtCompound();
|
||||
getMultiblockController().formatDescriptionPacket(tag);
|
||||
packetData.put("multiblockData", tag);
|
||||
}
|
||||
|
@ -202,9 +202,9 @@ public abstract class MultiblockBlockEntityBase extends IMultiblockPart implemen
|
|||
*
|
||||
* @param packetData The NBT data from the blockEntity entity's description packet.
|
||||
*/
|
||||
protected void decodeDescriptionPacket(CompoundTag packetData) {
|
||||
protected void decodeDescriptionPacket(NbtCompound packetData) {
|
||||
if (packetData.contains("multiblockData")) {
|
||||
CompoundTag tag = packetData.getCompound("multiblockData");
|
||||
NbtCompound tag = packetData.getCompound("multiblockData");
|
||||
if (isConnected()) {
|
||||
getMultiblockController().decodeDescriptionPacket(tag);
|
||||
} else {
|
||||
|
@ -220,7 +220,7 @@ public abstract class MultiblockBlockEntityBase extends IMultiblockPart implemen
|
|||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag getMultiblockSaveData() {
|
||||
public NbtCompound getMultiblockSaveData() {
|
||||
return this.cachedMultiblockData;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
package reborncore.common.multiblock;
|
||||
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.WorldChunk;
|
||||
|
@ -128,7 +128,7 @@ public abstract class MultiblockControllerBase {
|
|||
* @param part Attached part
|
||||
* @param data The NBT tag containing this controller's data.
|
||||
*/
|
||||
public abstract void onAttachedPartWithMultiblockData(IMultiblockPart part, CompoundTag data);
|
||||
public abstract void onAttachedPartWithMultiblockData(IMultiblockPart part, NbtCompound data);
|
||||
|
||||
/**
|
||||
* Check if a block is being tracked by this machine.
|
||||
|
@ -160,7 +160,7 @@ public abstract class MultiblockControllerBase {
|
|||
this.onBlockAdded(part);
|
||||
|
||||
if (part.hasMultiblockSaveData()) {
|
||||
CompoundTag savedData = part.getMultiblockSaveData();
|
||||
NbtCompound savedData = part.getMultiblockSaveData();
|
||||
onAttachedPartWithMultiblockData(part, savedData);
|
||||
part.onMultiblockDataAssimilated();
|
||||
}
|
||||
|
@ -679,9 +679,9 @@ public abstract class MultiblockControllerBase {
|
|||
return connectedParts.size();
|
||||
}
|
||||
|
||||
public abstract void write(CompoundTag data);
|
||||
public abstract void write(NbtCompound data);
|
||||
|
||||
public abstract void read(CompoundTag data);
|
||||
public abstract void read(NbtCompound data);
|
||||
|
||||
/**
|
||||
* Force this multiblock to recalculate its minimum and maximum coordinates
|
||||
|
@ -746,7 +746,7 @@ public abstract class MultiblockControllerBase {
|
|||
*
|
||||
* @param data A fresh compound tag to write your multiblock data into
|
||||
*/
|
||||
public abstract void formatDescriptionPacket(CompoundTag data);
|
||||
public abstract void formatDescriptionPacket(NbtCompound data);
|
||||
|
||||
/**
|
||||
* Called when the save delegate's blockEntity entity receiving a description
|
||||
|
@ -754,7 +754,7 @@ public abstract class MultiblockControllerBase {
|
|||
*
|
||||
* @param data A compound tag containing multiblock data to import
|
||||
*/
|
||||
public abstract void decodeDescriptionPacket(CompoundTag data);
|
||||
public abstract void decodeDescriptionPacket(NbtCompound data);
|
||||
|
||||
/**
|
||||
* @return True if this controller has no associated blocks, false otherwise
|
||||
|
|
|
@ -30,7 +30,7 @@ import net.minecraft.block.entity.BlockEntity;
|
|||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.screen.ScreenHandler;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -51,13 +51,13 @@ public class ClientBoundPacketHandlers {
|
|||
public static void init() {
|
||||
NetworkManager.registerClientBoundHandler(new Identifier("reborncore", "custom_description"), (client, handler, packetBuffer, responseSender) -> {
|
||||
BlockPos pos = packetBuffer.readBlockPos();
|
||||
CompoundTag tagCompound = packetBuffer.readCompoundTag();
|
||||
NbtCompound tagCompound = packetBuffer.readNbt();
|
||||
client.execute(() -> {
|
||||
World world = MinecraftClient.getInstance().world;
|
||||
if (world.isChunkLoaded(pos)) {
|
||||
BlockEntity blockentity = world.getBlockEntity(pos);
|
||||
if (blockentity != null && tagCompound != null) {
|
||||
blockentity.fromTag(blockentity.getCachedState(), tagCompound);
|
||||
blockentity.readNbt(blockentity.getCachedState(), tagCompound);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -65,7 +65,7 @@ public class ClientBoundPacketHandlers {
|
|||
|
||||
NetworkManager.registerClientBoundHandler(new Identifier("reborncore", "fluid_config_sync"), (client, handler, packetBuffer, responseSender) -> {
|
||||
BlockPos pos = packetBuffer.readBlockPos();
|
||||
CompoundTag compoundTag = packetBuffer.readCompoundTag();
|
||||
NbtCompound compoundTag = packetBuffer.readNbt();
|
||||
|
||||
client.execute(() -> {
|
||||
FluidConfiguration fluidConfiguration = new FluidConfiguration(compoundTag);
|
||||
|
@ -86,7 +86,7 @@ public class ClientBoundPacketHandlers {
|
|||
|
||||
NetworkManager.registerClientBoundHandler(new Identifier("reborncore", "slot_sync"), (client, handler, packetBuffer, responseSender) -> {
|
||||
BlockPos pos = packetBuffer.readBlockPos();
|
||||
CompoundTag compoundTag = packetBuffer.readCompoundTag();
|
||||
NbtCompound compoundTag = packetBuffer.readNbt();
|
||||
|
||||
client.execute(() -> {
|
||||
SlotConfiguration slotConfig = new SlotConfiguration(compoundTag);
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
package reborncore.common.network;
|
||||
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.screen.ScreenHandler;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -38,27 +38,27 @@ import java.util.List;
|
|||
public class ClientBoundPackets {
|
||||
|
||||
public static IdentifiedPacket createCustomDescriptionPacket(BlockEntity blockEntity) {
|
||||
return createCustomDescriptionPacket(blockEntity.getPos(), blockEntity.toTag(new CompoundTag()));
|
||||
return createCustomDescriptionPacket(blockEntity.getPos(), blockEntity.writeNbt(new NbtCompound()));
|
||||
}
|
||||
|
||||
public static IdentifiedPacket createCustomDescriptionPacket(BlockPos blockPos, CompoundTag nbt) {
|
||||
public static IdentifiedPacket createCustomDescriptionPacket(BlockPos blockPos, NbtCompound nbt) {
|
||||
return NetworkManager.createClientBoundPacket(new Identifier("reborncore", "custom_description"), packetBuffer -> {
|
||||
packetBuffer.writeBlockPos(blockPos);
|
||||
packetBuffer.writeCompoundTag(nbt);
|
||||
packetBuffer.writeNbt(nbt);
|
||||
});
|
||||
}
|
||||
|
||||
public static IdentifiedPacket createPacketFluidConfigSync(BlockPos pos, FluidConfiguration fluidConfiguration) {
|
||||
return NetworkManager.createClientBoundPacket(new Identifier("reborncore", "fluid_config_sync"), packetBuffer -> {
|
||||
packetBuffer.writeBlockPos(pos);
|
||||
packetBuffer.writeCompoundTag(fluidConfiguration.write());
|
||||
packetBuffer.writeNbt(fluidConfiguration.write());
|
||||
});
|
||||
}
|
||||
|
||||
public static IdentifiedPacket createPacketSlotSync(BlockPos pos, SlotConfiguration slotConfig) {
|
||||
return NetworkManager.createClientBoundPacket(new Identifier("reborncore", "slot_sync"), packetBuffer -> {
|
||||
packetBuffer.writeBlockPos(pos);
|
||||
packetBuffer.writeCompoundTag(slotConfig.write());
|
||||
packetBuffer.writeNbt(slotConfig.write());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -27,10 +27,10 @@ package reborncore.common.network;
|
|||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.DataResult;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.NbtElement;
|
||||
import net.minecraft.nbt.NbtList;
|
||||
import net.minecraft.nbt.NbtOps;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -74,19 +74,19 @@ public class ExtendedPacketBuffer extends PacketByteBuf {
|
|||
|
||||
// Supports reading and writing list codec's
|
||||
public <T> void writeCodec(Codec<T> codec, T object) {
|
||||
DataResult<Tag> dataResult = codec.encodeStart(NbtOps.INSTANCE, object);
|
||||
DataResult<NbtElement> dataResult = codec.encodeStart(NbtOps.INSTANCE, object);
|
||||
if (dataResult.error().isPresent()) {
|
||||
throw new RuntimeException("Failed to encode: " + dataResult.error().get().message() + " " + object);
|
||||
} else {
|
||||
Tag tag = dataResult.result().get();
|
||||
if (tag instanceof CompoundTag) {
|
||||
NbtElement tag = dataResult.result().get();
|
||||
if (tag instanceof NbtCompound) {
|
||||
writeByte(0);
|
||||
writeCompoundTag((CompoundTag) tag);
|
||||
} else if (tag instanceof ListTag) {
|
||||
writeNbt((NbtCompound) tag);
|
||||
} else if (tag instanceof NbtList) {
|
||||
writeByte(1);
|
||||
CompoundTag compoundTag = new CompoundTag();
|
||||
NbtCompound compoundTag = new NbtCompound();
|
||||
compoundTag.put("tag", tag);
|
||||
writeCompoundTag(compoundTag);
|
||||
writeNbt(compoundTag);
|
||||
} else {
|
||||
throw new RuntimeException("Failed to write: " + tag);
|
||||
}
|
||||
|
@ -95,12 +95,12 @@ public class ExtendedPacketBuffer extends PacketByteBuf {
|
|||
|
||||
public <T> T readCodec(Codec<T> codec) {
|
||||
byte type = readByte();
|
||||
Tag tag = null;
|
||||
NbtElement tag = null;
|
||||
|
||||
if (type == 0) {
|
||||
tag = readCompoundTag();
|
||||
tag = readNbt();
|
||||
} else if (type == 1) {
|
||||
tag = readCompoundTag().get("tag");
|
||||
tag = readNbt().get("tag");
|
||||
} else {
|
||||
throw new RuntimeException("Failed to read codec");
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package reborncore.common.network;
|
||||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -77,9 +77,9 @@ public enum ObjectBufferUtils {
|
|||
return FluidValue.fromRaw(buffer.readInt());
|
||||
}),
|
||||
|
||||
COMPOUND_TAG(CompoundTag.class, (value, buffer) -> {
|
||||
buffer.writeCompoundTag(value);
|
||||
}, PacketByteBuf::readCompoundTag),
|
||||
COMPOUND_TAG(NbtCompound.class, (value, buffer) -> {
|
||||
buffer.writeNbt(value);
|
||||
}, PacketByteBuf::readNbt),
|
||||
|
||||
BIG_INT(BigInteger.class, (pos, buffer) -> {
|
||||
buffer.writeBigInt(pos);
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
package reborncore.common.network;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
@ -43,7 +43,7 @@ public class ServerBoundPackets {
|
|||
public static void init() {
|
||||
NetworkManager.registerServerBoundHandler(new Identifier("reborncore", "fluid_config_save"), (server, player, handler, packetBuffer, responseSender) -> {
|
||||
BlockPos pos = packetBuffer.readBlockPos();
|
||||
CompoundTag compoundTag = packetBuffer.readCompoundTag();
|
||||
NbtCompound compoundTag = packetBuffer.readNbt();
|
||||
|
||||
server.execute(() -> {
|
||||
FluidConfiguration.FluidConfig fluidConfiguration = new FluidConfiguration.FluidConfig(compoundTag);
|
||||
|
@ -63,7 +63,7 @@ public class ServerBoundPackets {
|
|||
|
||||
NetworkManager.registerServerBoundHandler(new Identifier("reborncore", "config_save"), (server, player, handler, packetBuffer, responseSender) -> {
|
||||
BlockPos pos = packetBuffer.readBlockPos();
|
||||
CompoundTag tagCompound = packetBuffer.readCompoundTag();
|
||||
NbtCompound tagCompound = packetBuffer.readNbt();
|
||||
|
||||
server.execute(() -> {
|
||||
MachineBaseBlockEntity legacyMachineBase = (MachineBaseBlockEntity) player.world.getBlockEntity(pos);
|
||||
|
@ -122,7 +122,7 @@ public class ServerBoundPackets {
|
|||
|
||||
NetworkManager.registerServerBoundHandler(new Identifier("reborncore", "slot_save"), (server, player, handler, packetBuffer, responseSender) -> {
|
||||
BlockPos pos = packetBuffer.readBlockPos();
|
||||
CompoundTag compoundTag = packetBuffer.readCompoundTag();
|
||||
NbtCompound compoundTag = packetBuffer.readNbt();
|
||||
|
||||
server.execute(() -> {
|
||||
SlotConfiguration.SlotConfig slotConfig = new SlotConfiguration.SlotConfig(compoundTag);
|
||||
|
@ -168,14 +168,14 @@ public class ServerBoundPackets {
|
|||
public static IdentifiedPacket createPacketFluidConfigSave(BlockPos pos, FluidConfiguration.FluidConfig fluidConfiguration) {
|
||||
return NetworkManager.createServerBoundPacket(new Identifier("reborncore", "fluid_config_save"), packetBuffer -> {
|
||||
packetBuffer.writeBlockPos(pos);
|
||||
packetBuffer.writeCompoundTag(fluidConfiguration.write());
|
||||
packetBuffer.writeNbt(fluidConfiguration.write());
|
||||
});
|
||||
}
|
||||
|
||||
public static IdentifiedPacket createPacketConfigSave(BlockPos pos, SlotConfiguration slotConfig) {
|
||||
return NetworkManager.createServerBoundPacket(new Identifier("reborncore", "config_save"), packetBuffer -> {
|
||||
packetBuffer.writeBlockPos(pos);
|
||||
packetBuffer.writeCompoundTag(slotConfig.write());
|
||||
packetBuffer.writeNbt(slotConfig.write());
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ public class ServerBoundPackets {
|
|||
public static IdentifiedPacket createPacketSlotSave(BlockPos pos, SlotConfiguration.SlotConfig slotConfig) {
|
||||
return NetworkManager.createServerBoundPacket(new Identifier("reborncore", "slot_save"), packetBuffer -> {
|
||||
packetBuffer.writeBlockPos(pos);
|
||||
packetBuffer.writeCompoundTag(slotConfig.write());
|
||||
packetBuffer.writeNbt(slotConfig.write());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.util.Formatting;
|
||||
|
@ -330,18 +330,18 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
|
|||
}
|
||||
|
||||
@Override
|
||||
public void fromTag(BlockState blockState, CompoundTag tag) {
|
||||
super.fromTag(blockState, tag);
|
||||
CompoundTag data = tag.getCompound("PowerAcceptor");
|
||||
public void readNbt(BlockState blockState, NbtCompound tag) {
|
||||
super.readNbt(blockState, tag);
|
||||
NbtCompound data = tag.getCompound("PowerAcceptor");
|
||||
if (shouldHandleEnergyNBT()) {
|
||||
this.setStored(data.getDouble("energy"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag toTag(CompoundTag tag) {
|
||||
super.toTag(tag);
|
||||
CompoundTag data = new CompoundTag();
|
||||
public NbtCompound writeNbt(NbtCompound tag) {
|
||||
super.writeNbt(tag);
|
||||
NbtCompound data = new NbtCompound();
|
||||
data.putDouble("energy", getStored(EnergySide.UNKNOWN));
|
||||
tag.put("PowerAcceptor", data);
|
||||
return tag;
|
||||
|
|
|
@ -27,7 +27,7 @@ package reborncore.common.recipes;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import reborncore.RebornCore;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
|
@ -291,8 +291,8 @@ public class RecipeCrafter implements IUpgradeHandler {
|
|||
}
|
||||
}
|
||||
|
||||
public void read(CompoundTag tag) {
|
||||
CompoundTag data = tag.getCompound("Crater");
|
||||
public void read(NbtCompound tag) {
|
||||
NbtCompound data = tag.getCompound("Crater");
|
||||
|
||||
if (data.contains("currentTickTime")) {
|
||||
currentTickTime = data.getInt("currentTickTime");
|
||||
|
@ -305,9 +305,9 @@ public class RecipeCrafter implements IUpgradeHandler {
|
|||
}
|
||||
}
|
||||
|
||||
public void write(CompoundTag tag) {
|
||||
public void write(NbtCompound tag) {
|
||||
|
||||
CompoundTag data = new CompoundTag();
|
||||
NbtCompound data = new NbtCompound();
|
||||
|
||||
data.putDouble("currentTickTime", currentTickTime);
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
package reborncore.common.util;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import reborncore.api.items.InventoryBase;
|
||||
|
||||
|
@ -58,30 +58,30 @@ public class InventoryItem extends InventoryBase {
|
|||
return stack;
|
||||
}
|
||||
|
||||
public CompoundTag getInvData() {
|
||||
public NbtCompound getInvData() {
|
||||
Validate.isTrue(!stack.isEmpty());
|
||||
if (!stack.hasTag()) {
|
||||
stack.setTag(new CompoundTag());
|
||||
stack.setTag(new NbtCompound());
|
||||
}
|
||||
if (!stack.getTag().contains("inventory")) {
|
||||
stack.getTag().put("inventory", new CompoundTag());
|
||||
stack.getTag().put("inventory", new NbtCompound());
|
||||
}
|
||||
return stack.getTag().getCompound("inventory");
|
||||
}
|
||||
|
||||
public CompoundTag getSlotData(int slot) {
|
||||
public NbtCompound getSlotData(int slot) {
|
||||
validateSlotIndex(slot);
|
||||
CompoundTag invData = getInvData();
|
||||
NbtCompound invData = getInvData();
|
||||
if (!invData.contains("slot_" + slot)) {
|
||||
invData.put("slot_" + slot, new CompoundTag());
|
||||
invData.put("slot_" + slot, new NbtCompound());
|
||||
}
|
||||
return invData.getCompound("slot_" + slot);
|
||||
}
|
||||
|
||||
public void setSlotData(int slot, CompoundTag tagCompound) {
|
||||
public void setSlotData(int slot, NbtCompound tagCompound) {
|
||||
validateSlotIndex(slot);
|
||||
Validate.notNull(tagCompound);
|
||||
CompoundTag invData = getInvData();
|
||||
NbtCompound invData = getInvData();
|
||||
invData.put("slot_" + slot, tagCompound);
|
||||
}
|
||||
|
||||
|
@ -98,14 +98,14 @@ public class InventoryItem extends InventoryBase {
|
|||
@NotNull
|
||||
@Override
|
||||
public ItemStack getStack(int slot) {
|
||||
return ItemStack.fromTag(getSlotData(slot));
|
||||
return ItemStack.fromNbt(getSlotData(slot));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStack(int slot,
|
||||
@NotNull
|
||||
ItemStack stack) {
|
||||
setSlotData(slot, stack.toTag(new CompoundTag()));
|
||||
setSlotData(slot, stack.writeNbt(new NbtCompound()));
|
||||
}
|
||||
|
||||
public int getSlotLimit(int slot) {
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
package reborncore.common.util;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.NbtList;
|
||||
|
||||
public class ItemNBTHelper {
|
||||
|
||||
|
@ -43,7 +43,7 @@ public class ItemNBTHelper {
|
|||
**/
|
||||
public static void initNBT(ItemStack stack) {
|
||||
if (!detectNBT(stack)) {
|
||||
injectNBT(stack, new CompoundTag());
|
||||
injectNBT(stack, new NbtCompound());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class ItemNBTHelper {
|
|||
* Injects an NBT Tag Compound to an ItemStack, no checks are made
|
||||
* previously
|
||||
**/
|
||||
public static void injectNBT(ItemStack stack, CompoundTag nbt) {
|
||||
public static void injectNBT(ItemStack stack, NbtCompound nbt) {
|
||||
stack.setTag(nbt);
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class ItemNBTHelper {
|
|||
* Gets the NBTTagCompound in an ItemStack. Tries to init it previously in
|
||||
* case there isn't one present
|
||||
**/
|
||||
public static CompoundTag getNBT(ItemStack stack) {
|
||||
public static NbtCompound getNBT(ItemStack stack) {
|
||||
initNBT(stack);
|
||||
return stack.getTag();
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public class ItemNBTHelper {
|
|||
getNBT(stack).putDouble(tag, d);
|
||||
}
|
||||
|
||||
public static void setCompound(ItemStack stack, String tag, CompoundTag cmp) {
|
||||
public static void setCompound(ItemStack stack, String tag, NbtCompound cmp) {
|
||||
if (!tag.equalsIgnoreCase("ench")) // not override the enchantments
|
||||
{
|
||||
getNBT(stack).put(tag, cmp);
|
||||
|
@ -106,7 +106,7 @@ public class ItemNBTHelper {
|
|||
getNBT(stack).putString(tag, s);
|
||||
}
|
||||
|
||||
public static void setList(ItemStack stack, String tag, ListTag list) {
|
||||
public static void setList(ItemStack stack, String tag, NbtList list) {
|
||||
getNBT(stack).put(tag, list);
|
||||
}
|
||||
|
||||
|
@ -149,17 +149,17 @@ public class ItemNBTHelper {
|
|||
* If nullifyOnFail is true it'll return null if it doesn't find any
|
||||
* compounds, otherwise it'll return a new one.
|
||||
**/
|
||||
public static CompoundTag getCompound(ItemStack stack, String tag, boolean nullifyOnFail) {
|
||||
public static NbtCompound getCompound(ItemStack stack, String tag, boolean nullifyOnFail) {
|
||||
return verifyExistance(stack, tag) ? getNBT(stack).getCompound(tag)
|
||||
: nullifyOnFail ? null : new CompoundTag();
|
||||
: nullifyOnFail ? null : new NbtCompound();
|
||||
}
|
||||
|
||||
public static String getString(ItemStack stack, String tag, String defaultExpected) {
|
||||
return verifyExistance(stack, tag) ? getNBT(stack).getString(tag) : defaultExpected;
|
||||
}
|
||||
|
||||
public static ListTag getList(ItemStack stack, String tag, int objtype, boolean nullifyOnFail) {
|
||||
public static NbtList getList(ItemStack stack, String tag, int objtype, boolean nullifyOnFail) {
|
||||
return verifyExistance(stack, tag) ? getNBT(stack).getList(tag, objtype)
|
||||
: nullifyOnFail ? null : new ListTag();
|
||||
: nullifyOnFail ? null : new NbtList();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ package reborncore.common.util;
|
|||
|
||||
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.Text;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.util.Formatting;
|
||||
|
@ -88,18 +88,18 @@ public class ItemUtils {
|
|||
return false;
|
||||
}
|
||||
|
||||
public static void writeItemToNBT(ItemStack stack, CompoundTag data) {
|
||||
public static void writeItemToNBT(ItemStack stack, NbtCompound data) {
|
||||
if (stack.isEmpty() || stack.getCount() <= 0) {
|
||||
return;
|
||||
}
|
||||
if (stack.getCount() > 127) {
|
||||
stack.setCount(127);
|
||||
}
|
||||
stack.toTag(data);
|
||||
stack.writeNbt(data);
|
||||
}
|
||||
|
||||
public static ItemStack readItemFromNBT(CompoundTag data) {
|
||||
return ItemStack.fromTag(data);
|
||||
public static ItemStack readItemFromNBT(NbtCompound data) {
|
||||
return ItemStack.fromNbt(data);
|
||||
}
|
||||
|
||||
public static double getPowerForDurabilityBar(ItemStack stack) {
|
||||
|
|
|
@ -24,15 +24,14 @@
|
|||
|
||||
package reborncore.common.util;
|
||||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface NBTSerializable {
|
||||
|
||||
@NotNull
|
||||
CompoundTag write();
|
||||
NbtCompound write();
|
||||
|
||||
void read(@NotNull CompoundTag tag);
|
||||
void read(@NotNull NbtCompound tag);
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ package reborncore.common.util;
|
|||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import reborncore.api.items.InventoryBase;
|
||||
import reborncore.common.blockentity.MachineBaseBlockEntity;
|
||||
|
@ -105,21 +105,21 @@ public class RebornInventory<T extends MachineBaseBlockEntity> extends Inventory
|
|||
//return externalInventory.withFacing(facing);
|
||||
}
|
||||
|
||||
public void read(CompoundTag data) {
|
||||
public void read(NbtCompound data) {
|
||||
read(data, "Items");
|
||||
}
|
||||
|
||||
public void read(CompoundTag data, String tag) {
|
||||
CompoundTag nbttaglist = data.getCompound(tag);
|
||||
public void read(NbtCompound data, String tag) {
|
||||
NbtCompound nbttaglist = data.getCompound(tag);
|
||||
deserializeNBT(nbttaglist);
|
||||
hasChanged = true;
|
||||
}
|
||||
|
||||
public void write(CompoundTag data) {
|
||||
public void write(NbtCompound data) {
|
||||
write(data, "Items");
|
||||
}
|
||||
|
||||
public void write(CompoundTag data, String tag) {
|
||||
public void write(NbtCompound data, String tag) {
|
||||
data.put(tag, serializeNBT());
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ package reborncore.common.util;
|
|||
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
@ -93,8 +93,8 @@ public class Tank implements GenericFluidContainer<Direction>, Syncable {
|
|||
return !getFluidInstance().isEmpty() && getFluidInstance().getAmount().equalOrMoreThan(getCapacity());
|
||||
}
|
||||
|
||||
public final CompoundTag write(CompoundTag nbt) {
|
||||
CompoundTag tankData = fluidInstance.write();
|
||||
public final NbtCompound write(NbtCompound nbt) {
|
||||
NbtCompound tankData = fluidInstance.write();
|
||||
nbt.put(name, tankData);
|
||||
return nbt;
|
||||
}
|
||||
|
@ -105,12 +105,12 @@ public class Tank implements GenericFluidContainer<Direction>, Syncable {
|
|||
}
|
||||
}
|
||||
|
||||
public final Tank read(CompoundTag nbt) {
|
||||
public final Tank read(NbtCompound nbt) {
|
||||
if (nbt.contains(name)) {
|
||||
// allow to read empty tanks
|
||||
setFluid(Fluids.EMPTY);
|
||||
|
||||
CompoundTag tankData = nbt.getCompound(name);
|
||||
NbtCompound tankData = nbt.getCompound(name);
|
||||
fluidInstance = new FluidInstance(tankData);
|
||||
}
|
||||
return this;
|
||||
|
|
|
@ -27,7 +27,7 @@ package reborncore.common.util.serialization;
|
|||
import com.google.gson.*;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.nbt.StringNbtReader;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
@ -50,7 +50,7 @@ public class ItemStackSerializer implements JsonSerializer<ItemStack>, JsonDeser
|
|||
|
||||
String name = null;
|
||||
int stackSize = 1;
|
||||
CompoundTag tagCompound = null;
|
||||
NbtCompound tagCompound = null;
|
||||
|
||||
if (jsonObject.has(NAME) && jsonObject.get(NAME).isJsonPrimitive()) {
|
||||
name = jsonObject.getAsJsonPrimitive(NAME).getAsString();
|
||||
|
|
|
@ -81,12 +81,12 @@ allprojects {
|
|||
|
||||
// Shared deps between TR and RC
|
||||
dependencies {
|
||||
minecraft "com.mojang:minecraft:1.16.5"
|
||||
mappings "net.fabricmc:yarn:1.16.5+build.4:v2"
|
||||
minecraft "com.mojang:minecraft:1.17-pre1"
|
||||
mappings "net.fabricmc:yarn:1.17-pre1+build.4:v2"
|
||||
modImplementation "net.fabricmc:fabric-loader:0.11.3"
|
||||
|
||||
//Fabric api
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:0.30.0+1.16"
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:0.34.8+1.17"
|
||||
|
||||
modApi 'teamreborn:energy:0.1.1'
|
||||
}
|
||||
|
|
|
@ -97,8 +97,8 @@ public class RollingMachineRecipe extends RebornRecipe {
|
|||
}
|
||||
|
||||
@Override
|
||||
public DefaultedList<Ingredient> getPreviewInputs() {
|
||||
return shapedRecipe.getPreviewInputs();
|
||||
public DefaultedList<Ingredient> getIngredients() {
|
||||
return shapedRecipe.getIngredients();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,15 +27,15 @@ package techreborn.blocks.misc;
|
|||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.FenceBlock;
|
||||
import net.minecraft.block.MapColor;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.MaterialColor;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
public class BlockRefinedIronFence extends FenceBlock {
|
||||
|
||||
public BlockRefinedIronFence() {
|
||||
super(FabricBlockSettings.of(Material.METAL, MaterialColor.WOOD).strength(2.0F, 3.0F).sounds(BlockSoundGroup.METAL));
|
||||
super(FabricBlockSettings.of(Material.METAL, MapColor.OAK_TAN).strength(2.0F, 3.0F).sounds(BlockSoundGroup.METAL));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -66,7 +66,7 @@ public class BlockRubberLog extends PillarBlock {
|
|||
public static BooleanProperty SHOULD_SAP = BooleanProperty.of("shouldsap");
|
||||
|
||||
public BlockRubberLog() {
|
||||
super(Settings.of(Material.WOOD, (blockState) -> MaterialColor.SPRUCE)
|
||||
super(Settings.of(Material.WOOD, (blockState) -> MapColor.SPRUCE_BROWN)
|
||||
.strength(2.0F, 2f)
|
||||
.sounds(BlockSoundGroup.WOOD)
|
||||
.ticksRandomly());
|
||||
|
|
|
@ -100,7 +100,7 @@ public class GuiIronFurnace extends GuiBase<BuiltScreenHandler> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderBg(MatrixStack matrixStack, MinecraftClient mc, int mouseX, int mouseY) {
|
||||
public void renderBackground(MatrixStack matrixStack, MinecraftClient mc, int mouseX, int mouseY) {
|
||||
mc.getItemRenderer().renderInGuiWithOverrides(new ItemStack(Items.EXPERIENCE_BOTTLE), x, y);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
package techreborn.client.keybindings;
|
||||
|
||||
import net.minecraft.client.options.KeyBinding;
|
||||
import net.minecraft.client.option.KeyBinding;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
public class KeyBindings {
|
||||
|
|
|
@ -30,9 +30,9 @@ import net.minecraft.client.render.entity.EntityRenderer;
|
|||
import net.minecraft.client.render.entity.TntMinecartEntityRenderer;
|
||||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.client.util.math.Vector3f;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import techreborn.entities.EntityNukePrimed;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
|
@ -67,7 +67,7 @@ public class NukeRenderer extends EntityRenderer<EntityNukePrimed> {
|
|||
matrixStack.scale(j, j, j);
|
||||
}
|
||||
|
||||
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(-90.0F));
|
||||
matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-90.0F));
|
||||
matrixStack.translate(-0.5D, -0.5D, 0.5D);
|
||||
TntMinecartEntityRenderer.renderFlashingBlock(TRContent.NUKE.getDefaultState(), matrixStack, vertexConsumerProvider, i, entity.getFuseTimer() / 5 % 2 == 0);
|
||||
matrixStack.pop();
|
||||
|
|
|
@ -33,9 +33,9 @@ import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
|
|||
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
|
||||
import net.minecraft.client.render.model.json.ModelTransformation;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.client.util.math.Vector3f;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import techreborn.blockentity.storage.item.StorageUnitBaseBlockEntity;
|
||||
|
||||
/**
|
||||
|
@ -59,7 +59,7 @@ public class StorageUnitRenderer extends BlockEntityRenderer<StorageUnitBaseBloc
|
|||
// Item rendering
|
||||
matrices.push();
|
||||
Direction direction = storage.getFacing();
|
||||
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion((direction.getHorizontal() - 2) * 90F));
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion((direction.getHorizontal() - 2) * 90F));
|
||||
matrices.scale(0.5F, 0.5F, 0.5F);
|
||||
switch (direction) {
|
||||
case NORTH:
|
||||
|
@ -85,7 +85,7 @@ public class StorageUnitRenderer extends BlockEntityRenderer<StorageUnitBaseBloc
|
|||
// Render item only on horizontal facing #2183
|
||||
if (Direction.Type.HORIZONTAL.test(facing) ){
|
||||
matrices.translate(0.5, 0.5, 0.5); // Translate center
|
||||
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(-facing.rotateYCounterclockwise().asRotation() + 90)); // Rotate depending on face
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-facing.rotateYCounterclockwise().asRotation() + 90)); // Rotate depending on face
|
||||
matrices.translate(0, 0, -0.505); // Translate forward
|
||||
}
|
||||
|
||||
|
|
|
@ -33,9 +33,9 @@ import net.minecraft.client.render.WorldRenderer;
|
|||
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.client.util.math.Vector3f;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import techreborn.blockentity.generator.basic.WindMillBlockEntity;
|
||||
|
||||
public class TurbineRenderer extends BlockEntityRenderer<WindMillBlockEntity> {
|
||||
|
@ -55,7 +55,7 @@ public class TurbineRenderer extends BlockEntityRenderer<WindMillBlockEntity> {
|
|||
|
||||
matrixStack.push();
|
||||
matrixStack.translate(0.5, 0, 0.5);
|
||||
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(-facing.rotateYCounterclockwise().asRotation() + 90));
|
||||
matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-facing.rotateYCounterclockwise().asRotation() + 90));
|
||||
matrixStack.translate(0, -1, -0.56);
|
||||
|
||||
float spin = blockEntity.bladeAngle + tickDelta * blockEntity.spinSpeed;
|
||||
|
|
|
@ -100,7 +100,7 @@ public class ModRegistry {
|
|||
RebornRegistry.registerBlock(TRContent.RUBBER_BUTTON = InitUtils.setup(new RubberButtonBlock(), "rubber_button"), itemGroup);
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_PRESSURE_PLATE = InitUtils.setup(new RubberPressurePlateBlock(), "rubber_pressure_plate"), itemGroup);
|
||||
RebornRegistry.registerBlock(TRContent.RUBBER_DOOR = InitUtils.setup(new RubberDoorBlock(), "rubber_door"), itemGroup);
|
||||
RebornRegistry.registerBlockNoItem(TRContent.POTTED_RUBBER_SAPLING = InitUtils.setup(new FlowerPotBlock(TRContent.RUBBER_SAPLING, AbstractBlock.Settings.of(Material.SUPPORTED).breakInstantly().nonOpaque()), "potted_rubber_sapling"));
|
||||
RebornRegistry.registerBlockNoItem(TRContent.POTTED_RUBBER_SAPLING = InitUtils.setup(new FlowerPotBlock(TRContent.RUBBER_SAPLING, AbstractBlock.Settings.of(Material.DECORATION).breakInstantly().nonOpaque()), "potted_rubber_sapling"));
|
||||
|
||||
TechReborn.LOGGER.debug("TechReborns Blocks Loaded");
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public class TRRecipeHandler {
|
|||
if (!recipe.getId().getNamespace().equals(TechReborn.MOD_ID)) {
|
||||
return false;
|
||||
}
|
||||
return recipe.getPreviewInputs().stream().noneMatch(ingredient -> ingredient.test(TRContent.Parts.UU_MATTER.getStack()));
|
||||
return recipe.getIngredients().stream().noneMatch(ingredient -> ingredient.test(TRContent.Parts.UU_MATTER.getStack()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ import net.minecraft.fluid.Fluids;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.sound.SoundEvent;
|
||||
|
@ -231,7 +231,7 @@ public class DynamicCellItem extends Item implements ItemFluidInfo {
|
|||
|
||||
@Override
|
||||
public Fluid getFluid(ItemStack itemStack) {
|
||||
CompoundTag tag = itemStack.getTag();
|
||||
NbtCompound tag = itemStack.getTag();
|
||||
if (tag != null && tag.contains("fluid")) {
|
||||
return Registry.FLUID.get(new Identifier(tag.getString("fluid")));
|
||||
}
|
||||
|
|
|
@ -115,8 +115,8 @@ public class ChainsawItem extends AxeItem implements EnergyHolder, ItemDurabilit
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isEffectiveOn(BlockState state) {
|
||||
return referenceTool.isEffectiveOn(state);
|
||||
public boolean isSuitableFor(BlockState state) {
|
||||
return referenceTool.isSuitableFor(state);
|
||||
}
|
||||
|
||||
// ItemDurabilityExtensions
|
||||
|
|
|
@ -135,7 +135,7 @@ public class DebugToolItem extends Item {
|
|||
MutableText s = new LiteralText("BlockEntity Tags:").formatted(Formatting.GREEN);
|
||||
|
||||
BlockDataObject bdo = new BlockDataObject(blockEntity, blockEntity.getPos());
|
||||
s.append(bdo.getTag().toText());
|
||||
s.append(bdo.getNbt().toText());
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ public class DrillItem extends PickaxeItem implements EnergyHolder, ItemDurabili
|
|||
// Going to remain to use this ol reliable function, the fabric one is funky
|
||||
|
||||
if (Energy.of(stack).getEnergy() >= cost) {
|
||||
if (stack.getItem().isEffectiveOn(state)) {
|
||||
if (stack.getItem().isSuitableFor(state)) {
|
||||
return poweredSpeed;
|
||||
} else {
|
||||
return Math.min(unpoweredSpeed * 10f, poweredSpeed); // Still be faster than unpowered when not effective
|
||||
|
@ -81,15 +81,15 @@ public class DrillItem extends PickaxeItem implements EnergyHolder, ItemDurabili
|
|||
|
||||
// PickaxeItem
|
||||
@Override
|
||||
public boolean isEffectiveOn(BlockState blockIn) {
|
||||
public boolean isSuitableFor(BlockState blockIn) {
|
||||
if(blockIn == null){
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Items.DIAMOND_PICKAXE.isEffectiveOn(blockIn)) {
|
||||
if (Items.DIAMOND_PICKAXE.isSuitableFor(blockIn)) {
|
||||
return true;
|
||||
}
|
||||
if (Items.DIAMOND_SHOVEL.isEffectiveOn(blockIn)) {
|
||||
if (Items.DIAMOND_SHOVEL.isSuitableFor(blockIn)) {
|
||||
return true;
|
||||
}
|
||||
// More checks to fix #2225
|
||||
|
|
|
@ -66,13 +66,13 @@ public class AdvancedJackhammerItem extends JackhammerItem implements MultiBlock
|
|||
if (ToolsUtil.JackHammerSkippedBlocks(blockState)){
|
||||
return false;
|
||||
}
|
||||
return (stack.getItem().isEffectiveOn(blockState));
|
||||
return (stack.getItem().isSuitableFor(blockState));
|
||||
}
|
||||
|
||||
// JackhammerItem
|
||||
@Override
|
||||
public boolean postMine(ItemStack stack, World worldIn, BlockState stateIn, BlockPos pos, LivingEntity entityLiving) {
|
||||
if (!ItemUtils.isActive(stack) || !stack.getItem().isEffectiveOn(stateIn)) {
|
||||
if (!ItemUtils.isActive(stack) || !stack.getItem().isSuitableFor(stateIn)) {
|
||||
return super.postMine(stack, worldIn, stateIn, pos, entityLiving);
|
||||
}
|
||||
for (BlockPos additionalPos : ToolsUtil.getAOEMiningBlocks(worldIn, pos, entityLiving, 1)) {
|
||||
|
@ -109,7 +109,7 @@ public class AdvancedJackhammerItem extends JackhammerItem implements MultiBlock
|
|||
// MultiBlockBreakingTool
|
||||
@Override
|
||||
public Set<BlockPos> getBlocksToBreak(ItemStack stack, World worldIn, BlockPos pos, @Nullable LivingEntity entityLiving) {
|
||||
if (!stack.getItem().isEffectiveOn(worldIn.getBlockState(pos))) {
|
||||
if (!stack.getItem().isSuitableFor(worldIn.getBlockState(pos))) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
return ToolsUtil.getAOEMiningBlocks(worldIn, pos, entityLiving, 1, false)
|
||||
|
|
|
@ -60,8 +60,8 @@ public class RockCutterItem extends PickaxeItem implements EnergyHolder, ItemDur
|
|||
|
||||
// PickaxeItem
|
||||
@Override
|
||||
public boolean isEffectiveOn(BlockState state) {
|
||||
return Items.DIAMOND_PICKAXE.isEffectiveOn(state);
|
||||
public boolean isSuitableFor(BlockState state) {
|
||||
return Items.DIAMOND_PICKAXE.isSuitableFor(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -94,7 +94,7 @@ public class IndustrialJackhammerItem extends JackhammerItem implements MultiBlo
|
|||
return false;
|
||||
}
|
||||
|
||||
return (stack.getItem().isEffectiveOn(blockState));
|
||||
return (stack.getItem().isSuitableFor(blockState));
|
||||
}
|
||||
|
||||
private boolean isAOE5(ItemStack stack) {
|
||||
|
@ -104,7 +104,7 @@ public class IndustrialJackhammerItem extends JackhammerItem implements MultiBlo
|
|||
// JackhammerItem
|
||||
@Override
|
||||
public boolean postMine(ItemStack stack, World worldIn, BlockState stateIn, BlockPos pos, LivingEntity entityLiving) {
|
||||
if (!ItemUtils.isActive(stack) || !stack.getItem().isEffectiveOn(stateIn)) {
|
||||
if (!ItemUtils.isActive(stack) || !stack.getItem().isSuitableFor(stateIn)) {
|
||||
return super.postMine(stack, worldIn, stateIn, pos, entityLiving);
|
||||
}
|
||||
int radius = isAOE5(stack) ? 2 : 1;
|
||||
|
@ -160,7 +160,7 @@ public class IndustrialJackhammerItem extends JackhammerItem implements MultiBlo
|
|||
// MultiBlockBreakingTool
|
||||
@Override
|
||||
public Set<BlockPos> getBlocksToBreak(ItemStack stack, World worldIn, BlockPos pos, @Nullable LivingEntity entityLiving) {
|
||||
if (!stack.getItem().isEffectiveOn(worldIn.getBlockState(pos))) {
|
||||
if (!stack.getItem().isSuitableFor(worldIn.getBlockState(pos))) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
int radius = isAOE5(stack) ? 2 : 1;
|
||||
|
|
|
@ -36,7 +36,7 @@ import net.minecraft.entity.attribute.EntityAttributeModifier;
|
|||
import net.minecraft.entity.attribute.EntityAttributes;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
|
@ -114,16 +114,16 @@ public class NanosaberItem extends SwordItem implements EnergyHolder, ItemDurabi
|
|||
return;
|
||||
}
|
||||
ItemStack inactiveUncharged = new ItemStack(this);
|
||||
inactiveUncharged.setTag(new CompoundTag());
|
||||
inactiveUncharged.setTag(new NbtCompound());
|
||||
inactiveUncharged.getOrCreateTag().putBoolean("isActive", false);
|
||||
|
||||
ItemStack inactiveCharged = new ItemStack(TRContent.NANOSABER);
|
||||
inactiveCharged.setTag(new CompoundTag());
|
||||
inactiveCharged.setTag(new NbtCompound());
|
||||
inactiveCharged.getOrCreateTag().putBoolean("isActive", false);
|
||||
Energy.of(inactiveCharged).set(Energy.of(inactiveCharged).getMaxStored());
|
||||
|
||||
ItemStack activeCharged = new ItemStack(TRContent.NANOSABER);
|
||||
activeCharged.setTag(new CompoundTag());
|
||||
activeCharged.setTag(new NbtCompound());
|
||||
activeCharged.getOrCreateTag().putBoolean("isActive", true);
|
||||
Energy.of(activeCharged).set(Energy.of(activeCharged).getMaxStored());
|
||||
|
||||
|
|
|
@ -75,10 +75,10 @@ public class OmniToolItem extends PickaxeItem implements EnergyHolder, ItemDurab
|
|||
|
||||
// PickaxeItem
|
||||
@Override
|
||||
public boolean isEffectiveOn(BlockState state) {
|
||||
return Items.DIAMOND_AXE.isEffectiveOn(state) || Items.DIAMOND_SWORD.isEffectiveOn(state)
|
||||
|| Items.DIAMOND_PICKAXE.isEffectiveOn(state) || Items.DIAMOND_SHOVEL.isEffectiveOn(state)
|
||||
|| Items.SHEARS.isEffectiveOn(state);
|
||||
public boolean isSuitableFor(BlockState state) {
|
||||
return Items.DIAMOND_AXE.isSuitableFor(state) || Items.DIAMOND_SWORD.isSuitableFor(state)
|
||||
|| Items.DIAMOND_PICKAXE.isSuitableFor(state) || Items.DIAMOND_SHOVEL.isSuitableFor(state)
|
||||
|| Items.SHEARS.isSuitableFor(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,7 +28,7 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.common.multiblock.IMultiblockPart;
|
||||
|
@ -213,7 +213,7 @@ public class MultiBlockCasing extends RectangularMultiblockControllerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onAttachedPartWithMultiblockData(IMultiblockPart part, CompoundTag data) {
|
||||
public void onAttachedPartWithMultiblockData(IMultiblockPart part, NbtCompound data) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -302,22 +302,22 @@ public class MultiBlockCasing extends RectangularMultiblockControllerBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void write(CompoundTag data) {
|
||||
public void write(NbtCompound data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(CompoundTag data) {
|
||||
public void read(NbtCompound data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void formatDescriptionPacket(CompoundTag data) {
|
||||
public void formatDescriptionPacket(NbtCompound data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decodeDescriptionPacket(CompoundTag data) {
|
||||
public void decodeDescriptionPacket(NbtCompound data) {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ package techreborn.utils;
|
|||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.MapColor;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.block.MaterialColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
|
@ -68,13 +68,13 @@ public class InitUtils {
|
|||
|
||||
public static AbstractBlock.Settings setupRubberBlockSettings(boolean noCollision, float hardness, float resistance) {
|
||||
|
||||
FabricBlockSettings settings = FabricBlockSettings.of(Material.WOOD, MaterialColor.SPRUCE);
|
||||
FabricBlockSettings settings = FabricBlockSettings.of(Material.WOOD, MapColor.SPRUCE_BROWN);
|
||||
settings.strength(hardness, resistance);
|
||||
settings.sounds(BlockSoundGroup.WOOD);
|
||||
if (noCollision) {
|
||||
settings.noCollision();
|
||||
}
|
||||
settings.materialColor(MaterialColor.SPRUCE);
|
||||
settings.materialColor(MapColor.SPRUCE_BROWN);
|
||||
return settings;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ public class RecipeUtils {
|
|||
}
|
||||
|
||||
public static boolean matchesSingleInput(Recipe<?> recipe, ItemStack input) {
|
||||
return recipe.getPreviewInputs().size() == 1 && recipe.getPreviewInputs().get(0).test(input);
|
||||
return recipe.getIngredients().size() == 1 && recipe.getIngredients().get(0).test(input);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue