mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-11-17 13:47:11 +00:00
Deprecate itemGroups field
Since 1.19.3, this was only populated when the player opened the creative menu, and so was useless in survival or multi-player worlds. Rather than removing the field entirely (🦑 backwards compatibility), we replace it with the empty list. We also remove it from the docs, and add a note explaining what the field used to do. Closes #1285, albeit in the least satisfactory way possible.
This commit is contained in:
@@ -96,13 +96,18 @@ public class InventoryMethods implements GenericPeripheral {
|
||||
* <p>
|
||||
* The returned information contains the same information as each item in
|
||||
* {@link #list}, as well as additional details like the display name
|
||||
* (`displayName`), item groups (`itemGroups`), which are the creative tabs
|
||||
* an item will appear under, and item and item durability (`damage`,
|
||||
* `maxDamage`, `durability`).
|
||||
* (`displayName`), and item and item durability (`damage`, `maxDamage`, `durability`).
|
||||
* <p>
|
||||
* Some items include more information (such as enchantments) - it is
|
||||
* recommended to print it out using @{textutils.serialize} or in the Lua
|
||||
* REPL, to explore what is available.
|
||||
* <p>
|
||||
* :::info Deprecated fields
|
||||
* Older versions of CC: Tweaked exposed an {@code itemGroups} field, listing the
|
||||
* creative tabs an item was available under. This information is no longer available on
|
||||
* more recent versions of the game, and so this field will always be empty. Do not use this
|
||||
* field in new code!
|
||||
* :::
|
||||
*
|
||||
* @param inventory The current inventory.
|
||||
* @param slot The slot to get information about.
|
||||
@@ -119,10 +124,6 @@ public class InventoryMethods implements GenericPeripheral {
|
||||
* print(("%s (%s)"):format(item.displayName, item.name))
|
||||
* print(("Count: %d/%d"):format(item.count, item.maxCount))
|
||||
*
|
||||
* for _, group in pairs(item.itemGroups) do
|
||||
* print(("Group: %s"):format(group.displayName))
|
||||
* end
|
||||
*
|
||||
* if item.damage then
|
||||
* print(("Damage: %d/%d"):format(item.damage, item.maxDamage))
|
||||
* end
|
||||
|
||||
@@ -38,7 +38,6 @@ import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
import net.minecraft.world.inventory.CraftingContainer;
|
||||
import net.minecraft.world.inventory.MenuType;
|
||||
import net.minecraft.world.item.CreativeModeTab;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.context.UseOnContext;
|
||||
@@ -52,7 +51,6 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.common.CreativeModeTabRegistry;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.Tags;
|
||||
import net.minecraftforge.common.ToolActions;
|
||||
@@ -258,12 +256,6 @@ public class PlatformHelperImpl implements PlatformHelper {
|
||||
return ForgeHooks.getBurnTime(stack, null);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ResourceLocation getCreativeTabId(CreativeModeTab tab) {
|
||||
return CreativeModeTabRegistry.getName(tab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingRemainingItem(ItemStack stack) {
|
||||
return stack.getCraftingRemainingItem();
|
||||
|
||||
Reference in New Issue
Block a user