Depot comparing

This commit is contained in:
grimmauld 2020-10-10 17:54:17 +02:00
parent f593aca95d
commit 9bff016ba4

View File

@ -9,6 +9,7 @@ import com.simibubi.create.foundation.item.ItemHelper;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputBehaviour;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
@ -28,6 +29,11 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.items.ItemStackHandler; import net.minecraftforge.items.ItemStackHandler;
import javax.annotation.ParametersAreNonnullByDefault;
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class DepotBlock extends Block implements ITE<DepotTileEntity> { public class DepotBlock extends Block implements ITE<DepotTileEntity> {
public DepotBlock(Properties p_i48440_1_) { public DepotBlock(Properties p_i48440_1_) {
@ -130,4 +136,18 @@ public class DepotBlock extends Block implements ITE<DepotTileEntity> {
itemEntity.remove(); itemEntity.remove();
} }
@Override
public boolean hasComparatorInputOverride(BlockState state) {
return true;
}
@Override
public int getComparatorInputOverride(BlockState blockState, World worldIn, BlockPos pos) {
try {
return ItemHelper.calcRedstoneFromInventory(getTileEntity(worldIn, pos).itemHandler);
} catch (TileEntityException ignored) {
}
return 0;
}
} }