All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.parzivail.util.inventory.StrictSlot Maven / Gradle / Ivy

There is a newer version: 0.0.114+1.20.2
Show newest version
package com.parzivail.util.inventory;

import com.parzivail.util.generics.Consumers;
import java.util.function.Predicate;
import net.minecraft.class_1263;
import net.minecraft.class_1735;
import net.minecraft.class_1799;

public class StrictSlot extends class_1735
{
	private final Predicate filter;
	private final Runnable onDirty;

	public StrictSlot(class_1263 inventory, int index, int x, int y, Predicate filter)
	{
		this(inventory, index, x, y, filter, Consumers::noop);
	}

	public StrictSlot(class_1263 inventory, int index, int x, int y, Predicate filter, Runnable onDirty)
	{
		super(inventory, index, x, y);
		this.filter = filter;
		this.onDirty = onDirty;
	}

	@Override
	public boolean method_7680(class_1799 stack)
	{
		return filter.test(stack);
	}

	@Override
	public void method_7668()
	{
		super.method_7668();
		onDirty.run();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy