2020-04-16 00:39:53 +02:00
|
|
|
package de.ellpeck.prettypipes.items;
|
|
|
|
|
2020-04-20 13:12:26 +02:00
|
|
|
import de.ellpeck.prettypipes.Utility;
|
2022-06-30 16:00:33 +02:00
|
|
|
import de.ellpeck.prettypipes.misc.DirectionSelector;
|
2021-03-03 00:10:24 +01:00
|
|
|
import de.ellpeck.prettypipes.misc.ItemFilter;
|
2021-12-02 14:44:26 +01:00
|
|
|
import de.ellpeck.prettypipes.pipe.PipeBlockEntity;
|
2020-12-04 19:32:16 +01:00
|
|
|
import de.ellpeck.prettypipes.pipe.containers.AbstractPipeContainer;
|
2021-12-02 15:25:46 +01:00
|
|
|
import net.minecraft.core.BlockPos;
|
2022-06-30 16:00:33 +02:00
|
|
|
import net.minecraft.core.Direction;
|
2021-12-02 15:25:46 +01:00
|
|
|
import net.minecraft.network.chat.Component;
|
|
|
|
import net.minecraft.world.entity.player.Inventory;
|
|
|
|
import net.minecraft.world.entity.player.Player;
|
|
|
|
import net.minecraft.world.item.Item;
|
2021-12-02 12:31:04 +01:00
|
|
|
import net.minecraft.world.item.ItemStack;
|
2021-12-02 15:25:46 +01:00
|
|
|
import net.minecraft.world.item.TooltipFlag;
|
|
|
|
import net.minecraft.world.level.Level;
|
2020-04-16 15:45:11 +02:00
|
|
|
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) {
|
2023-07-07 19:54:52 +02:00
|
|
|
super(new Properties().stacksTo(16));
|
2020-04-16 15:45:11 +02:00
|
|
|
this.name = name;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@OnlyIn(Dist.CLIENT)
|
2021-12-02 15:25:46 +01:00
|
|
|
public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List<Component> tooltip, TooltipFlag flagIn) {
|
|
|
|
super.appendHoverText(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
|
2021-12-02 14:44:26 +01:00
|
|
|
public void tick(ItemStack module, PipeBlockEntity tile) {
|
2020-04-16 00:39:53 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2022-06-30 16:00:33 +02:00
|
|
|
public boolean canNetworkSee(ItemStack module, PipeBlockEntity tile, Direction direction, IItemHandler handler) {
|
2020-04-16 00:39:53 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2022-06-30 16:00:33 +02:00
|
|
|
public boolean canAcceptItem(ItemStack module, PipeBlockEntity tile, ItemStack stack, Direction direction, IItemHandler destination) {
|
2020-04-16 00:39:53 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-04-18 22:30:14 +02:00
|
|
|
@Override
|
2021-12-02 14:44:26 +01:00
|
|
|
public int getMaxInsertionAmount(ItemStack module, PipeBlockEntity tile, ItemStack stack, IItemHandler destination) {
|
2020-04-18 22:30:14 +02:00
|
|
|
return Integer.MAX_VALUE;
|
|
|
|
}
|
|
|
|
|
2020-04-16 00:39:53 +02:00
|
|
|
@Override
|
2021-12-02 14:44:26 +01:00
|
|
|
public int getPriority(ItemStack module, PipeBlockEntity tile) {
|
2020-04-16 00:39:53 +02:00
|
|
|
return 0;
|
|
|
|
}
|
2020-04-16 02:48:58 +02:00
|
|
|
|
|
|
|
@Override
|
2021-12-02 15:25:46 +01:00
|
|
|
public AbstractPipeContainer<?> getContainer(ItemStack module, PipeBlockEntity tile, int windowId, Inventory inv, Player player, int moduleIndex) {
|
2020-04-16 04:42:42 +02:00
|
|
|
return null;
|
2020-04-16 02:48:58 +02:00
|
|
|
}
|
2020-04-16 23:40:35 +02:00
|
|
|
|
|
|
|
@Override
|
2021-12-02 14:44:26 +01:00
|
|
|
public float getItemSpeedIncrease(ItemStack module, PipeBlockEntity tile) {
|
2020-04-16 23:40:35 +02:00
|
|
|
return 0;
|
|
|
|
}
|
2020-05-03 15:51:16 +02:00
|
|
|
|
|
|
|
@Override
|
2021-12-02 14:44:26 +01:00
|
|
|
public boolean canPipeWork(ItemStack module, PipeBlockEntity tile) {
|
2020-05-03 15:51:16 +02:00
|
|
|
return true;
|
|
|
|
}
|
2020-10-14 22:30:02 +02:00
|
|
|
|
|
|
|
@Override
|
2021-12-02 14:44:26 +01:00
|
|
|
public List<ItemStack> getAllCraftables(ItemStack module, PipeBlockEntity tile) {
|
2020-10-14 22:30:02 +02:00
|
|
|
return Collections.emptyList();
|
|
|
|
}
|
2020-10-14 23:39:11 +02:00
|
|
|
|
|
|
|
@Override
|
2021-12-02 14:44:26 +01:00
|
|
|
public int getCraftableAmount(ItemStack module, PipeBlockEntity tile, Consumer<ItemStack> unavailableConsumer, ItemStack stack, Stack<ItemStack> dependencyChain) {
|
2020-10-15 04:15:52 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2021-12-02 14:44:26 +01:00
|
|
|
public ItemStack craft(ItemStack module, PipeBlockEntity 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
|
2021-12-02 14:44:26 +01:00
|
|
|
public Integer getCustomNextNode(ItemStack module, PipeBlockEntity tile, List<BlockPos> nodes, int index) {
|
2020-12-04 19:32:16 +01:00
|
|
|
return null;
|
|
|
|
}
|
2021-03-03 00:10:24 +01:00
|
|
|
|
|
|
|
@Override
|
2021-12-02 14:44:26 +01:00
|
|
|
public ItemFilter getItemFilter(ItemStack module, PipeBlockEntity tile) {
|
2021-03-03 00:10:24 +01:00
|
|
|
return null;
|
|
|
|
}
|
2022-06-30 16:00:33 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public DirectionSelector getDirectionSelector(ItemStack module, PipeBlockEntity tile) {
|
|
|
|
return null;
|
|
|
|
}
|
2020-04-16 00:39:53 +02:00
|
|
|
}
|