mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 19:58:34 +01:00
add comparator to adept hopper
This commit is contained in:
parent
104b5538e5
commit
70ace2867c
1 changed files with 13 additions and 1 deletions
|
@ -10,13 +10,17 @@ import net.minecraft.block.state.BlockStateContainer;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
@ -92,7 +96,15 @@ public class BlockGratedChute extends BlockContainerImpl {
|
|||
|
||||
@Override
|
||||
public int getComparatorInputOverride(IBlockState blockState, World worldIn, BlockPos pos) {
|
||||
return 0; //TODO Comparator
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityGratedChute) {
|
||||
IItemHandler handler = ((TileEntityGratedChute) tile).getItemHandler(null);
|
||||
ItemStack stack = handler.getStackInSlot(0);
|
||||
if (stack.isEmpty())
|
||||
return 0;
|
||||
return MathHelper.ceil((stack.getCount() / (float) stack.getMaxStackSize()) * 15);
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue