First pass on 1.17.1 update. 13 errors left
This commit is contained in:
parent
3edf36e0ef
commit
08a2cdb081
24 changed files with 69 additions and 67 deletions
|
@ -108,8 +108,8 @@ public class StackToolTipHandler implements ItemTooltipCallback {
|
||||||
if ((block instanceof BaseBlockEntityProvider)) {
|
if ((block instanceof BaseBlockEntityProvider)) {
|
||||||
BlockEntity blockEntity = ((BlockEntityProvider) block).createBlockEntity(BlockPos.ORIGIN, block.getDefaultState());
|
BlockEntity blockEntity = ((BlockEntityProvider) block).createBlockEntity(BlockPos.ORIGIN, block.getDefaultState());
|
||||||
boolean hasData = false;
|
boolean hasData = false;
|
||||||
if (itemStack.hasTag() && itemStack.getOrCreateTag().contains("blockEntity_data")) {
|
if (itemStack.hasNbt() && itemStack.getOrCreateNbt().contains("blockEntity_data")) {
|
||||||
NbtCompound blockEntityData = itemStack.getOrCreateTag().getCompound("blockEntity_data");
|
NbtCompound blockEntityData = itemStack.getOrCreateNbt().getCompound("blockEntity_data");
|
||||||
if (blockEntity != null) {
|
if (blockEntity != null) {
|
||||||
blockEntity.readNbt(blockEntityData);
|
blockEntity.readNbt(blockEntityData);
|
||||||
hasData = true;
|
hasData = true;
|
||||||
|
|
|
@ -282,7 +282,7 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
|
||||||
for (Selectable selectable : accessorScreen.getSelectables()) {
|
for (Selectable selectable : accessorScreen.getSelectables()) {
|
||||||
if (selectable instanceof ClickableWidget clickable) {
|
if (selectable instanceof ClickableWidget clickable) {
|
||||||
if (clickable.isHovered()) {
|
if (clickable.isHovered()) {
|
||||||
clickable.renderToolTip(matrixStack, mouseX, mouseY);
|
clickable.renderTooltip(matrixStack, mouseX, mouseY);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,18 +52,19 @@ public abstract class BaseBlockEntityProvider extends Block implements BlockEnti
|
||||||
ItemStack newStack = stack.copy();
|
ItemStack newStack = stack.copy();
|
||||||
NbtCompound blockEntityData = blockEntity.writeNbt(new NbtCompound());
|
NbtCompound blockEntityData = blockEntity.writeNbt(new NbtCompound());
|
||||||
stripLocationData(blockEntityData);
|
stripLocationData(blockEntityData);
|
||||||
if (!newStack.hasTag()) {
|
if (!newStack.hasNbt()) {
|
||||||
newStack.setTag(new NbtCompound());
|
newStack.setNbt(new NbtCompound());
|
||||||
}
|
}
|
||||||
newStack.getTag().put("blockEntity_data", blockEntityData);
|
newStack.getOrCreateNbt().put("blockEntity_data", blockEntityData);
|
||||||
return Optional.of(newStack);
|
return Optional.of(newStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlaced(World worldIn, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) {
|
public void onPlaced(World worldIn, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) {
|
||||||
if (stack.hasTag() && stack.getTag().contains("blockEntity_data")) {
|
if (stack.hasNbt() && stack.getOrCreateNbt().contains("blockEntity_data")) {
|
||||||
BlockEntity blockEntity = worldIn.getBlockEntity(pos);
|
BlockEntity blockEntity = worldIn.getBlockEntity(pos);
|
||||||
NbtCompound nbt = stack.getTag().getCompound("blockEntity_data");
|
if (blockEntity == null) { return; }
|
||||||
|
NbtCompound nbt = stack.getOrCreateNbt().getCompound("blockEntity_data");
|
||||||
injectLocationData(nbt, pos);
|
injectLocationData(nbt, pos);
|
||||||
blockEntity.readNbt(nbt);
|
blockEntity.readNbt(nbt);
|
||||||
blockEntity.markDirty();
|
blockEntity.markDirty();
|
||||||
|
|
|
@ -120,8 +120,8 @@ public class RebornRecipe implements Recipe<Inventory>, CustomOutputRecipe {
|
||||||
if (stack.getCount() > 1) {
|
if (stack.getCount() > 1) {
|
||||||
stackObject.addProperty("count", stack.getCount());
|
stackObject.addProperty("count", stack.getCount());
|
||||||
}
|
}
|
||||||
if (stack.hasTag()) {
|
if (stack.hasNbt()) {
|
||||||
stackObject.add("nbt", Dynamic.convert(NbtOps.INSTANCE, JsonOps.INSTANCE, stack.getTag()));
|
stackObject.add("nbt", Dynamic.convert(NbtOps.INSTANCE, JsonOps.INSTANCE, stack.getNbt()));
|
||||||
}
|
}
|
||||||
resultsArray.add(stackObject);
|
resultsArray.add(stackObject);
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class RecipeUtils {
|
||||||
ItemStack stack = new ItemStack(item, count);
|
ItemStack stack = new ItemStack(item, count);
|
||||||
if (jsonObject.has("nbt")) {
|
if (jsonObject.has("nbt")) {
|
||||||
NbtCompound tag = (NbtCompound) Dynamic.convert(JsonOps.INSTANCE, NbtOps.INSTANCE, jsonObject.get("nbt"));
|
NbtCompound tag = (NbtCompound) Dynamic.convert(JsonOps.INSTANCE, NbtOps.INSTANCE, jsonObject.get("nbt"));
|
||||||
stack.setTag(tag);
|
stack.setNbt(tag);
|
||||||
}
|
}
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,14 +102,14 @@ public class StackIngredient extends RebornIngredient {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (tag.isPresent()) {
|
if (tag.isPresent()) {
|
||||||
if (!itemStack.hasTag()) {
|
if (!itemStack.hasNbt()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Bit of a meme here, as DataFixer likes to use the most basic primative type over using an int.
|
//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.
|
//So we have to go to json and back on the incoming stack to be sure its using types that match our input.
|
||||||
|
|
||||||
NbtCompound compoundTag = itemStack.getTag();
|
NbtCompound compoundTag = itemStack.getNbt();
|
||||||
JsonElement jsonElement = Dynamic.convert(NbtOps.INSTANCE, JsonOps.INSTANCE, compoundTag);
|
JsonElement jsonElement = Dynamic.convert(NbtOps.INSTANCE, JsonOps.INSTANCE, compoundTag);
|
||||||
compoundTag = (NbtCompound) Dynamic.convert(JsonOps.INSTANCE, NbtOps.INSTANCE, jsonElement);
|
compoundTag = (NbtCompound) Dynamic.convert(JsonOps.INSTANCE, NbtOps.INSTANCE, jsonElement);
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ public class StackIngredient extends RebornIngredient {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return !requireEmptyTag || !itemStack.hasTag();
|
return !requireEmptyTag || !itemStack.hasNbt();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -131,7 +131,7 @@ public class StackIngredient extends RebornIngredient {
|
||||||
stacks.stream()
|
stacks.stream()
|
||||||
.map(ItemStack::copy)
|
.map(ItemStack::copy)
|
||||||
.peek(itemStack -> itemStack.setCount(count.orElse(1)))
|
.peek(itemStack -> itemStack.setCount(count.orElse(1)))
|
||||||
.peek(itemStack -> itemStack.setTag(tag.orElse(null)))
|
.peek(itemStack -> itemStack.setNbt(tag.orElse(null)))
|
||||||
.collect(Collectors.toList()));
|
.collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,13 +60,13 @@ public class InventoryItem extends InventoryBase {
|
||||||
|
|
||||||
public NbtCompound getInvData() {
|
public NbtCompound getInvData() {
|
||||||
Validate.isTrue(!stack.isEmpty());
|
Validate.isTrue(!stack.isEmpty());
|
||||||
if (!stack.hasTag()) {
|
if (!stack.hasNbt()) {
|
||||||
stack.setTag(new NbtCompound());
|
stack.setNbt(new NbtCompound());
|
||||||
}
|
}
|
||||||
if (!stack.getTag().contains("inventory")) {
|
if (!stack.getNbt().contains("inventory")) {
|
||||||
stack.getTag().put("inventory", new NbtCompound());
|
stack.getNbt().put("inventory", new NbtCompound());
|
||||||
}
|
}
|
||||||
return stack.getTag().getCompound("inventory");
|
return stack.getNbt().getCompound("inventory");
|
||||||
}
|
}
|
||||||
|
|
||||||
public NbtCompound getSlotData(int slot) {
|
public NbtCompound getSlotData(int slot) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class ItemNBTHelper {
|
||||||
* Checks if an ItemStack has a Tag Compound
|
* Checks if an ItemStack has a Tag Compound
|
||||||
**/
|
**/
|
||||||
public static boolean detectNBT(ItemStack stack) {
|
public static boolean detectNBT(ItemStack stack) {
|
||||||
return stack.hasTag();
|
return stack.hasNbt();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -52,7 +52,7 @@ public class ItemNBTHelper {
|
||||||
* previously
|
* previously
|
||||||
**/
|
**/
|
||||||
public static void injectNBT(ItemStack stack, NbtCompound nbt) {
|
public static void injectNBT(ItemStack stack, NbtCompound nbt) {
|
||||||
stack.setTag(nbt);
|
stack.setNbt(nbt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,7 +61,7 @@ public class ItemNBTHelper {
|
||||||
**/
|
**/
|
||||||
public static NbtCompound getNBT(ItemStack stack) {
|
public static NbtCompound getNBT(ItemStack stack) {
|
||||||
initNBT(stack);
|
initNBT(stack);
|
||||||
return stack.getTag();
|
return stack.getNbt();
|
||||||
}
|
}
|
||||||
|
|
||||||
// SETTERS
|
// SETTERS
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class ItemUtils {
|
||||||
if (a.getItem() != b.getItem()) {
|
if (a.getItem() != b.getItem()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return !matchNBT || ItemStack.areTagsEqual(a, b);
|
return !matchNBT || ItemStack.areNbtEqual(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isItemEqual(ItemStack a, ItemStack b, boolean matchNBT,
|
public static boolean isItemEqual(ItemStack a, ItemStack b, boolean matchNBT,
|
||||||
|
@ -121,7 +121,7 @@ public class ItemUtils {
|
||||||
* @return True if powered item is active
|
* @return True if powered item is active
|
||||||
*/
|
*/
|
||||||
public static boolean isActive(ItemStack stack) {
|
public static boolean isActive(ItemStack stack) {
|
||||||
return !stack.isEmpty() && stack.getTag() != null && stack.getTag().getBoolean("isActive");
|
return !stack.isEmpty() && stack.getNbt() != null && stack.getNbt().getBoolean("isActive");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -149,7 +149,7 @@ public class ItemUtils {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
stack.getOrCreateTag().putBoolean("isActive", false);
|
stack.getOrCreateNbt().putBoolean("isActive", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -164,7 +164,7 @@ public class ItemUtils {
|
||||||
ItemUtils.checkActive(stack, cost, isClient, messageId);
|
ItemUtils.checkActive(stack, cost, isClient, messageId);
|
||||||
|
|
||||||
if (!ItemUtils.isActive(stack)) {
|
if (!ItemUtils.isActive(stack)) {
|
||||||
stack.getOrCreateTag().putBoolean("isActive", true);
|
stack.getOrCreateNbt().putBoolean("isActive", true);
|
||||||
if (isClient) {
|
if (isClient) {
|
||||||
|
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ public class ItemUtils {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
stack.getOrCreateTag().putBoolean("isActive", false);
|
stack.getOrCreateNbt().putBoolean("isActive", false);
|
||||||
if (isClient) {
|
if (isClient) {
|
||||||
ChatUtils.sendNoSpamMessages(messageId, new TranslatableText("reborncore.message.setTo")
|
ChatUtils.sendNoSpamMessages(messageId, new TranslatableText("reborncore.message.setTo")
|
||||||
.formatted(Formatting.GRAY)
|
.formatted(Formatting.GRAY)
|
||||||
|
|
|
@ -68,8 +68,8 @@ public class WorldUtils {
|
||||||
ItemEntity entityItem = new ItemEntity(world, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ,
|
ItemEntity entityItem = new ItemEntity(world, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ,
|
||||||
itemStack.copy());
|
itemStack.copy());
|
||||||
|
|
||||||
if (itemStack.hasTag()) {
|
if (itemStack.hasNbt()) {
|
||||||
entityItem.getStack().setTag(itemStack.getTag().copy());
|
entityItem.getStack().setNbt(itemStack.getNbt().copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
float factor = 0.05F;
|
float factor = 0.05F;
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class ItemStackSerializer implements JsonSerializer<ItemStack>, JsonDeser
|
||||||
|
|
||||||
if (name != null && Registry.ITEM.get(new Identifier(name)) != null) {
|
if (name != null && Registry.ITEM.get(new Identifier(name)) != null) {
|
||||||
ItemStack itemStack = new ItemStack(Registry.ITEM.get(new Identifier(name)), stackSize);
|
ItemStack itemStack = new ItemStack(Registry.ITEM.get(new Identifier(name)), stackSize);
|
||||||
itemStack.setTag(tagCompound);
|
itemStack.setNbt(tagCompound);
|
||||||
return itemStack;
|
return itemStack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,8 +92,8 @@ public class ItemStackSerializer implements JsonSerializer<ItemStack>, JsonDeser
|
||||||
|
|
||||||
jsonObject.addProperty(STACK_SIZE, src.getCount());
|
jsonObject.addProperty(STACK_SIZE, src.getCount());
|
||||||
|
|
||||||
if (src.getTag() != null) {
|
if (src.getNbt() != null) {
|
||||||
jsonObject.addProperty(TAG_COMPOUND, src.getTag().toString());
|
jsonObject.addProperty(TAG_COMPOUND, src.getNbt().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
return jsonObject;
|
return jsonObject;
|
||||||
|
|
|
@ -88,12 +88,12 @@ allprojects {
|
||||||
|
|
||||||
// Shared deps between TR and RC
|
// Shared deps between TR and RC
|
||||||
dependencies {
|
dependencies {
|
||||||
minecraft "com.mojang:minecraft:1.17"
|
minecraft "com.mojang:minecraft:1.17.1"
|
||||||
mappings "net.fabricmc:yarn:1.17+build.6:v2"
|
mappings "net.fabricmc:yarn:1.17.1+build.23:v2"
|
||||||
modImplementation "net.fabricmc:fabric-loader:0.11.3"
|
modImplementation "net.fabricmc:fabric-loader:0.11.6"
|
||||||
|
|
||||||
//Fabric api
|
//Fabric api
|
||||||
modImplementation "net.fabricmc.fabric-api:fabric-api:0.34.10+1.17"
|
modImplementation "net.fabricmc.fabric-api:fabric-api:0.37.0+1.17"
|
||||||
|
|
||||||
include(modApi('teamreborn:energy:0.1.1'))
|
include(modApi('teamreborn:energy:0.1.1'))
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,8 +205,9 @@ public class TechRebornClient implements ClientModInitializer {
|
||||||
FrequencyTransmitterItem.class,
|
FrequencyTransmitterItem.class,
|
||||||
new Identifier("techreborn:coords"),
|
new Identifier("techreborn:coords"),
|
||||||
(item, stack, world, entity, seed) -> {
|
(item, stack, world, entity, seed) -> {
|
||||||
if (!stack.isEmpty() && stack.hasTag() && stack.getTag() != null && stack.getTag().contains("x")
|
if (!stack.isEmpty() && stack.hasNbt() && stack.getOrCreateNbt().contains("x")
|
||||||
&& stack.getTag().contains("y") && stack.getTag().contains("z") && stack.getTag().contains("dim")) {
|
&& stack.getOrCreateNbt().contains("y") && stack.getOrCreateNbt().contains("z")
|
||||||
|
&& stack.getOrCreateNbt().contains("dim")) {
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
return 0.0F;
|
return 0.0F;
|
||||||
|
|
|
@ -82,8 +82,8 @@ public class AdjustableSUBlockEntity extends EnergyStorageBlockEntity implements
|
||||||
NbtCompound blockEntity = new NbtCompound();
|
NbtCompound blockEntity = new NbtCompound();
|
||||||
ItemStack dropStack = TRContent.Machine.ADJUSTABLE_SU.getStack();
|
ItemStack dropStack = TRContent.Machine.ADJUSTABLE_SU.getStack();
|
||||||
writeNbt(blockEntity);
|
writeNbt(blockEntity);
|
||||||
dropStack.setTag(new NbtCompound());
|
dropStack.setNbt(new NbtCompound());
|
||||||
dropStack.getOrCreateTag().put("blockEntity", blockEntity);
|
dropStack.getOrCreateNbt().put("blockEntity", blockEntity);
|
||||||
return dropStack;
|
return dropStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,8 +80,8 @@ public class TankUnitBaseBlockEntity extends MachineBaseBlockEntity implements I
|
||||||
ItemStack dropStack = new ItemStack(getBlockType(), 1);
|
ItemStack dropStack = new ItemStack(getBlockType(), 1);
|
||||||
final NbtCompound blockEntity = new NbtCompound();
|
final NbtCompound blockEntity = new NbtCompound();
|
||||||
this.writeNbt(blockEntity);
|
this.writeNbt(blockEntity);
|
||||||
dropStack.setTag(new NbtCompound());
|
dropStack.setNbt(new NbtCompound());
|
||||||
dropStack.getOrCreateTag().put("blockEntity", blockEntity);
|
dropStack.getOrCreateNbt().put("blockEntity", blockEntity);
|
||||||
return dropStack;
|
return dropStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -411,8 +411,8 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implement
|
||||||
final NbtCompound blockEntity = new NbtCompound();
|
final NbtCompound blockEntity = new NbtCompound();
|
||||||
|
|
||||||
this.writeNbt(blockEntity);
|
this.writeNbt(blockEntity);
|
||||||
dropStack.setTag(new NbtCompound());
|
dropStack.setNbt(new NbtCompound());
|
||||||
dropStack.getOrCreateTag().put("blockEntity", blockEntity);
|
dropStack.getOrCreateNbt().put("blockEntity", blockEntity);
|
||||||
|
|
||||||
return dropStack;
|
return dropStack;
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class GuiIronFurnace extends GuiBase<BuiltScreenHandler> {
|
||||||
addSelectableChild(new GuiButtonSimple(getGuiLeft() + 116, getGuiTop() + 57, 18, 18, LiteralText.EMPTY, b -> onClick()) {
|
addSelectableChild(new GuiButtonSimple(getGuiLeft() + 116, getGuiTop() + 57, 18, 18, LiteralText.EMPTY, b -> onClick()) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderToolTip(MatrixStack matrixStack, int mouseX, int mouseY) {
|
public void renderTooltip(MatrixStack matrixStack, int mouseX, int mouseY) {
|
||||||
PlayerEntity player = MinecraftClient.getInstance().player;
|
PlayerEntity player = MinecraftClient.getInstance().player;
|
||||||
String message = "Experience: ";
|
String message = "Experience: ";
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class TRDispenserBehavior {
|
||||||
public ItemStack dispenseSilently(BlockPointer pointer, ItemStack stack) {
|
public ItemStack dispenseSilently(BlockPointer pointer, ItemStack stack) {
|
||||||
DynamicCellItem cell = (DynamicCellItem) stack.getItem();
|
DynamicCellItem cell = (DynamicCellItem) stack.getItem();
|
||||||
WorldAccess iWorld = pointer.getWorld();
|
WorldAccess iWorld = pointer.getWorld();
|
||||||
BlockPos blockPos = pointer.getBlockPos().offset(pointer.getBlockState().get(DispenserBlock.FACING));
|
BlockPos blockPos = pointer.getPos().offset(pointer.getBlockState().get(DispenserBlock.FACING));
|
||||||
BlockState blockState = iWorld.getBlockState(blockPos);
|
BlockState blockState = iWorld.getBlockState(blockPos);
|
||||||
Block block = blockState.getBlock();
|
Block block = blockState.getBlock();
|
||||||
if (cell.getFluid(stack) == Fluids.EMPTY) {
|
if (cell.getFluid(stack) == Fluids.EMPTY) {
|
||||||
|
|
|
@ -231,7 +231,7 @@ public class DynamicCellItem extends Item implements ItemFluidInfo {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Fluid getFluid(ItemStack itemStack) {
|
public Fluid getFluid(ItemStack itemStack) {
|
||||||
NbtCompound tag = itemStack.getTag();
|
NbtCompound tag = itemStack.getNbt();
|
||||||
if (tag != null && tag.contains("fluid")) {
|
if (tag != null && tag.contains("fluid")) {
|
||||||
return Registry.FLUID.get(new Identifier(tag.getString("fluid")));
|
return Registry.FLUID.get(new Identifier(tag.getString("fluid")));
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class FrequencyTransmitterItem extends Item {
|
||||||
GlobalPos globalPos = GlobalPos.create(ChunkLoaderManager.getDimensionRegistryKey(world), pos);
|
GlobalPos globalPos = GlobalPos.create(ChunkLoaderManager.getDimensionRegistryKey(world), pos);
|
||||||
|
|
||||||
GlobalPos.CODEC.encodeStart(NbtOps.INSTANCE, globalPos).result()
|
GlobalPos.CODEC.encodeStart(NbtOps.INSTANCE, globalPos).result()
|
||||||
.ifPresent(tag -> stack.getOrCreateTag().put("pos", tag));
|
.ifPresent(tag -> stack.getOrCreateNbt().put("pos", tag));
|
||||||
|
|
||||||
if (!world.isClient) {
|
if (!world.isClient) {
|
||||||
|
|
||||||
|
@ -84,10 +84,10 @@ public class FrequencyTransmitterItem extends Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Optional<GlobalPos> getPos(ItemStack stack) {
|
public static Optional<GlobalPos> getPos(ItemStack stack) {
|
||||||
if (!stack.hasTag() || !stack.getOrCreateTag().contains("pos")) {
|
if (!stack.hasNbt() || !stack.getOrCreateNbt().contains("pos")) {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
return GlobalPos.CODEC.parse(NbtOps.INSTANCE, stack.getOrCreateTag().getCompound("pos")).result();
|
return GlobalPos.CODEC.parse(NbtOps.INSTANCE, stack.getOrCreateNbt().getCompound("pos")).result();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -95,7 +95,7 @@ public class FrequencyTransmitterItem extends Item {
|
||||||
Hand hand) {
|
Hand hand) {
|
||||||
ItemStack stack = player.getStackInHand(hand);
|
ItemStack stack = player.getStackInHand(hand);
|
||||||
if (player.isSneaking()) {
|
if (player.isSneaking()) {
|
||||||
stack.setTag(null);
|
stack.setNbt(null);
|
||||||
if (!world.isClient) {
|
if (!world.isClient) {
|
||||||
|
|
||||||
ChatUtils.sendNoSpamMessages(MessageIDs.freqTransmitterID,
|
ChatUtils.sendNoSpamMessages(MessageIDs.freqTransmitterID,
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class PaintingToolItem extends Item {
|
||||||
if (player.isSneaking()) {
|
if (player.isSneaking()) {
|
||||||
if (blockState.isOpaqueFullCube(context.getWorld(), context.getBlockPos())
|
if (blockState.isOpaqueFullCube(context.getWorld(), context.getBlockPos())
|
||||||
&& blockState.getBlock().getDefaultState().isOpaqueFullCube(context.getWorld(), context.getBlockPos())) {
|
&& blockState.getBlock().getDefaultState().isOpaqueFullCube(context.getWorld(), context.getBlockPos())) {
|
||||||
context.getStack().getOrCreateTag().put("cover", NbtHelper.fromBlockState(blockState));
|
context.getStack().getOrCreateNbt().put("cover", NbtHelper.fromBlockState(blockState));
|
||||||
return ActionResult.SUCCESS;
|
return ActionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
return ActionResult.FAIL;
|
return ActionResult.FAIL;
|
||||||
|
@ -90,8 +90,8 @@ public class PaintingToolItem extends Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlockState getCover(ItemStack stack) {
|
public static BlockState getCover(ItemStack stack) {
|
||||||
if (stack.hasTag() && stack.getTag().contains("cover")) {
|
if (stack.hasNbt() && stack.getOrCreateNbt().contains("cover")) {
|
||||||
return NbtHelper.toBlockState(stack.getTag().getCompound("cover"));
|
return NbtHelper.toBlockState(stack.getOrCreateNbt().getCompound("cover"));
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,16 +67,16 @@ public class IndustrialJackhammerItem extends JackhammerItem implements MultiBlo
|
||||||
ItemUtils.checkActive(stack, cost, isClient, messageId);
|
ItemUtils.checkActive(stack, cost, isClient, messageId);
|
||||||
if (!ItemUtils.isActive(stack)) {
|
if (!ItemUtils.isActive(stack)) {
|
||||||
ItemUtils.switchActive(stack, cost, isClient, messageId);
|
ItemUtils.switchActive(stack, cost, isClient, messageId);
|
||||||
stack.getOrCreateTag().putBoolean("AOE5", false);
|
stack.getOrCreateNbt().putBoolean("AOE5", false);
|
||||||
if (isClient) {
|
if (isClient) {
|
||||||
ChatUtils.sendNoSpamMessages(messageId, new TranslatableText("techreborn.message.setTo").formatted(Formatting.GRAY).append(" ").append(new LiteralText("3*3").formatted(Formatting.GOLD)));
|
ChatUtils.sendNoSpamMessages(messageId, new TranslatableText("techreborn.message.setTo").formatted(Formatting.GRAY).append(" ").append(new LiteralText("3*3").formatted(Formatting.GOLD)));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isAOE5(stack)) {
|
if (isAOE5(stack)) {
|
||||||
ItemUtils.switchActive(stack, cost, isClient, messageId);
|
ItemUtils.switchActive(stack, cost, isClient, messageId);
|
||||||
stack.getOrCreateTag().putBoolean("AOE5", false);
|
stack.getOrCreateNbt().putBoolean("AOE5", false);
|
||||||
} else {
|
} else {
|
||||||
stack.getOrCreateTag().putBoolean("AOE5", true);
|
stack.getOrCreateNbt().putBoolean("AOE5", true);
|
||||||
if (isClient) {
|
if (isClient) {
|
||||||
ChatUtils.sendNoSpamMessages(messageId, new TranslatableText("techreborn.message.setTo").formatted(Formatting.GRAY).append(" ").append(new LiteralText("5*5").formatted(Formatting.GOLD)));
|
ChatUtils.sendNoSpamMessages(messageId, new TranslatableText("techreborn.message.setTo").formatted(Formatting.GRAY).append(" ").append(new LiteralText("5*5").formatted(Formatting.GOLD)));
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ public class IndustrialJackhammerItem extends JackhammerItem implements MultiBlo
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isAOE5(ItemStack stack) {
|
private boolean isAOE5(ItemStack stack) {
|
||||||
return !stack.isEmpty() && stack.getTag() != null && stack.getTag().getBoolean("AOE5");
|
return !stack.isEmpty() && stack.getOrCreateNbt().getBoolean("AOE5");
|
||||||
}
|
}
|
||||||
|
|
||||||
// JackhammerItem
|
// JackhammerItem
|
||||||
|
|
|
@ -114,17 +114,17 @@ public class NanosaberItem extends SwordItem implements EnergyHolder, ItemDurabi
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ItemStack inactiveUncharged = new ItemStack(this);
|
ItemStack inactiveUncharged = new ItemStack(this);
|
||||||
inactiveUncharged.setTag(new NbtCompound());
|
inactiveUncharged.setNbt(new NbtCompound());
|
||||||
inactiveUncharged.getOrCreateTag().putBoolean("isActive", false);
|
inactiveUncharged.getOrCreateNbt().putBoolean("isActive", false);
|
||||||
|
|
||||||
ItemStack inactiveCharged = new ItemStack(TRContent.NANOSABER);
|
ItemStack inactiveCharged = new ItemStack(TRContent.NANOSABER);
|
||||||
inactiveCharged.setTag(new NbtCompound());
|
inactiveCharged.setNbt(new NbtCompound());
|
||||||
inactiveCharged.getOrCreateTag().putBoolean("isActive", false);
|
inactiveCharged.getOrCreateNbt().putBoolean("isActive", false);
|
||||||
Energy.of(inactiveCharged).set(Energy.of(inactiveCharged).getMaxStored());
|
Energy.of(inactiveCharged).set(Energy.of(inactiveCharged).getMaxStored());
|
||||||
|
|
||||||
ItemStack activeCharged = new ItemStack(TRContent.NANOSABER);
|
ItemStack activeCharged = new ItemStack(TRContent.NANOSABER);
|
||||||
activeCharged.setTag(new NbtCompound());
|
activeCharged.setNbt(new NbtCompound());
|
||||||
activeCharged.getOrCreateTag().putBoolean("isActive", true);
|
activeCharged.getOrCreateNbt().putBoolean("isActive", true);
|
||||||
Energy.of(activeCharged).set(Energy.of(activeCharged).getMaxStored());
|
Energy.of(activeCharged).set(Energy.of(activeCharged).getMaxStored());
|
||||||
|
|
||||||
itemList.add(inactiveUncharged);
|
itemList.add(inactiveUncharged);
|
||||||
|
|
|
@ -33,8 +33,8 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.11.3",
|
"fabricloader": ">=0.11.6",
|
||||||
"fabric": ">=0.34.10",
|
"fabric": ">=0.37.0",
|
||||||
"reborncore": "*",
|
"reborncore": "*",
|
||||||
"team_reborn_energy": ">=0.1.1",
|
"team_reborn_energy": ">=0.1.1",
|
||||||
"fabric-biome-api-v1": ">=3.0.0"
|
"fabric-biome-api-v1": ">=3.0.0"
|
||||||
|
|
Loading…
Reference in a new issue