2020-04-16 00:39:53 +02:00
|
|
|
package de.ellpeck.prettypipes.items;
|
|
|
|
|
|
|
|
import de.ellpeck.prettypipes.Registry;
|
2020-04-20 13:12:26 +02:00
|
|
|
import de.ellpeck.prettypipes.Utility;
|
2021-03-03 00:10:24 +01:00
|
|
|
import de.ellpeck.prettypipes.misc.ItemFilter;
|
2020-04-16 04:42:42 +02:00
|
|
|
import de.ellpeck.prettypipes.pipe.PipeTileEntity;
|
2020-12-04 19:32:16 +01:00
|
|
|
import de.ellpeck.prettypipes.pipe.containers.AbstractPipeContainer;
|
2020-04-16 15:45:11 +02:00
|
|
|
import net.minecraft.client.util.ITooltipFlag;
|
2020-04-16 04:42:42 +02:00
|
|
|
import net.minecraft.entity.player.PlayerEntity;
|
|
|
|
import net.minecraft.entity.player.PlayerInventory;
|
2020-04-16 00:39:53 +02:00
|
|
|
import net.minecraft.item.Item;
|
|
|
|
import net.minecraft.item.ItemStack;
|
2020-10-14 23:39:11 +02:00
|
|
|
import net.minecraft.util.math.BlockPos;
|
2020-12-04 19:32:16 +01:00
|
|
|
import net.minecraft.util.text.ITextComponent;
|
2020-04-16 15:45:11 +02:00
|
|
|
import net.minecraft.world.World;
|
|
|
|
import net.minecraftforge.api.distmarker.Dist;
|
|
|
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
2020-04-18 22:30:14 +02:00
|
|
|
import net.minecraftforge.items.IItemHandler;
|
2020-04-16 00:39:53 +02:00
|
|
|
|
2020-04-16 15:45:11 +02:00
|
|
|
import javax.annotation.Nullable;
|
2020-10-14 22:30:02 +02:00
|
|
|
import java.util.Collections;
|
2020-04-16 15:45:11 +02:00
|
|
|
import java.util.List;
|
2020-12-25 15:23:44 +01:00
|
|
|
import java.util.Stack;
|
2020-10-15 04:46:23 +02:00
|
|
|
import java.util.function.Consumer;
|
2020-04-16 15:45:11 +02:00
|
|
|
|
2020-04-16 02:48:58 +02:00
|
|
|
public abstract class ModuleItem extends Item implements IModule {
|
2020-04-16 15:45:11 +02:00
|
|
|
|
|
|
|
private final String name;
|
|
|
|
|
|
|
|
public ModuleItem(String name) {
|
2020-04-16 00:39:53 +02:00
|
|
|
super(new Properties().group(Registry.GROUP).maxStackSize(16));
|
2020-04-16 15:45:11 +02:00
|
|
|
this.name = name;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@OnlyIn(Dist.CLIENT)
|
|
|
|
public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
|
|
|
|
super.addInformation(stack, worldIn, tooltip, flagIn);
|
2020-04-20 13:12:26 +02:00
|
|
|
Utility.addTooltip(this.name, tooltip);
|
2020-04-16 00:39:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2020-04-16 04:42:42 +02:00
|
|
|
public void tick(ItemStack module, PipeTileEntity tile) {
|
2020-04-16 00:39:53 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2020-04-17 22:29:02 +02:00
|
|
|
public boolean canNetworkSee(ItemStack module, PipeTileEntity tile) {
|
2020-04-16 00:39:53 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2020-04-17 22:29:02 +02:00
|
|
|
public boolean canAcceptItem(ItemStack module, PipeTileEntity tile, ItemStack stack) {
|
2020-04-16 00:39:53 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-04-18 22:30:14 +02:00
|
|
|
@Override
|
|
|
|
public int getMaxInsertionAmount(ItemStack module, PipeTileEntity tile, ItemStack stack, IItemHandler destination) {
|
|
|
|
return Integer.MAX_VALUE;
|
|
|
|
}
|
|
|
|
|
2020-04-16 00:39:53 +02:00
|
|
|
@Override
|
2020-04-16 04:42:42 +02:00
|
|
|
public int getPriority(ItemStack module, PipeTileEntity tile) {
|
2020-04-16 00:39:53 +02:00
|
|
|
return 0;
|
|
|
|
}
|
2020-04-16 02:48:58 +02:00
|
|
|
|
|
|
|
@Override
|
2020-04-16 04:42:42 +02:00
|
|
|
public AbstractPipeContainer<?> getContainer(ItemStack module, PipeTileEntity tile, int windowId, PlayerInventory inv, PlayerEntity player, int moduleIndex) {
|
|
|
|
return null;
|
2020-04-16 02:48:58 +02:00
|
|
|
}
|
2020-04-16 23:40:35 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public float getItemSpeedIncrease(ItemStack module, PipeTileEntity tile) {
|
|
|
|
return 0;
|
|
|
|
}
|
2020-05-03 15:51:16 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean canPipeWork(ItemStack module, PipeTileEntity tile) {
|
|
|
|
return true;
|
|
|
|
}
|
2020-10-14 22:30:02 +02:00
|
|
|
|
|
|
|
@Override
|
2020-10-15 04:15:52 +02:00
|
|
|
public List<ItemStack> getAllCraftables(ItemStack module, PipeTileEntity tile) {
|
2020-10-14 22:30:02 +02:00
|
|
|
return Collections.emptyList();
|
|
|
|
}
|
2020-10-14 23:39:11 +02:00
|
|
|
|
|
|
|
@Override
|
2021-02-06 00:26:27 +01:00
|
|
|
public int getCraftableAmount(ItemStack module, PipeTileEntity tile, Consumer<ItemStack> unavailableConsumer, ItemStack stack, Stack<ItemStack> dependencyChain) {
|
2020-10-15 04:15:52 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2021-02-06 00:26:27 +01:00
|
|
|
public ItemStack craft(ItemStack module, PipeTileEntity tile, BlockPos destPipe, Consumer<ItemStack> unavailableConsumer, ItemStack stack, Stack<ItemStack> dependencyChain) {
|
2020-10-14 23:39:11 +02:00
|
|
|
return stack;
|
|
|
|
}
|
2020-12-04 19:32:16 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public Integer getCustomNextNode(ItemStack module, PipeTileEntity tile, List<BlockPos> nodes, int index) {
|
|
|
|
return null;
|
|
|
|
}
|
2021-03-03 00:10:24 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public ItemFilter getItemFilter(ItemStack module, PipeTileEntity tile) {
|
|
|
|
return null;
|
|
|
|
}
|
2020-04-16 00:39:53 +02:00
|
|
|
}
|