Polymer

Polymer

763k Downloads

Creative Mode Mixes up Properties inherited from the Virtual Item

ZestyBlaze opened this issue ยท 5 comments

commented

When in Creative mode only, an item will copy the properties of the virtual item it inherits from when not overridden with custom item properties.
So for example I've got an item that uses a spider eye as the virtual item with no custom properties, in Creative mode the item can be eaten like it was a spider eye but in survival it can't be as the properties don't say it's a food item

commented

I can't recreate that. What is your item getPolymerItemStack method

commented
public class DemonologyItem extends Item implements PolymerItem {
    private final Item virtualItem;
    private final int modelData;

    public DemonologyItem(Item item, Properties properties, String id) {
        super(properties);
        this.virtualItem = item;
        this.modelData = PolymerResourcePackUtils.requestModel(item, Utils.id("item/" + id)).value();
    }

    public DemonologyItem(Item item, String name) {
        this(item, new FabricItemSettings(), name);
    }

    @Override
    public Item getPolymerItem(ItemStack itemStack, @Nullable ServerPlayer player) {
        return this.virtualItem;
    }

    @Override
    public int getPolymerCustomModelData(ItemStack itemStack, @Nullable ServerPlayer player) {
        return this.modelData;
    }
}

and

public static final Item DEMON_HEART = register("demon_heart", new DemonologyItem(Items.SPIDER_EYE, "demon_heart")
    );
commented

It's been updated since so I've had to kind of roughly go back to what it was at the time
But in the instance of a Spider Eye as the virtual item, it causes the item to be attempted to eat while in Creative but it can't finish eating them because it technically hasn't got any food stats, so you're just infinitely eating it

commented

It's more of limitation than anything, since it's vanilla item on the client

commented

Ah okay, just thought it was a bug because it won't be attempted to be eaten when in survival but when in creative it does try to eat it