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)) {
|
||||
BlockEntity blockEntity = ((BlockEntityProvider) block).createBlockEntity(BlockPos.ORIGIN, block.getDefaultState());
|
||||
boolean hasData = false;
|
||||
if (itemStack.hasTag() && itemStack.getOrCreateTag().contains("blockEntity_data")) {
|
||||
NbtCompound blockEntityData = itemStack.getOrCreateTag().getCompound("blockEntity_data");
|
||||
if (itemStack.hasNbt() && itemStack.getOrCreateNbt().contains("blockEntity_data")) {
|
||||
NbtCompound blockEntityData = itemStack.getOrCreateNbt().getCompound("blockEntity_data");
|
||||
if (blockEntity != null) {
|
||||
blockEntity.readNbt(blockEntityData);
|
||||
hasData = true;
|
||||
|
|
|
@ -282,7 +282,7 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
|
|||
for (Selectable selectable : accessorScreen.getSelectables()) {
|
||||
if (selectable instanceof ClickableWidget clickable) {
|
||||
if (clickable.isHovered()) {
|
||||
clickable.renderToolTip(matrixStack, mouseX, mouseY);
|
||||
clickable.renderTooltip(matrixStack, mouseX, mouseY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,18 +52,19 @@ public abstract class BaseBlockEntityProvider extends Block implements BlockEnti
|
|||
ItemStack newStack = stack.copy();
|
||||
NbtCompound blockEntityData = blockEntity.writeNbt(new NbtCompound());
|
||||
stripLocationData(blockEntityData);
|
||||
if (!newStack.hasTag()) {
|
||||
newStack.setTag(new NbtCompound());
|
||||
if (!newStack.hasNbt()) {
|
||||
newStack.setNbt(new NbtCompound());
|
||||
}
|
||||
newStack.getTag().put("blockEntity_data", blockEntityData);
|
||||
newStack.getOrCreateNbt().put("blockEntity_data", blockEntityData);
|
||||
return Optional.of(newStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
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);
|
||||
NbtCompound nbt = stack.getTag().getCompound("blockEntity_data");
|
||||
if (blockEntity == null) { return; }
|
||||
NbtCompound nbt = stack.getOrCreateNbt().getCompound("blockEntity_data");
|
||||
injectLocationData(nbt, pos);
|
||||
blockEntity.readNbt(nbt);
|
||||
blockEntity.markDirty();
|
||||
|
|
|
@ -120,8 +120,8 @@ public class RebornRecipe implements Recipe<Inventory>, CustomOutputRecipe {
|
|||
if (stack.getCount() > 1) {
|
||||
stackObject.addProperty("count", stack.getCount());
|
||||
}
|
||||
if (stack.hasTag()) {
|
||||
stackObject.add("nbt", Dynamic.convert(NbtOps.INSTANCE, JsonOps.INSTANCE, stack.getTag()));
|
||||
if (stack.hasNbt()) {
|
||||
stackObject.add("nbt", Dynamic.convert(NbtOps.INSTANCE, JsonOps.INSTANCE, stack.getNbt()));
|
||||
}
|
||||
resultsArray.add(stackObject);
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ public class RecipeUtils {
|
|||
ItemStack stack = new ItemStack(item, count);
|
||||
if (jsonObject.has("nbt")) {
|
||||
NbtCompound tag = (NbtCompound) Dynamic.convert(JsonOps.INSTANCE, NbtOps.INSTANCE, jsonObject.get("nbt"));
|
||||
stack.setTag(tag);
|
||||
stack.setNbt(tag);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
|
|
@ -102,14 +102,14 @@ public class StackIngredient extends RebornIngredient {
|
|||
return false;
|
||||
}
|
||||
if (tag.isPresent()) {
|
||||
if (!itemStack.hasTag()) {
|
||||
if (!itemStack.hasNbt()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//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.
|
||||
|
||||
NbtCompound compoundTag = itemStack.getTag();
|
||||
NbtCompound compoundTag = itemStack.getNbt();
|
||||
JsonElement jsonElement = Dynamic.convert(NbtOps.INSTANCE, JsonOps.INSTANCE, compoundTag);
|
||||
compoundTag = (NbtCompound) Dynamic.convert(JsonOps.INSTANCE, NbtOps.INSTANCE, jsonElement);
|
||||
|
||||
|
@ -117,7 +117,7 @@ public class StackIngredient extends RebornIngredient {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
return !requireEmptyTag || !itemStack.hasTag();
|
||||
return !requireEmptyTag || !itemStack.hasNbt();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -131,7 +131,7 @@ public class StackIngredient extends RebornIngredient {
|
|||
stacks.stream()
|
||||
.map(ItemStack::copy)
|
||||
.peek(itemStack -> itemStack.setCount(count.orElse(1)))
|
||||
.peek(itemStack -> itemStack.setTag(tag.orElse(null)))
|
||||
.peek(itemStack -> itemStack.setNbt(tag.orElse(null)))
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
|
|
|
@ -60,13 +60,13 @@ public class InventoryItem extends InventoryBase {
|
|||
|
||||
public NbtCompound getInvData() {
|
||||
Validate.isTrue(!stack.isEmpty());
|
||||
if (!stack.hasTag()) {
|
||||
stack.setTag(new NbtCompound());
|
||||
if (!stack.hasNbt()) {
|
||||
stack.setNbt(new NbtCompound());
|
||||
}
|
||||
if (!stack.getTag().contains("inventory")) {
|
||||
stack.getTag().put("inventory", new NbtCompound());
|
||||
if (!stack.getNbt().contains("inventory")) {
|
||||
stack.getNbt().put("inventory", new NbtCompound());
|
||||
}
|
||||
return stack.getTag().getCompound("inventory");
|
||||
return stack.getNbt().getCompound("inventory");
|
||||
}
|
||||
|
||||
public NbtCompound getSlotData(int slot) {
|
||||
|
|
|
@ -34,7 +34,7 @@ public class ItemNBTHelper {
|
|||
* Checks if an ItemStack has a Tag Compound
|
||||
**/
|
||||
public static boolean detectNBT(ItemStack stack) {
|
||||
return stack.hasTag();
|
||||
return stack.hasNbt();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,7 +52,7 @@ public class ItemNBTHelper {
|
|||
* previously
|
||||
**/
|
||||
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) {
|
||||
initNBT(stack);
|
||||
return stack.getTag();
|
||||
return stack.getNbt();
|
||||
}
|
||||
|
||||
// SETTERS
|
||||
|
|
|
@ -49,7 +49,7 @@ public class ItemUtils {
|
|||
if (a.getItem() != b.getItem()) {
|
||||
return false;
|
||||
}
|
||||
return !matchNBT || ItemStack.areTagsEqual(a, b);
|
||||
return !matchNBT || ItemStack.areNbtEqual(a, b);
|
||||
}
|
||||
|
||||
public static boolean isItemEqual(ItemStack a, ItemStack b, boolean matchNBT,
|
||||
|
@ -121,7 +121,7 @@ public class ItemUtils {
|
|||
* @return True if powered item is active
|
||||
*/
|
||||
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);
|
||||
|
||||
if (!ItemUtils.isActive(stack)) {
|
||||
stack.getOrCreateTag().putBoolean("isActive", true);
|
||||
stack.getOrCreateNbt().putBoolean("isActive", true);
|
||||
if (isClient) {
|
||||
|
||||
|
||||
|
@ -178,7 +178,7 @@ public class ItemUtils {
|
|||
);
|
||||
}
|
||||
} else {
|
||||
stack.getOrCreateTag().putBoolean("isActive", false);
|
||||
stack.getOrCreateNbt().putBoolean("isActive", false);
|
||||
if (isClient) {
|
||||
ChatUtils.sendNoSpamMessages(messageId, new TranslatableText("reborncore.message.setTo")
|
||||
.formatted(Formatting.GRAY)
|
||||
|
|
|
@ -68,8 +68,8 @@ public class WorldUtils {
|
|||
ItemEntity entityItem = new ItemEntity(world, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ,
|
||||
itemStack.copy());
|
||||
|
||||
if (itemStack.hasTag()) {
|
||||
entityItem.getStack().setTag(itemStack.getTag().copy());
|
||||
if (itemStack.hasNbt()) {
|
||||
entityItem.getStack().setNbt(itemStack.getNbt().copy());
|
||||
}
|
||||
|
||||
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) {
|
||||
ItemStack itemStack = new ItemStack(Registry.ITEM.get(new Identifier(name)), stackSize);
|
||||
itemStack.setTag(tagCompound);
|
||||
itemStack.setNbt(tagCompound);
|
||||
return itemStack;
|
||||
}
|
||||
}
|
||||
|
@ -92,8 +92,8 @@ public class ItemStackSerializer implements JsonSerializer<ItemStack>, JsonDeser
|
|||
|
||||
jsonObject.addProperty(STACK_SIZE, src.getCount());
|
||||
|
||||
if (src.getTag() != null) {
|
||||
jsonObject.addProperty(TAG_COMPOUND, src.getTag().toString());
|
||||
if (src.getNbt() != null) {
|
||||
jsonObject.addProperty(TAG_COMPOUND, src.getNbt().toString());
|
||||
}
|
||||
|
||||
return jsonObject;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue