Filter for "Update 1.21" feature flag in classic creative screen

Updating the ItemRegistryDiff would cause the inventory to be broken on 1.21 feature pack servers
This commit is contained in:
FlorianMichael 2024-01-29 19:20:36 +01:00
parent f105bd8667
commit d6d3494ae6
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126

View File

@ -24,7 +24,9 @@ import de.florianmichael.viafabricplus.screen.VFPScreen;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.registry.Registries;
import net.minecraft.resource.featuretoggle.FeatureFlags;
import net.minecraft.util.math.MathHelper;
import java.util.ArrayList;
@ -55,6 +57,7 @@ public class GridItemSelectionScreen extends VFPScreen {
final List<Item> allowedItems = new ArrayList<>();
// Calculate all visible items
for (Item item : Registries.ITEM) {
if (item == Items.AIR || item.getRequiredFeatures().contains(FeatureFlags.UPDATE_1_21)) continue;
if (ItemRegistryDiff.keepItem(item)) {
allowedItems.add(item);
}